Sublime Forum

Use Selection for Replace

#1

I selected a column of text to replace. I tried to replace the text with ( but sublime encapsulates the text with (). Is there a way to prevent it from doing that?

Thanks

0 Likes

#2

There are key bindings in place to do this for various constructs (", ', (, [, { and probably others I’m forgetting) as a shortcut for developers who may often need/want to wrap text in this manner; a similar set of bindings is also provided to automatically add the matching pair element when the first is typed (e.g. when you type ( the closing ) is automatically inserted).

If you truly don’t need/want this functionality, you can turn off the auto_match_enabled setting, which is enabled by default and causes these key bindings to be active. You can do this in your user preferences to turn it off everywhere, or just in certain syntax specific settings to enable/disable for certain file types only.

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

As an alternative you can also just press Backspace to delete the selected text first, since you want to do a replacement. This is the method I use in the rare case that I don’t want this, usually preceded by an undo operation because my memory is fairly poor for that kind of thing.

2 Likes

#3

Thanks!! I really like the backspace option.

0 Likes