Reputation: 2733
In Sublime Text I can arbitrarily select a set of lines and then use ⌘+L
to expand the selection to the full lines. Is there a similar command in PHPStorm / WebStorm? (I'd like to map that command to a keyboard shortcut.)
I know PHPStorm has the option "Select Line at Caret", but that selects only one line.
Upvotes: 10
Views: 15046
Reputation: 22480
Update
Nowadays (welcome 2020) Go to Preferences > Keymap. Change or add the value to
Add Carets to Ends of Selected Lines
=> CMD+SHIFT+L
to have it behave like Sublime Text so it looks like
Old Answer This is as close as I could get it (before 2020):
Go to Preferences > Keymap. Search for Clone Caret Above/Below
.
The keys are:
CMD+SHIFT+CTRL+ARROW_UP
for Clone Caret Above
CMD+SHIFT+CTRL+ARROW_DOWN
for Clone Caret Below
Click on Apply and it will work
Upvotes: 14
Reputation: 2855
With WebStorm 11 (at least) the multi-caret keyboard shortcut is:
Ctrl then Ctrl+Arrow Up (or click & drag with the middle mouse button/scroll wheel)
then to select the full lines:
Home then Shift+End
which you could even create as a macro with a keyboard shortcut.
I used to accidentally activate the multi-caret all the time (I scroll with Ctrl+Up/Down), so I knew how to do part of it, but it took me ages to figure out that extra Ctrl tap at the beginning.
Upvotes: 6
Reputation: 1042
This is currently not possible with a selection. However, you can still do that from the keyboard. Instead of doing selections set up a shortcut for Clone Caret Above
(Alt+Shift+U for me) and Clone Caret Bellow
(Alt+Shift+D for me). This allows to go up or down a line and add a caret there. So instead of selecting each line, you directly move the caret there and clone it.
I am also coming from Sublime Text and missing that feature, but this worked also pretty well.
Upvotes: 1