Tip: #750 - Underline using dashes automatically
Created: June 18, 2004 19:58 Complexity: intermediate Author: Chris X Edwards Version: 5.7 Karma: 26/18 Imported from: Tip#750
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 map <F5> yyp<c-v>$r-
Note that you can use anything you want instead of - (= and _ spring to mind). Also, the mapping to F5 is completely arbitrary, you can use the key combination you want.
In case you want to get a line above AND below the target text, do this:
<F5>yykP