Sublime Forum

Wrap hightlighted text with "[" just like "(" and "{" does

#1

Hi peeps,

when I highligth some code and press “(” or “{”, it automatically wraps the code in “()” or “{}”. I code mostly in R, and also in markdown, where the same ability could be handy for “[”, that is, hard brackets.

I have tried searching for it, but can’t really find anything. You know how to do it?
regards,
Emil

0 Likes

#2

There are already default key bindings for auto pairing [ with selected text (The second key binding in the image)

if ( and { is auto pairing selections for you and [ is not, then I would suspect some other key binding is overriding [ (or you don’t have any selected text).

What happens if you type sublime.log_input(True) & sublime.log_commands(True) in the sublime console and then press [

0 Likes

#4

ah I got it, thanks, for some reason, I just needed to copy-paste the autobracket for [ into my own key-bindings preferences file, not sure what it was that overtook it, but that solved it. Thank you.

0 Likes