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.


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.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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