Search code examples
autocompleteeditortextmatetext-editorsublimetext2

Sublime Text 2 how to wrap selection with quotes/auto-pairing


I just switched from Textmate 2 to Sublime Text 2. I figured that typing single quotes or brackets would automatically generate a second quote or bracket with the cursor in between ("auto-pairing" is what they call it, Textmate2 does this by default) but this isn't happening.

I see that in the preferences->settings-Default there is some JSON configuration that would seem to be doing what I need but this is not the case. I haven't changed any of this default configuration.

Could someone help me add to my preferences->settings-User the configuration I need to enable auto-pairing for all the common tags, i.e., "'{[(?


Solution

  • Right now I'm working on a client's laptop and running Sublime Text 2 portable version from my flash drive. No additional packages installed, default settings. Everything works as expected:

    1. When I type a single or double quote, brackets, square or curly brackets it adds a closing one and puts cursor in the middle.
    2. When I select smth and press any of mentioned above keys it surrounds selection with pair of appropriate quotes or brackets.

    Check your Settings>Default, look for this:

    // Controls auto pairing of quotes, brackets etc
    "auto_match_enabled": true,
    

    It's near line 89 or so.