PyCharm: Turning selection to multiple cursors per

2019-01-23 02:44发布

Sublime Text has this functionality where you can select text and start editing each line with a (multiple) cursor:

enter image description here

Is there PyCharm equivalent?

标签: pycharm
7条回答
劫难
2楼-- · 2019-01-23 03:02

From source:

To add carets, do one of the following

  • Press Shift+Alt and click the LEFT mouse button at the location of the caret.

  • Double-click Ctrl and press up arrow or down arrow keys.

On OSX it seems to be enough to press down the LEFT-ALT and add new carets with mouse LEFT CLICK, or press down SHIFT+ALT and paint the cursors with mouse.

查看更多
你好瞎i
3楼-- · 2019-01-23 03:02

To do this on Linux (tested on Ubuntu 16.04), do as follows:

In your editor, press Alt + Windows Key and use your mouse to place the cursor on the lines you want to have multiple cursors on.

You may also want to allow placement of caret after the end of line or inside tabs. In that case you need to change your settings:

Go to Editor -> Generaral -> Virtual Space:

  • [x] Allow placement of caret after end of line
  • [x] Allow placement of caret inside tabs

And make sure the above mentioned two settings are enabled.

查看更多
劳资没心,怎么记你
4楼-- · 2019-01-23 03:05

Another option: with text selected, toggle column selection mode:

enter image description here

The default shortcut to toggle the mode is:

  • Linux/Windows: alt-shift-insert
  • Mac cmd-shift-(numpad) *

(or EditColumn Selection Mode)

It's an inconvenient shortcut for Mac, as most laptops have no numpad. I remapped it to cmd-shift-8.

Column selection mode actually has other purposes too: it changes the default behavour when selecting text with the keyboard and mouse. Toggle it off again to return to normal selection behaviour.

查看更多
ら.Afraid
5楼-- · 2019-01-23 03:08

The simple way I think is to select the text and go on pressing Alt + J for Linux and Ctrl + G for Mac until you reach the last match.

PyCharm blog

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-01-23 03:15

Hold Alt and drag the mouse over the desired text.

Source: https://www.jetbrains.com/help/pycharm/2016.1/selecting-text-in-the-editor.html

查看更多
SAY GOODBYE
7楼-- · 2019-01-23 03:19

You can use plugin Extra Actions.

You must add a combination to this action:

Split Selection into Lines

No shortcuts are set by default.

You can easily set them by going to

Settings > Keymap > Plugins > Extra Actions

Configuring keyboard shortcuts.

查看更多
登录 后发表回答