Reputation: 15027
You can use Alt + Click
to set multiple cursors in PhpStorm but if you want to quickly make an array of some list like this, it's simply too many lines to click: (example from Sublime Text 3)
In Sublime Text 3 you simply select all the lines and hit Ctrl + Shift + L
and it will set cursors at the end of each line and then you can hit Home
button to set the cursors at the beginning or whatever.
I can't find anything in docs... maybe someone knows how to do this in PHPStorm or at least how to make some keyboard shortcut with macro or something?
Upvotes: 13
Views: 12258
Reputation: 101
In case someone needs this.
How to select multiple occurrences of a word or a text range in PHPStorm
https://www.jetbrains.com/help/phpstorm/multicursor.html#multiple_words
Successively press Alt+J to find and select the next occurrence of case-sensitively matching word or text range.
Upvotes: 2
Reputation: 165088
Such action is available from 2020.2 version -- see IDEA-122181.
It's called Add Caret Per Selected Line and by default has Alt + Shift + G shortcut on Windows (⌥⇧G on Mac).
There is also Extra Actions plugin: it claims to do that and a few other things.
Current alternatives (that are much easier than the mentioned Alt + Click):
Just go into Column Selection Mode (from the "Edit" menu, Alt + Shift + Insert on Windows, Cmd + Shift + 8 on Mac). Exit that mode when done.
Alternatively, to add multiple carets (Clone Caret Below / Above):
You can also make a multiple selection by pressing Shift + Alt and dragging the caret.
From https://www.jetbrains.com/help/phpstorm/working-with-source-code.html#multiple_cursor
Upvotes: 18