Sublime Forum

Auto pair quotes not really working

#1

Hi guys,
Looking to make the switch from TextMate pretty soon, but wanted to fix these issues first. The auto pairing quotes are a little wonky and don’t work all the time. For instance, if I wanted to add a style to a span tag, hitting the quote once would yield this:

<span style="></span> (notice single quote)

When I would really expect it to do this:

<span style=""></span> (notice double quotes)

For some reason, the pairing won’t work when I’m typing before the “>” symbol. Highlighting a word and hitting a quote will wrap the word in quotes, and heck, even when I’m on a new line and hitting a quote will result in a double quote.

Any help would be great…thanks!

0 Likes

#2

Same here. Any solution?

0 Likes

#3

In default - Keybindings: [code] // Auto-pair quotes
{ “keys”: “”"], “command”: “insert_snippet”, “args”: {“contents”: “”$0""}, “context”:

		{ "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.double", "match_all": true }
	]
},[/code]

Override this by adding the following to Keybindings - User:

[code] // Auto-pair quotes
{ “keys”: “”"], “command”: “insert_snippet”, “args”: {“contents”: “”$0""}, “context”:

		{ "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.double", "match_all": true }
	]
},[/code]

(I changed the “following text”)

0 Likes

#4

Thanks COD312! That worked for me. :smiley:

0 Likes