Sublime Forum

Entering quoted strings

#1

I just picked up sublime (ex-gvim user) and it’s great, except for one small thing.

Entering a ‘"’ or “’” followed by a character will start a string and automatically terminate the string with a similar quote character, except when the next character can be accented, which is very annoying. Is there any way to turn this behaviour off so that entering a character will always start a string? I couldn’t see an obvious setting which would control this.

Thanks

0 Likes

#2

Nothing? That’s a pity – back to vim it is then.

0 Likes

#3

Believe this has to do with how the auto pair functionality works. You would have to disable the built in autopairing, and write your own keybindings to get the behavior you want. It sounds like you just want to disable the automatic forward movement when you enter the closing quote. Though I could be misunderstanding.

0 Likes

#4

This will make " and ’ always output " " / ’ '. Just put it in your user keysettings.

	{ "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 }
	]},
	{ "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 }
	]},
0 Likes

#5

Thanks a lot, it works perfectly.

I’ll take the time to figure out how to configure things myself once I decide on whether I’m going to switch my main editor, but for the moment I just need to be productive.

0 Likes

#6

If you find something missing, don’t be afraid to ask. Either someone tells you how or if it’s actually a missing feature someone may be able to implement it. Everybody benefits. :wink:

0 Likes