Reputation: 976
How do I disable auto complete or tab completion in Sublime Text 3? I want pressing tab to always insert the tab character unless the auto-complete dropdown box is showing something else selected.
What is happening (Javascript file):
After pressing tab:
I tried adding this to the Preferences.sublime-settings file:
"tab_completion": false
However, the behavior did not change.
My preferences file looks like this:
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_size": 9,
"ignored_packages":
[
"Vintage"
],
"tab_completion": false
}
My Preferences > Settings - Syntax Specific
file is empty:
// These settings override both User and Default settings for the JavaScript syntax
{
}
Upvotes: 5
Views: 2020
Reputation: 167
For those people here running Sublime Text 4, here is how I was able to remove the incredibly annoying popup menu on a TAB.
Go: Sublime Text>Preferences>Key Bindings
this will open the binding rules in a dual-pane editor. app defaults on the left, user prefs on the right. you can't edit the system defaults. You need to copy the rules you want to change to the right side and sve them. they will then overwrite the app defaults (no restart required).
Find lines #117 searching for "setting.tab_completion. Copy that block to the right side (lines 117-126 for me).
retaining the brackets, remove the bits except for the tab_completion line. Set this to:
{ "key": "setting.tab_completion", "operator": "equal", "operand": false },
Upvotes: 3
Reputation: 2313
The accepted answer didn't work for me.
These two settings worked for version 3 of Sublime Text and onwards.
"tab_completion": false,
"auto_complete_commit_on_tab": false
No restart of Sublime Text is required.
Upvotes: 2
Reputation: 9986
There's a solid chance that's how you got here. There's this well known phenomenon in SublimeText that if you press Tab after a word like "label" or "form", it assumes that you're trying to insert a tag and completes it for you. Practically you can never insert a tabulator after a word like this if you're in a HTML-like context.
I just figured out the way to disable it. Because no, tab_completion:false won't get rid of it. Nor will opening resource files and editing python scripts and anything else you can find on the net - and it will pretty much seem a futile fight until you realize that the whole thing is almost hardcoded into the Tab key's functionality; so just open your key bindings, and on the left side, in defaults, look for this magic sequence:
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
"context":
[
{ "key": "setting.tab_completion", "operator": "equal", "operand": true },
{ "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true },
]
},
{ "keys": ["tab"], "command": "replace_completion_with_next_completion", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "reindent", "context":
[
{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
]
},
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "\n" }
]
},
{ "keys": ["tab"], "command": "next_field", "context":
[
{ "key": "has_next_field", "operator": "equal", "operand": true }
]
},
{ "keys": ["tab"], "command": "commit_completion", "context":
[
{ "key": "auto_complete_visible" },
{ "key": "setting.auto_complete_commit_on_tab" }
]
},
Now all you have to do is copy this to the right side (keymap - user) and then remove the top 2 declarations. The ones that say "insert_best_completion". This way, your Tab key will still do every trick it normally should, indenting/unindenting and all, except that nasty autocomplete thing that's been driving you crazy for so long.
Oh you're absolutely welcome.
No, really. My pleasure.
Can't tell you how relieved I feel now.
Upvotes: 4
Reputation: 78
You are correct, Preferences > Settings and set "tab_completion": false. You then have to close the sublime application though, which maybe was the missing step here.
Upvotes: 6