Vim Tips Wiki
Advertisement

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created January 5, 2010 · complexity basic · author Chris Bedford · version 7.0

You will like this if you manually edit a lot of HTML. Suppose you have some lines in your file like this:

here is a random website >

http://blog.buildlackey.com
The Build Lackey Blog

What you would do is go down to the line that references the URL, position your cursor anywhere on that line and press F7. The content of your file will be converted to:

here is a random website >

<a href="http://blog.buildlackey.com">The Build Lackey Blog</a>

The key mapping you need to put into your .vimrc is:

" remap F7 to "create an <a href='url'>content</a> where url sits below content"
map <F7> <Esc>0i<a href="<Esc>A"><Esc>JxA</a>

Comments

Advertisement