Vim Tips Wiki
(Final clean up)
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
  +
{{TipImported
{{Tip
 
 
|id=750
 
|id=750
  +
|previous=749
|title=Underline Using Dashes Automatically
 
  +
|next=751
|created=June 18, 2004 19:58
+
|created=June 18, 2004
 
|complexity=intermediate
 
|complexity=intermediate
 
|author=Chris X Edwards
 
|author=Chris X Edwards
 
|version=5.7
 
|version=5.7
 
|rating=26/18
 
|rating=26/18
|text=
 
 
}}
 
}}
 
 
This tip takes a line of text like this:
 
This tip takes a line of text like this:
  +
A Very Important Tip!!!
 
  +
<pre>
 
A Very Important Tip!!!
  +
</pre>
  +
 
and changes it to two lines like this:
 
and changes it to two lines like this:
  +
A Very Important Tip!!!
 
  +
<pre>
-----------------------
 
 
A Very Important Tip!!!
 
-----------------------
  +
</pre>
   
 
This is particularly useful to highlight headings.
 
This is particularly useful to highlight headings.
   
Add this to your .vimrc file:
+
Add this to your vimrc file:
  +
 
<pre>
 
<pre>
" Underline the current line with dashes
+
" Underline the current line with dashes
 
map &lt;F5&gt; yyp&lt;c-v>$r-
 
map &lt;F5&gt; yyp&lt;c-v>$r-
 
</pre>
 
</pre>
   
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.
+
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:
&lt;F5&gt;yykP
 
   
  +
<pre>
== Comments ==
 
 
&lt;F5&gt;yykP
  +
</pre>
   
 
==Comments==
   
  +
----
 
[[Category:Automated Text Insertion]]
 
[[Category:Automated Text Insertion]]

Revision as of 01:28, 11 November 2007

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
map <F5> yyp<c-v>$r-

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:

<F5>yykP

Comments