Inti
Inti

Reputation: 3751

Moving between underscore separated words with Alt + ←/→ in PyCharm

In PyCharm when I move between words with the Alt + ←/→ shortcut it moves the cursor between whitespace separated words. How can I make it move the cursor between underscore_seperated_words?

Upvotes: 24

Views: 2560

Answers (2)

Eric Blum
Eric Blum

Reputation: 784

If you want both capabilities for whitespace separated and camelCase separated curser movement and selection, there are options in the keymap under Editor Actions called:

  • Move Caret to Next Word
  • Move Caret to Next Word in Different "CamelHumps" Mode
  • Move Caret to Next Word with Selection in Different "CamelHumps" Mode
  • Move Caret to Pervious Word
  • Move Caret to Previous Word in Different "CamelHumps" Mode
  • Move Caret to Previous Word with Selection in Different "CamelHumps" Mode

As I mainly use the regular cursor movement with Ctrl + ←/→ I added Alt + ←/→ for the "CamelHumps" mode. As mentioned, the CamelCase works for underline separated as well.

Upvotes: 2

Inti
Inti

Reputation: 3751

The option is not obvious but if I tick Editor -> General -> Smart Keys -> Use "CamelHumps" words then when moving between words with Alt + ←/→ I can step between underscore separated words rather than just space separated "words". The same works for camelCase words obviously.

Upvotes: 39

Related Questions