How can I select next occurrence in IDEA editors - intellij-idea

Ctrl+D performs the find_under_expand command in sublime. This basically searched for the next occurrence of the already selected text and selected it, so when I edit, it's edited on both places at the same time. I'm currently trying to move to IDEA editors (such as WebStorm, PHPStorm, PyCharm, etc) but didn't find something like this command in this IDE yet.

I believe they recently added this to the latest IntelliJ release, and I would assume PhpStorm as well. As the bindings are system specific, take a look at http://blog.jetbrains.com/phpstorm/2014/03/working-with-multiple-selection-in-phpstorm-8-eap/. Looks like that version is available through EAP, so don't know when they will release it for general consumption (or if they have already).
DEFAULT SHORTCUTS
Alt+J on Windows and Linux, Ctrl+G on Mac OS X

On Mac OS X, you can select the next occurrence with Ctrl+G

In the settings window, search for ”Add Selection for Next Occurence” (PhpStorm 8.0.1)
On mac the default is ctrl+G, but you can change it to ctrl+D (or cmd+D on mac)

Currently its mapped with
for selection, Alt + J
for unselection, Alt + Shift + J
but if you're familiar with sublime shortcuts like Ctrl + D
Jetbrains give you an option to change settings,
Settings -> Keymap -> Editor Actions
search for multiple selection, find Alt + J
then right click -> select change keyboard shortcuts
set shortcuts you want as like sublime, Ctrl + D
Here is the Docs

On Windows
Alt+j - Multiple Select
Alt+Shift+j - Unselect Multiple Select

I think what you want to do is refactor it at all the place in the file at once.
So in MAC machine the handy shortcut for it is shift + F6 (you may have have to use fn key before F6).
Click on the text you want to change and then press shift + F6. It will highlight the text and then your change at all the place in the file. :)
It will do the job same as sublime ctrl + D

PhpStorm has a "Select Word at Caret", Ctl+W and Ctl+Shift+W respectively (you can check your keys by searching under Preferences > Keymap).
Detail here:
http://www.jetbrains.com/phpstorm/webhelp/selecting-text-in-the-editor.html#d617165e275
Not entirely sure if it's the same as you mentioned, but it's mighty handy!

Related

Line-Comment shortcut on german keyboards

