Absolut
Absolut

Reputation: 1310

How i can make Pycharm cycle through completion suggestions via 'Tab' key?

For example, i want to complete following statement:

foo = []
foo.a|
     +-----------+
     | append    |
     | __add__   |
     | clear     |
     | class     |
     | contains  |
     +-----------+

i hit 'Tab':

foo = []
foo.append|
     +-----------+
     | append    |
     | __add__   |
     | clear     |
     | class     |
     | contains  |
     +-----------+

hit once more

foo = []
foo.__add__|
     +-----------+
     | append    |
     | __add__   |
     | clear     |
     | class     |
     | contains  |
     +-----------+

...and so on. I saw this feature in Linux shells and Sublime text, but i can't find any settngs in Pycharm to implement such behaviour.

Upvotes: 1

Views: 932

Answers (2)

jcrigby
jcrigby

Reputation: 141

The closest thing I could get to your request is cycle the choice list with one pair of keys then choose the selection with tab. I realize that this is not a perfect solution but it works well for me.

The up and down keyboard keys will cycle through completions, if you want different keys to perform the 'Up' and 'Down' action, then goto

Settings --> Keymap --> Editor Actions

then add additional mappings for Up and Down. I come from Vim so I added ctrl-k and ctrl-j for Up and Down respectively. You will get a warning about another mapping already existing but was some thing that I would rarely use so I was ok with it.

Coming from years of using Vim, my first choice was to use ctrl-n and ctrl-p but that did not work for me for reasons I was not able to figure out. My second choice is somewhat intuitive for my Vim trained brain where k and j are up and down in command mode.

Upvotes: 3

and1er
and1er

Reputation: 1101

Is Alt+/ what you need? In PyCharm also has some other autocomplete shortcuts, for example Ctrl+Space shortcut.

You could adjust keys in PyCharm settings:

Settings --> Keymap --> search by "Completion" word

Upvotes: -1

Related Questions