Sublime Forum

Single keypress tab completion not allowed anymore in sublime text 4

#1

I was quite happy with the upgrade to sublime text 4 until I realized that tab_completion now separates showing the auto_complete list and committing to the auto-complete list as separate events.

Expected behaviour: In sublime text 3 pressing tab once immediately makes the first match in the (hidden) autocomplete list show up. Further tabbing will cycle through the rest of the matches.
I liked this behaviour because 90% of the time the first match already is the item that I want. I can just keep typing.

Actual behaviour: In sublime text 4 I must press tab twice (if auto_complete_commit_on_tab is true) or tab -> enter (if auto_complete_commit_on_tab is false), where the second keypress is used to commit the match.

I know this sounds pedantic, but remembering to press tab twice takes me out of my zone a bit, and breaks my concentration. So I tried to chain the two events together:

Attempted fix: used macros as well as Multicommand to bind the “tab” key to the following chain of command:

{"command": "auto_complete", "args": {"mini": true, "default": "\t"} }' and

{"command": "commit_completion"} commands.

Neither worked. The first of the two lines (auto_complete) runs just fine; but the second line is not ran until a second keypress

Attempt 1 to debug attempted fix:

Hypothesis: Perhaps the macros and the Multicommand plugin records the state of the cursor/file/window and feed those into the individual commands in the macros/chain of commands?
auto_complete_visible is false to begin with, so (I assume) when the “commit_completion” command receives “auto_complete_visible” : false as the input state, then it proceeds to do nothing, nullifying the second command.

Please let me know if anything I said above is inaccurate, or if you have any suggestions on side-stepping this!

1 Like

#2

Edit: Found the solution after a bit more searching - Suor and LightsOut8008 collaborated in this thread to make the following package hosted on github.

I git cloned it directly to my ~/.config/sublime-text-3/Packages/ and copied the Default.sublime-keymap into my sublime keybinding file, and it works straight away.

Thread can now be closed.

2 Likes

#3

I was facing the same issue; this worked like magic. Thanks!

1 Like