What’s Mining: Multiple Cursors and Selection

Hello everyone,

If you, as me, often dream of being in several places at once you will like this new feature coming to RubyMine from IntelliJ platform side! Please welcome multiple cursors and selection that you can already try in the last EAP version:

multiple_cursors

It was the top voted editor feature in our tracker and we hope you will like it. Let me go through this short demo in more detail and show you all the tricks.

Set multiple cursors

Let’s start with the very beginning. Using Alt with the mouse click you can set the cursors in all places you need (please note that you may always change the shortcut in Settings -> Keymap -> Editor Actions -> Add or Remove Caret):

multiple_cursors_1

multiple_cursors_2

You can also use keyboard. Please go to Settings -> Keymap -> Editor Actions and set up the shortcuts for Clone Caret Above and Clone Caret Below actions:

multiple_cursors_3

multiple_cursors_4

To switch off the multiple cursors and get back to single one, please press ⎋/Escape.

Edit your code simultaneously

Now, when multiple cursors are set, you can make some changes. For example, select the first words with Move Caret to Next Word with Selection (⌥⇧→/Ctrl+Shift+Right) action and move them to the end of lines with Cut (⌘X/Ctrl+X), Move Caret to Line End (⌘→/End) and Paste (⌘V/Ctrl+V) actions:

multiple_cursors_5

multiple_cursors_6

Or you can go back to the beginning of lines with Move Caret to Line Start (⌘←/Home) and capitalise the first letters with Right with Selection (⇧→/Shift+Right) and Toggle Case (⌘⇧U/Ctrl+Shift+U) actions:

multiple_cursors_7

multiple_cursors_8

Use code completion in multiple places at once

We’ve added an opportunity to use autocompletion and live templates with multiple selection as well. The context is determined from primary cursor’s location, resulting changes are applied to all cursors:

multiple_cursors_9

multiple_cursors_10

Find code occurrences to change

You can also easily change any repeating code fragment with Select All Occurrences (⌃⌘G/Ctrl+Shift+Alt+J) and Select/Unselect Next Occurrence (⌃G and ⇧⌃G/Alt+J and Shift+Alt+J ) actions:

multiple_cursors_11

multiple_cursors_12


Multiple cursors and selection feature as cool as it is to use now, it still has a long way to go: its implementation remains to be refined, and some limitations need to be dealt with. So we would really appreciate your feedback about it. Share your thoughts in our discussion forum and submit bug reports to the issue tracker. Thanks!


Develop with pleasure!
JetBrains RubyMine Team

This entry was posted in Productivity, WhatsMining and tagged , . Bookmark the permalink.

9 Responses to What’s Mining: Multiple Cursors and Selection

  1. awesome!

    but i’m curious to know what will happen with vim plugin enabled
    :D

    who knows?!

  2. Pingback: RubyMineでマルチカーソル/選択 | JetBrains ブログ

  3. Pingback: RubyMine Hinoki Goes Beta! | JetBrains RubyMine Blog

  4. Ron Elliott says:

    I have been waiting for this feature for a while. Sadly it’s still not enough for me to move back from sublime text. The VERY simple key combos used it ST still make it king of this feature. Jetbrains needs to deemphasize the mouse and long key combos.

  5. Georg says:

    Activating this dangerous feature by default was a completely stupid idea!

    • Tatiana Vasilyeva says:

      What is wrong with the feature?

      • Matti Airas says:

        It’s lovely already as it is – the feature I missed the most when I switched from ST to PyCharm. In a way I agree with Georg, however. Multiple cursors is a feature that needs to be learned – it’s not discoverable at all. Since the feature is a very advanced one, I’m not sure if you can do much about it. Maybe pop-up a non-modal dialog when it’s enabled for the first time?

        If you stumble upon it without knowing, I’m sure it’s easy to wreak a lot of havoc with it, so maybe it could be disabled by default. I think you could argue for either.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">