m (Underline Using Dashes Automatically moved to Underline using dashes automatically: Page moved by JohnBot to improve title) |
(Clean up) |
||
Line 9: | Line 9: | ||
|rating=26/18 |
|rating=26/18 |
||
|text= |
|text= |
||
− | I have been using this trick for years but only recently figured out how to add the finishing touch. Basically this technique (best executed as a macro) will take a line of text like this: |
+ | I have been using this trick for years but only recently figured out how to add the finishing touch. Basically this technique (best executed as a macro) will take a line of text like this: |
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | I use this all the time to highlight headings, etc. |
||
⚫ | |||
− | |||
+ | <pre> |
||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
− | Of course in a constant width editor font, this looks a lot more worthwhile. I use this all the time to highlight headings, etc. |
||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
"cxe- Underline the current line with dashes |
"cxe- Underline the current line with dashes |
||
⚫ | |||
+ | </pre> |
||
⚫ | Note that you can use anything you want instead of - (= and _ spring to mind). Also, I put this under F5, but that's 100% arbitrary and the nice thing about Vim is that you can put it where you want it. And a tip for the tip is that if you use this, you can also easily get a line above AND below the target text. Just do this: |
||
− | map <F5> Yp:s/./-/g^M:let @/=""^M |
||
⚫ | |||
− | |||
− | |||
− | (Note that ^M's are really returns that you can achieve in Vim with <ctrl-V><ctrl-M>. |
||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | Hope someone can find this helpful. (P.S. typing in this form box is torture! The worst thing about Vim is how useless you feel without it!) |
||
}} |
}} |
||
== Comments == |
== Comments == |
||
− | Like you I'd been using something similar for a while but only just realised you could let --AT--/ = "" to stop everything being highlighted when hlsearch is on. As a final cleanup clear the command line with |
||
− | |||
− | map <F5> yyp:s/./-/g<RETURN>:let --AT--/ = ""<RETURN>:<RETURN> |
||
− | |||
− | '''Anonymous''' |
||
− | , June 18, 2004 23:53 |
||
− | ---- |
||
− | A more simple method: |
||
− | |||
⚫ | |||
− | |||
− | '''Anonymous''' |
||
− | , June 19, 2004 14:43 |
||
− | ---- |
||
− | The mozex plugin (http://mozex.mozdev.org/) lets you edit forms with an arbitrary text editor including, of course, vim. |
||
− | |||
− | '''Anonymous''' |
||
− | , June 20, 2004 21:29 |
||
− | ---- |
||
This is helpful, but your command doesn't give proper \t (and 'tabstop' value) |
This is helpful, but your command doesn't give proper \t (and 'tabstop' value) |
||
− | |||
− | '''Anonymous''' |
||
− | , June 20, 2004 22:04 |
||
---- |
---- |
||
− | A propos mozex: Is there for GUI-Vim an Event to react on when I click to another window, eg back to mozilla? I'd like to auto-write those buffers, it'd be kewl. |
||
− | |||
− | marco.gergele--AT--web.de |
||
− | , July 6, 2004 8:09 |
||
− | ---- |
||
− | FocusLost? |
||
− | |||
To help with tabs, :map <F5> Yp^v$r- |
To help with tabs, :map <F5> Yp^v$r- |
||
(ignores leading whitespace) |
(ignores leading whitespace) |
||
− | |||
− | '''Anonymous''' |
||
− | , November 22, 2004 9:35 |
||
---- |
---- |
||
... and to also cope with embedded tabs in the heading use |
... and to also cope with embedded tabs in the heading use |
||
:map <f5> yyp<c-v>$r- |
:map <f5> yyp<c-v>$r- |
||
− | |||
− | '''Anonymous''' |
||
− | , November 3, 2006 15:56 |
||
---- |
---- |
||
<!-- parsed by vimtips.py in 0.565241 seconds--> |
<!-- parsed by vimtips.py in 0.565241 seconds--> |
||
+ | [[Category:Automatic Text Insertion]] |
Revision as of 12:06, 30 October 2007
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
I have been using this trick for years but only recently figured out how to add the finishing touch. Basically this technique (best executed as a macro) will take a line of text like this:
A Very Important Tip!!!
and change it to two lines like this:
A Very Important Tip!!! -----------------------
I use this all the time to highlight headings, etc.
Add this to your .vimrc file:
"cxe- Underline the current line with dashes map <F5> YpVr-
Note that you can use anything you want instead of - (= and _ spring to mind). Also, I put this under F5, but that's 100% arbitrary and the nice thing about Vim is that you can put it where you want it. And a tip for the tip is that if you use this, you can also easily get a line above AND below the target text. Just do this:
<F5>YkP
Comments
This is helpful, but your command doesn't give proper \t (and 'tabstop' value)
To help with tabs, :map <F5> Yp^v$r- (ignores leading whitespace)
... and to also cope with embedded tabs in the heading use
- map <f5> yyp<c-v>$r-