Sublime Forum

Is it possible to not autocomplete single quotes only in text files?

#1

I’m completely OK with the autocompletion of brackets and double quotes everywhere, so I want to keep that as is, without any modification. I mean, the option "auto_match_enabled": true is exactly what I want.

I’d like to have just one exception: to not autocomplete single quotes in plain text files. (And to autocomplete them in any other files).

According to these pages of the documentation:
https://www.sublimetext.com/docs/key_bindings.html
https://www.sublimetext.com/docs/selectors.html
something like the following should accomplish that (the first “selector” key):

{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context":
	[
		{ "key": "selector", "operator": "not_equal", "operand": "text", "match_all": true }, // should ignore plain text?
		{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
		{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
		{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
		{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
		{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }
	]
},

However, it does not ignore plain text files.
What am I doing wrong?

0 Likes