Multiple cursors in PhpStorm like Sublime Text 3?

匆匆过客 提交于 2020-08-05 06:44:08

问题


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?


回答1:


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 few other things.


Current alternatives (that are much easier than the mentioned Alt + Click):

  1. Just go into Column Selection Mode (from Edit menu, Alt + Shift + Insert on Windows, Cmd + Shift + 8 on Mac). Exit that mode when done.

  2. Alternatively, to add multiple carets (Clone Caret Below / Above):

    • On Windows: Press Ctrl twice, and then without releasing it, press the Up or Down arrow keys.
    • On Mac: Press Ctrl + Shift + Down / Ctrl + Shift + Up
  3. 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



来源:https://stackoverflow.com/questions/62660713/multiple-cursors-in-phpstorm-like-sublime-text-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!