Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Are there any vim plugins to enclose selected text in quotes or parentheses? For instance, if I were to select a block of text in visual mode, and pressed a key combination or do a command, that text would be enclosed in parentheses/quotes.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

I use surround.vim for this type of thing. For example, visually select an area and type "\s(" and the visually selected text will be enclosed in parenthesis. Change the ( to a double quote and it will use quotes instead.

Unfortunately surround has some slightly odd behaviors, and the help file is sometimes a little unclear, but I find it tolerable.

share|improve this answer
    
Thanks! That was just what I needed! –  Wuffers Dec 19 '10 at 3:13
add comment

I've been maintaining a plugin that offers this kind of feature: lh-map-tools. You'll have to tune it though to specify bracket-like pairs you want to support.

share|improve this answer
add comment

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.