What is the equivalent of CTRL + SLASH on german keyboards?
I know that US-Layouts got that / where the german _ is, since I used an US-Layout for some time. But CTRL + _ just collapses a method.
Just use the slash (Ctrl + /) on the numpad.
I found a solution for using the desired shortcut on Intellij Idea.
You just need to:
- click Ctrl+Alt+S to open the settings dialog box,
- choose "Keymap" from the left menu
- then search for keyword "comment".
- right click on "Comment with Block comment" and select add Keyboar Shortcuts.
- Type the shortcut you want to use and click ok.
For more details : https://www.jetbrains.com/help/idea/2016.3/configuring-keyboard-shortcuts.html
I just changed Ctrl + Slash and Ctrl + Shift + Slash to Ctrl + 7 and Ctrl + Shift + 7.
Works as expected, as they are the same key on german keyboards.
Problem is Ctrl + Shift + 7 is used for bookmarking a line, so I have to override this shortcut.
As of today it is still an unresolved IDEA issue, see this
https://youtrack.jetbrains.com/issue/IDEA-16116.
Defining a custom keymap seems to be the best solution.
A little late to the party, but maybe it helps someone...
I'm using Ubuntu 16.04 with the gnome desktop.
I frequently switch between the german and english keyboard layout.
In order to be able to use IntelliJ shortcuts with the english layout I had to change the order of the layouts in my system settings:
(gnome desktop) > settings > keyboard > Input source (top right corner)
There you find all configured input sources. I moved "english" to the top.
Now I can use all shortcuts based on the english layout, even when I switch to german. This means e.g. Ctrl + _ with the german or Ctrl + / with english layout would be line-comment in IntelliJ.
Not really an answer but I found this while googling and unfortunately had to add a custom keymap, too.
I now have it on CMD + ß. The combination is not used (which makes sense due to its QWERTZ relation). Works for me.
I just discovered that STRG(CTRL) + # works for my QWERTZ-Keyboard.
Hope it helps somebody!
It's been almost 4.5 years and I just want to share with you guys, which route I took because of only this issue (more or less). Sorry that this is not an answer in the proper stackoverflow manner.
I switched my keyboard setting to "US - International" and only use this one for everything I do nowadays. You can have the umlauts (by pressing Shift + ä and then your desired letter) on windows and macos. An all the "special keys" feel so much more natural! While you have to do finger-splits for certain characters, they use AT MAX the shift key on US layouts. Feels so much nicer to write and code like that!
I know, this is probably not what you are going to do, but I can tell you, that I find more and more people who did that and not a single one of them regretted that. Obviously that means, that you should be able to type blindly. :) At least, most keyboard I use, don't have the US layout on it. I adapted to it pretty fast though.
So basically, having the umlauts takes a tiny little bit more effort, but this is really worth it, because everything else makes so much sense on the US layout and you will get all the keymaps as they were intended to be used. Not those crappy "translations" that sometimes don't make sense, like this annoying line-comment thingy here.
Update 2021:
Compare how you write those characters on a US layout compared to whichever layout you are using. There are dramatically less keys involved in using those chars and I can write them faster and also with less wear and tear on my fingers.
;
:
/
`
'
#
<>
[]
{}
I also struggle with this shortcut and could'nt find the right combination.
The only solution i found is to change to English keybord layout using Alt+Shift and then use Strg+Underscore for commenting and back to german layout Alt+Shift.
This helps for the moment. Hope for a better solution.
I solved this by changing the shortcut. You can do this the following way:
In Android Studio in the top menu, click on Android
Studio->Preferences...
A new window pops up, in the side menu of it select Keymap. Now
you see a list. Click on Main menu -> Code -> Comment with
Line Comment (doubleclick) -> add keyboard shortcut.
A small window pops up. You can now simply press the shortcut you
prefer and click ok.
Don't forget to save your changes by clicking OK or Apply.
The configured shortcut should work immediately.
Copying over a solution I found in one of the comments in Jetbrain's bug tracker (see https://youtrack.jetbrains.com/issue/JBR-216#focus=Comments-27-4838035.0-0 )
[...]
I found the plugin "Keyboard Nationalizer". Install the Plugin, restart IntelliJ and execute the Action "Generate National Keymap" - that's it.
After generating a German layout, the shortcuts can be used again
If you are on macOS (MacBook, ...) and have a German keyboard you can make the command + / keymap work like this:
Step 1 - macOS settings
Disable the "Hilfemenü anzeigen" ("Open the Help menu") shortcut in the keyboard settings of macOS:
Step 2 - IDEA settings
In the keymap preferences of IntelliJ IDEA (or Android Studio) add the keymap shift + command + 7 for "Comment with Line Comment". Note: I used the "macOS" keymap settings as the basis, and adding a keymap will create your personal copy of the settings.
Now it should work the same way as in Visual Studio Code for example.
In my current version of IDEA v.20221.1.4 there is an option "Use national layouts for shortcuts (require restart)". Activate it, nothing changed.
Then I check the documents of IDEA, it says you need to install the "Keymap Nationalized" plugin to use it. Deatails about this plugin can be found here: https://plugins.jetbrains.com/plugin/14625-keymap-nationalizer
After install this plugin in IDEA. Double click "Shift" button in IDEA, the "search every" windows will be opened. Find the setting for Keymap Nationalized plugin. Now you can choose the language for the keymap. You will see new keymaps were added, for example there is a new keymap for the Comment with line added.
For MacBook Pro & Air, command + shift + 7 works fine in Visual Studio Code.
If you have a numpad, try using command + /(from the numpad). It worked for me.

Move file from one editor window to another (split mode)

Is it possible to move a file (already opened) from one editor to another in split mode without using mouse and without using tabs (I have tabs disabled).
Example of what i want to accomplish. I enabled split mode (vertical) and opened file X in left editor. I want to move this file X to right editor because I already have file Y int left editor.
I found the command Move to opposite group which works fine only when tabs are enabled. When tabs are disabled (my case) call Move to opposite group force split mode to disappear.
Goto File->Settings
Then Keymap
Type in the searchbox "Move To Opposite Group"
Assign a shortcut
Also useful is "Goto Next Splitter" which allows you to switch between your Splitter.
But you'll hardly find a shortcut which is not already occupied.
I used Ctrl + NumPad+ for "Move To Opposite Group" and Ctrl + ArrowRight for "Goto Next Splitter"
You'll be notified that this shortcut is already in use, but you can ignore that. I had no conflicts so far
I agree with David Viehtauer and would add to his setup. This also won't work with tabs disabled, but has become essential to my workflow.
My prefered setup under Preferences > Keymap:
Move Right: ⌃ + ⌘ + ↓
Move To Opposite Group: ⌃ + ⌘ + ↑
Goto Next Splitter: ⌃ + ⌘ + →
Goto Previous Splitter: ⌃ + ⌘ + ←
Move Right will create a new splitter and send your current tab to it (if you have more than one tab on your current splitter). Once your file is in a new splitter you can go between your splitters with the Goto Next Splitter and Goto Previous Splitter shorcuts above. Now, using the Move To Opposite Group shortcut you can move your active tab to the preferred side.
Once you get familiar with this setup, you can quickly manage your tabs.
Action Open in opposite group is the closest solution I found.
Example of what i want to accomplish. I enabled split mode (vertical) and opened file X in left editor. I want to move this file X to right editor because I already have file Y int left editor.
After Open in opposite group action X will be opened in both editors. My workflow is "move" X to right editor and keep working in left editor.
My choice in this case was to use CTRL-SHIFT-a. I felt the command was not important enough to dedicate a shortcut to it.
As soon as the dialog appears, it is sufficient to type open opp and then you can already hit ENTER.
Here is another way to do this:
Put the cursor in the editor you want the class to display in
Bring up the search for class dialog (alt-o in my mac keymap, can't
remember if I customized this or not)
Search for your class
Select it then hit cmd-shift-enter, it will open in the editor your
cursor is in even if it is already open in another editor pane

Using Sublime Text 2 key bindings in PyCharm

I would like to use the Sublime Text 2 key bindings in Pycharm. I know how to edit it one by one. Is there a way to override the entire keymap in one shot?
Something like
export the key bindings from sublime text 2
convert it into Pycharm's format
import it into Pycharm
Pycharm has some pre-configured keymaps. If there's a text / XML / JSON file where these maps are stored, I can try to convert it myself.
PyCharm now has Sublime Text keymap inbuilt as an alternative to Default Keymap.
Go to Setting -> Keymap and select Sublime Text from Keymap dropdown.
Hope that helps.
After poking around, I feel there's no easy way to do this.
If you change the default bindings, PyCharm creates a file in user space that shows the format of keymap. Theoretically, one could override all the fields in this file. But the problem is, there's no standard way of describing the action performed by a shortcut. Someone will have to do it manually, for each macro, to establish a correspondence between the actions performed by PyCharm & Sublime Text.
There is an IntelliJ request for this in their Youtrack tracker: IDEA-111333 Provide Sublime Text keymap.
From that thread, I found a repository for another remapping project. The keybinding file that imitates most of Sublime text can be found at in the directory PHPStorm-SpacePeacock/win_linux-keymaps-only/keymaps/Default for GNOME copy.xml. From the README:
The key mapping has been updated to better fit Sublime Text
conventions. Because I didn't think that ctrl + shift + alt + t is a
reasonable key combination for something as frequently used as
Refactor This.
Additionally, "search everywhere" HAD to be changed because
double-tapping left-shift is a two stroke trigger. This is a problem
because as you're working the IDE will be busy with analyzing,
indexing, and all of the things that IDEs do. If it's busy when you
try to hit the first left-shift, then the second left-shift won't pop
up the window. As far as user interfaces go, you should never have any
lack of confidence that an action will trigger the appropriate
response. Once you have that, you have to visually check each
operation which is slow and creates cognitive overhead. Consequently,
this was changed to ctrl + p (also to match Sublime Text) which
completely removes this problem.
ctrl + p search everywhere
ctrl + r search methods in current file
ctrl + alt + p change projects
ctrl + shift + enter complete current statement
ctrl + alt + enter refactor this
alt + enter show intended actions (intentions are one of my favorite
part JetBrains software)
ctrl + n new thing dialog
ctrl + shift + f format code
ctrl + d select word at cursor, or if a word is selected the select
the next occurrence of the word (multiple-cursors)
ctrl + t run tests
ctrl + alt + h show local history
ctrl + alt + r git conflict merge tool
(Less popular) keymaps that can be used with JetBrains Rider but not included in the installation package.
https://github.com/JetBrains/rider-non-bundled-keymaps
Intalling keymaps
In releases, get the sublime-text-keymap.jar file for the desired keymap.
In your IDE, choose File | Import Settings... from the menu and select the sublime-text-keymap.jar file.

What is the shortcut key for replace text in all files in Sublime Text 2?

How do I execute the "Replace" command with a keyboard shortcut?
I can't seem to find the "command" in the default keymap for OS X.
I know the single file replace all shortcut is control + option + enter, but that doesn't work in this case. This is in OS X, but it probably applies to Windows.
20 minutes of research turned up nothing.
Attempts:
Opened up the Find in Files panel and tried lots of combinations. No luck.
Browsed the keybindings file for anything bound to the find_in_files panel. No luck
Browsed the official Sublime Text API. No luck.
Browsed the unofficial list of commands. No luck.
This feels like a big oversight...
update: This is not implemented. Here is the official feature request.
Ctrl + shift + F
now you can add files and folder where you want to find and replace in all files.
Ctrl + Alt + Enter works for me in the latest Sublime Text 2

keyboard shortcut to switch between project frames in Intellij IDEA

Is there a keyboard shortcut to switch between project frames in intellij?
I have two projects open and the only way I've found to select the non-active project is to drag the top window/frame out of the way and then click on it.
On osx, I use the standard keystroke (both Command+~ or Command+` seem to work) for switching windows within an application.
On windows, I use alt+tab.
Annoyingly, you can use "Cmd + `" to switch through your windows but it doesn't loop back to the first window when you reach the end. You have to use "Shift + Cmd + `" to go in the reverse direction.
for Mac OS X, try:
option + command + [
option + command + ]
If you have multiple projects just switching between them may be too tedious.
In such case it's better to open Window menu using ALT+W and choose project from list.
To make quick search working for project names you need to open Window menu as popup. To do it just assign keyboard shortcut for it:
I chose CTRL+ALT+W as my shortcut to open the following window with project quick search:
for Windows, try:
Crtl + Alt + [
Ctrl + Alt + ]
I've stumbled upon an intellij-native popup for switching projects. To find it and set a key mapping:
cmd+shift+a (if macosx; shift+shift might work cross-platform) for the find-command popup menu
type/search for the "open project windows" command
option+enter (or equiv) to assign a key mapping
This Project Windows popup lets you type to filter and select by project name.
Go to Intellij Preferences.
Under Keymap find Activate Next Window.
Right click on it and choose Add Keyboard Shortcut.
Press cmd + ` and click OK.
Click OK to close Preference window.
Map key to Activate Next Window
2013 answer for people who want an "up to date" answer:
If you maximize (full screen) all your project windows and keep them grouped together in "mission control" then I find the three finger swipe works really well to move between projects.
Ctrl + Shift + [
Ctrl + Shift + ]
Does it for me. On both Intellij IDEA and PyCharm.
On Windows the following should work:
Ctrl + tab
There is no such shortcut by default, but it should be possible to implement this feature as a plug-in.
In ubuntu 18.10, you can use the below key combination for toggling betwee two open instances -
alt + `
In ubuntu, switching between multiple windows inside an IntelliJ,
use alt + ~
If you're a MacOS user, as well as the Command+` and Command+Shift+` keyboard shortcuts which IntelliJ offers to toggle between IntelliJ windows, the OS-level Control+↓ keyboard shortcut is an excellent way to see and navigate between windows of the current app. The screenshot below shows the view which it offers. If you turn on App Exposé in your Trackpad preferences, you can also get to this view by swiping down with three fingers.
For Mac,
Command + Shift + [ or ]
works in full screen mode.
fast forward to 2022 and you get...
I'm working on a Mac OS X. Right click on IntelliJ dock icon shows all your open projects.
I was struggling with the same issue. This is how I dealt with it.
If you have set up your mac for expose ( by default F10 for application windows), then you could use that keyboard shortcut. This is the quickest way I know and since I usually have around 5 project windows I use this fairly frequently.
On MAC CMD + ` will work.
Ensure that you haven't maximised windows.
Have been searching solution for macOS for long time and found this great plugin finally https://github.com/krasa/FrameSwitcher.
Switching intelliJ windows by searching project name including recent opened ones.
I am just put a new update her for MAC OS on version (20220.1.4)
it has new: command + option + stands for the next and command + option + shift + stands for back
I am using Mac Big Sur 11.2.3 plus IntelliJ 2019. to switch among windows, I use the following 3 keys.
⌥ ⌘ `
If you have opened multiple projects and want to switch between them, then you can use:
command `
that is, command and tilde (you can get it just above tab button).
This is for mac os.