11

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

Gibolt
  • 42,564
  • 15
  • 187
  • 127
Greg Kopff
  • 15,945
  • 12
  • 55
  • 78

4 Answers4

8

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.

Paul Verest
  • 60,022
  • 51
  • 208
  • 332
Gibolt
  • 42,564
  • 15
  • 187
  • 127
1

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.

Javaru
  • 30,412
  • 11
  • 93
  • 70
  • `Down with selection` is ^⇧↓ - but that key combination doesn't appear to do the trick. If I search based on a keystroke, I find that ⇧↓ matches an entry simply called `Key` registered via the IdeaVim plugin (along with perhaps a hundred other keystrokes). Unfortunately, right clicking and attempting to edit the list is futile because the length of the list is taller than the screen, and it won't scroll. :-\ Perhaps time to log a bug with JetBrains... – Greg Kopff Apr 03 '14 at 01:26
1

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

Michael
  • 2,683
  • 28
  • 30
  • `Select Word at Caret` is originally bound to ⌘W, so this is the _ever-outward-growing smart element selection_ I spoke of. I just want to block the whole current line, and extend that selection _line-by-line_ in the direction I move the cursor. – Greg Kopff Apr 24 '14 at 22:50
  • I've ended up changing the binding for ⌘↑ and ⌘↓ to to be `Toggle Sticky Selection` - this gives me an easy key-stroke to start the selection and then continue with the arrow keys. – Greg Kopff Apr 24 '14 at 23:57
1

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

caitcoo0odes
  • 484
  • 1
  • 6
  • 17