Multiple Selections in Editor using the Mouse

Posted on by Dmitry Batrak

As of IntelliJ IDEA 13.1, if you need to edit a document in the same way in several places, you can save efforts by using multiple selections feature. All you need to do is create a caret at each location using Alt+Shift+Mouse Click and make your changes – they will be applied at all locations simultaneously.

This however doesn’t solve the issue of wanting to select arbitrary selections of text before editing. This has now been solved in IDEA 14.1. You can drag the mouse while holding Alt+Shift and select the text required. This feature can also be used to copy-paste several pieces of text in one go.

multiSelection1

Similarly, you can now add a new rectangular selection to existing carets/selections by dragging the mouse while holding Ctrl+Alt+Shift (Cmd+Alt+Shift on Mac OS).

multiSelection2

Try this and other enhancements by downloading IntelliJ IDEA 14.1 EAP build. Share your feedback on the discussion forum and in our issue tracker.

Thanks!

Comments below can no longer be edited.

10 Responses to Multiple Selections in Editor using the Mouse

  1. GNOK says:

    February 23, 2015

    I can’t make it work with the laste version of Intellij on Mac. Can I do it from menu? so that I can figure out. Thanks.

    • Dmitry Batrak says:

      February 25, 2015

      You cannot do exactly the same using menu.
      What exact version of product (build number) did you use?

  2. Adam says:

    March 1, 2015

    Doesn’t work on Ubuntu 14.10 with default keyboard shortcuts.

    • Dmitry Batrak says:

      March 2, 2015

      What product version are you using? Could you please also give some more details – i.e. what are your actions, and what is the result?

      • Andriy says:

        June 16, 2015

        Neither Alt+Shift+Mouse Click nor Alt+Mouse Click combinations doesn’t work in PyCharm 4.0.5 on Linux Ubuntu 15.04 x64
        Other combinations work well.

        • Dmitry Batrak says:

          June 17, 2015

          Alt+drag is usually mapped to dragging a window in Linux window managers. If you want to use Alt+click shortcuts, make sure you disable that in system settings.

  3. r34ch says:

    March 27, 2015

    What is the Keymap name to search for to change the multiple text selection from Alt+Shift?

    • Dmitry Batrak says:

      March 28, 2015

      It’s ‘Add or Remove Caret’.

      • r34ch says:

        March 30, 2015

        Thanks. I’ve noticed in both 8 and the 9EAP that switching the ‘Add or Remove Caret’ (alt + left click) keymap with the ‘Declaration’ keymap (ctrl + left click) still brings up the declaration hover popup as if holding ctrl with the original keymap instead of the newly assigned alt.

        Where can I report this?

        • Dmitry Batrak says:

          March 30, 2015

          Please create a ticket in YouTrack.

Subscribe

Subscribe for updates