# how to enclose selection in {} using vim-latex keyboard shortcuts

Is there an easy way of wrapping a selected text in {} with a shortcut in the same way you can turn a text into italics by typing it while selecting a piece of text.

I tried { but and that works but formatting the {}'s as for text not commands

e.g to transform "Computational Skills Learned:"

what happens is:

\left\{ Computational Skills Learned: \right\}

This is not what I want, I want

{Computational Skills Learned:}

-
Use only \{ and \}, not \left\{ and \right\}. Are you referring to defining a shortcut in vim-latex that would embrace your selection with { and }? –  Werner Jan 18 '12 at 21:15
I am not typing that. That happens when I type '{ Yes, I want to know if there is already a shortcut that does that. As 'it does for turning a text into italics –  pedrosaurio Jan 18 '12 at 21:18
not vim-latex, but I use surround.vim plugin so I can, for example, visual-select word(s) and s} to enclose it in curvy brackets. –  morbusg Jan 19 '12 at 8:44

As morbusg mentioned, the surround plugin is the way to go.

You select the text eg. using visual mode, then you press S and the closing brace }. You can use any character with a matching partner: ], >, ), etc. If you use the left part of the pair, it additionally surrounds the selected text with a space. Example:

Computational Skills Learned:


Assuming the cursor is on the “C” in “Computational”, then you press vf:S} and you get this result:

{Computational Skills Learned:}


If you press vf:S[ the result is:

[ Computational Skills Learned: ]


Note: In older versions the small s was used, but it has been changed in favour of the capital S.

-