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

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)?



Solution 1:[1]

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.

Solution 2:[2]

Sounds like you need to map it. In the default key mapping Shift+? and Shift+? work as expected (i.e. as you describe). I do not have the vi mapping available to check it. Go into Settings > [IDE Settings] > Keymap. In the Keymap, go to "Editor Actions". Configure the "Down with Selection" and "Up with Selection" options. This may mean removing the Shift+? and Shift+? mappings from something else.

Solution 3:[3]

I use the IdeaVIM plugin on Mac OS and I can increase or decrease my selection with the keyboard only with alt-Up/Down.

It is possible I customized the VIM keymap to this, can't remember if it is default or not. However, the editor action you are looking for in the keymap settings is "Select Word at Caret" and "Unselect Word at Caret". Repeatedly pressing the keystroke smartly selects/unselects the text. It almost always selects what I want.

enter image description here

Solution 4:[4]

You can use alt+Up/Down/Right/Left or alt+mouse-select to block select on mac in IntelliJ

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paul Verest
Solution 2 Javaru
Solution 3 Michael
Solution 4 caitcoo0odes