Vim Tips Wiki
(Remove html character entities)
(→‎Comments: vERY POOR SITE AND MAY END UP THE SAME)
Line 54: Line 54:
   
 
==Comments==
 
==Comments==
  +
The whole set-up of your web site is confusing and not very professional. I suggest you go back to the drawing board and do it properly this time. You could have done it right the first time if more thought was applied to project. HONESTLY ITS VERY POOR.

Revision as of 16:22, 31 October 2009

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

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:

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

" Underline the current line with dashes in insert mode
inoremap <F5> <Esc>yyp<c-v>$r-A

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

In case you want to get a line above and below the heading, do this in normal mode:

<F5>yykP

Using substitute

You can use the global and substitute commands (:help :g, :help :s) to underline all headings matching a pattern. For example, the following adds a row of dashes under each line that starts with "Chapter":

:g/^Chapter/t.|s/./-/g

It works by finding each matching line, then copying it (:help :t), then substituting each character (.) in the line.

Comments

The whole set-up of your web site is confusing and not very professional. I suggest you go back to the drawing board and do it properly this time. You could have done it right the first time if more thought was applied to project. HONESTLY ITS VERY POOR.