Multi-line block select using the keyboard in IntelliJ IDEA on a Mac OS X

Greg Kopff picture Greg Kopff · Apr 2, 2014 · Viewed 12k times · Source

I've recently switched from Eclipse to IntelliJ IDEA 13. I use the VI keybindings.

One non-vi thing I am used to doing in Eclipse is using Shift + / Shift + to block a few lines of text. The behaviour of this text selection in Eclipse is the same as almost every other text input widget I've ever used. Typically I do one of two things after making the selection - delete this block or comment it out ( + /).

I have no found equivalent keyboard-only multi-line selection function in IntelliJ IDEA 13.

Shift + does not start a block selection - it seems to page the cursor up and down the screen.

If I use the mouse to start making a selection, then the arrow keys do extend the selection. However, I'm unable to start a selection using the keyboard alone.

I'm aware of the + W ever-outward-growing smart element selection - but if you then use the arrow keys, the selection is lost, not extended.

How can I start and then extend a selection region across multiple lines using the keyboard only on Mac OS X (that works with the VI keybindings enabled)?

Answer

Gibolt picture Gibolt · Sep 17, 2017

Multi-line caret

For Mac, you can use +(Hold)+↑ / ↓. For Windows, replace the with CTRL.

ESC will end multi-line mode.

Change Multi-caret Hotkey

To add a custom Keymap, +SHIFT+A, type keymap and click on the one with Settings as subtext. Search for Clone Caret Above and Clone Caret Below.

I mapped mine to ALT+SHIFT+↑ / ↓.

Bonus

Try holding combinations of , SHIFT, and arrows for improved selection power.