Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I surround two words with <code> tag in vim, such that I can repeat the operation with a dot operator?

Tags:

vim

surround

I'm working with the vim-surround plugin and this HTML (where the * is my cursor):

<li class="sample" style="border-color: #005462;">*#005462</li>

I'd like to surround the #005462 with <code> so it looks like this, <code>#005462</code>. I can do this with visual mode but would like to do something I can repeat with the dot operator. Any advice?

like image 281
Mark B Avatar asked Apr 26 '11 17:04

Mark B


People also ask

What is surround vim?

Surround. vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, change and add such surroundings in pairs. While it works under Vim 6, much of the functionality requires Vim 7. Examples follow.

How do I add a bracket in vim?

Explanation. If you want to put the word under the cursor in to brackets this is viwc()<Esc>P . viw will v isually select all charactrs i n a w ord. c() will c change the selection and by dropping you into insert mode, where you type the characters ( ) .


1 Answers

You want repeat.vim which adds . support to several other plugins, including surround.

like image 142
Austin Taylor Avatar answered Oct 22 '22 03:10

Austin Taylor