Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:}

share|improve this question
    
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
1  
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

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.