How do I select a paragraph in PyCharm?

Answered

So PyCharm currently has these commands:

Move Caret Backwards A Paragraph
Move Caret Forwards A Paragraph

which I've bound to `ctrl+up` and `ctrl+down`. They work as expected and I like using them.

Unfortunately I can't select text whilst doing so. I've removed the keys bound to `ctrl+shift+up/down`, but that didn't help. It looks like I need some kind of command like:

 Move Caret Backwards A Paragraph And Select Text

Is this possible for me to add via some kind of plugin/macro, or do I just have to plea to JetBrains and hope they add it?

Or is there an alternate command that will achieve the same effect? (i.e. select the next/previous contiguous block of text)

Thanks,

Pod

5 comments

Note: The following commands exist but don't do what I want:

Move Caret To Code Block Start [With Selection]
Move Caret To Code Block End [With Selection]

As they can't be used repeatedly to continue to navigate/select multiple blocks like Move Paragraph can.

 

0

Hi there. Sorry for the late reply.

Apparently, there is no such editor action at the moment. But it indeed seems like a feature worth adding since you are not the first who asked for it, so, please, feel free to create a dedicated feature request in our tracker. 

This functionality could be implemented in a plugin for IntelliJ platform (PyCharm is based on) written either in Java or Kotlin. You can read more about plugin development here.

Also there is an action called "Toggle Sticky Selection" that has no assigned shortcut by default. It makes selection always follow the caret including movements with "Move Caret Backwards/Forward A Paragraph". Hopefully, you will find it useful.

0

Was a dedicated feature request ever created for this editor action? I would love to be able to use this, and would like to submit a feature request if one does not already exist.

0

Hi Kevin,

Yaroslav have created one recently. Vote for it or star to receive notifications of the progress.

1

I believe that with IdeaVim (ref.) you can easily do this. Enter in select mode (v) and then pres { to go up or } to go down. Easy-peasy.

About remapping PyCharm paragraph cursor movements, ^up and ^down are already used for scrolling. I would recommend using Alt-{ and Alt-} instead.

0

Please sign in to leave a comment.