Formatting Posts With VI
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 09/12/04
- Next message: Ezra Vandervort: "Re: Formatting Posts With VI"
- Previous message: Walter Mautner: "Re: Knoppix newbie question"
- Next in thread: Ezra Vandervort: "Re: Formatting Posts With VI"
- Reply: Ezra Vandervort: "Re: Formatting Posts With VI"
- Reply: Floyd L. Davidson: "Re: Formatting Posts With VI"
- Reply: Peter Jensen: "Re: Formatting Posts With VI"
- Reply: Alan Connor: "Re: Formatting Posts With VI"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 12 Sep 2004 00:41:13 GMT
I just stumbled across this little 'trick' and thought it was worth
passing on.
What the following allows you to do is to simply hit "v" while you are in
command mode, and it will re-format the paragraph your cursor is currently
on, to a maximum line length of 75 characters, splitting and filling as
it works. (The -c option tells it to leave an indented first line alone.)
(You can change the line length; see man fmt.)
In your ~/.exrc, type the following:
map v {0!}fmt -c^V^V^V^M
(For the newbies: "^V" means hold down Ctrl and press v)
What you will see in vi is:
map v {0!}fmt -c^V^M
With just cat or less you'll see:
map v {0!}fmt -c
---------------------------------------
This is *really* handy if you are writing anything and have to go back
and add or delete words in a sentence near the beginning of a long par-
agraph. Do the editing, go back to command mode, and hit "v" and 99 times
times out of a 100 the paragraph is okay again. If it isn't perfect,
only a few keystrokes will fix the problem, compared to the tedium of
doing the whole thing manually.
AC
- Next message: Ezra Vandervort: "Re: Formatting Posts With VI"
- Previous message: Walter Mautner: "Re: Knoppix newbie question"
- Next in thread: Ezra Vandervort: "Re: Formatting Posts With VI"
- Reply: Ezra Vandervort: "Re: Formatting Posts With VI"
- Reply: Floyd L. Davidson: "Re: Formatting Posts With VI"
- Reply: Peter Jensen: "Re: Formatting Posts With VI"
- Reply: Alan Connor: "Re: Formatting Posts With VI"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|