Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the way Sublime Text 2 auto encloses selections in pairs be changed?

In Sublime Text 2 you can type a string and then highlight some section of the string like the following:

enter image description here

Then you can enclose the selected text in " by just typing a single " which gives you this:

enter image description here

When you do that the cursor ends up between d and ", I'd really like it to end up outside of the " at the end of the selected string.

enter image description here

Is something like this possible?

like image 719
Jason Avatar asked Jun 18 '12 00:06

Jason


1 Answers

This isn't a feature I use, but the following seems to work ok. Create a snippet like this:

<snippet>
    <content><![CDATA["$SELECTION"$0]]></content>
</snippet>

The $0 specifies the cursor exit point. Keybind it in your /Packages/User/Default (Linux).sublime-keymap file:

{ "keys": ["\""], "command": "insert_snippet", 
  "args": {"name": "Packages/User/quotes.sublime-snippet"}}
like image 118
fraxel Avatar answered Nov 14 '22 06:11

fraxel