linrongbin
linrongbin

Reputation: 3361

How to change the auto-complete select key in Sublime Text 3?

I have used vim for a while, in vim auto-complete, I use 'tab' 'down' to select the next candidate, 'shift+tab' 'up' to select the previous candidate, 'enter' to confirm that completion.

But in Sublime Text 3, I found 'tab' and 'enter' are both to confirm completion, only 'up' 'down' is to select the previous/next candidate.

How can I set the key like vim auto-complete mode ?

Upvotes: 4

Views: 1683

Answers (1)

r-stein
r-stein

Reputation: 4847

Just add this to your keymap:

{
    "keys": ["tab"],
    "command": "move",
    "args": {"by": "lines", "forward": true},
    "context": [{"key": "auto_complete_visible"}]
},
{
    "keys": ["shift+tab"],
    "command": "move",
    "args": {"by": "lines", "forward": false},
    "context": [{"key": "auto_complete_visible"}]
},

The context auto_complete_visible enables the keybinding only if the autocomplete popup is visible.

Upvotes: 11

Related Questions