Search code examples
sublimetext2rubymine

How do I add the next occurrence of the current word to the selection in RubyMine (like in Sublime Text)?


How to do the equivalent of CMD + D in Sublime Text with RubyMine?

e.g. root this and that and this root.

  1. cursor on root
  2. CMD+D selects both root (in sublime)
  3. type word to replace both root

enter image description here

In RubyMine if I hold alt and click the word I want, it will duplicate cursors like that. That's what I want, BUT I don't want to click the next word ... I just want a NON-CLICKING keyboard shortcut like CMD+D in Sublime Text which is smart enough to select all of the same words.

enter image description here


Solution

  • After selecting matching text of the first instance you want to edit, type:

    • OS X: Ctrl+G or Ctrl+CMD+G (varies between installations or keymaps)
    • Linux or Windows: alt-J

    If none of those keybindings work for you, go to Preferences -> Keymap and search for the Select Next Occurrence editor command to see what it's bound to.

    More here (bottom of page): http://blog.jetbrains.com/ruby/2014/03/whats-mining-multiple-cursors-and-selection/