Vim Tips Wiki
(Added mapping for insert mode)
mNo edit summary
Line 36: Line 36:
 
Note that you can use anything you want instead of - (= and _ spring to mind).
 
Note that you can use anything you want instead of - (= and _ spring to mind).
   
In case you want to get a line above AND below the target text, do this:
+
In case you want to get a line above AND below the target text, do this in the normal mode:
   
 
<pre>
 
<pre>

Revision as of 21:32, 11 April 2008

Tip 750 Printable Monobook Previous Next

created June 18, 2004 · complexity intermediate · author Chris X Edwards · version 5.7


This tip takes a line of text like this:

A Very Important Tip!!!

and changes it to two lines like this:

A Very Important Tip!!!
-----------------------

This is particularly useful to highlight headings.

Add this to your vimrc file:

" Underline the current line with dashes in normal mode
nn <F5> yyp<c-v>$r-

" Underline the current line with dashes in insert mode
ino <F5> <esc>yyp<c-v>$r-o<c-u>

Note that you can use anything you want instead of - (= and _ spring to mind).

In case you want to get a line above AND below the target text, do this in the normal mode:

<F5>yykP

Comments