Sublime Forum

CSS tab completion can't disable

#1

I can’t disable tab completion. I absolutely hate tab completion and am desperate to get rid of it. I’m currently using a trial version of sublime text 2.

I added this to Preferences > File Settings, User:

{ 'tab_completion' : false }

And then in my CSS, I typed: color, and pressed tab. A dialog pops out giving me a list to choose from, but I don’t want any. I just want to tab, not autocomplete! How do I disable it for good, or is this a bug?

0 Likes

#2

What you’re seeing here are snippets, which are different from tab-completion—tab-completion completes tokens by looking at other tokens in the file, whereas snippets are predefined for different languages and add chunks of code based on the tab-trigger.
Add this to your user key bindings and you should be good to go in all cases:

{ "keys": "tab"], "command": "insert", "args": {"characters": "\t"} }
It will overwrite all other bindings of the tab key.

0 Likes

#3

It occurs to me that you may still want to use the tab key to indent selected text; in such a case, you can copy the relevant bindings from the default key bindings file into your user keybindings file—just put them after the previous line I sent you. That command, which takes no context argument, will wipe out all other bindings. Further bindings with a context argument will be layered on top of the most recent context-free keybinding.

0 Likes

#4

That does the trick for me. Thanks a lot! I’m ready to get a license now. :smile:

I didn’t add in the part for indents, because I can always revert to command + and ] to do highlight indents.

EDIT: I added it and doesn’t seem to work for me when I do single line indents (select a whole line that doesn’t have a line ending, and press tab). I think it’s because of the regex “\n” part.


    { "keys": "tab"], "command": "insert", "args": {"characters": "\t"} },
    { "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 }
        ]
    }
]

Changing “\n” to “.” works.

YEAHHHHH!!!

1 Like

#5

So… Summing up…


[
{ “keys”: [“tab”], “command”: “insert”, “args”: {“characters”: “\t”} },
{ “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 }
]
}
]

0 Likes