Re: Using vi
- From: Bill Campbell <bill@xxxxxxxxxxxxx>
- Date: Thu, 1 Jun 2006 08:42:18 -0700
On Thu, Jun 01, 2006, Nachman Yaakov Ziskind wrote:
... I've started using vi rather than wp to edit my email messages, for
no particularly good reason. One thing bothers me: a lot of people write
long ( > 80 characters) lines. One problem is that mutt truncates these
lines when they get too long (5 or 6 lines, I think); the other is that
when I reply, the > gets added only once per line, leaving me with stuff
like this:
... I've started using vi rater than wp to edit my email messages, forno good reason. One thing bothers me: a lot of people write long ( > 2
80 characters) lines. One problem is that mutt truncates these lines
when the get too long (5 or 6 lines, I think); the other is that when
etc. b/c vi thinks it's one long line. Then I find myself inserting line
breaks and extra >'s for each line on the screen. Tedious, but worth it.
Is there an easier way?
Add this to your $HOME/.exrc or $HOME/.vimrc file and the F5 key
will reformat the current paragraph:
map <F5> {!}/usr/bin/fmt
The ``{'' character moves the cursor to the beginning of the paragraph.
The ``!}'' filters the text to the end of the paragraph through the
following command -- ``!'' is filter, and ``}'' cursor move to end of
paragraph.
Actually it's a bit more difficult when dealing with quoted text, as it's
necessary to write a script that removes the leading quote character(s),
passes the output through the fmt command, then reinserts the quote
characters at the beginning of each line. Furthermore the ``{'' and ``}''
commands don't work on quoted text since the quote characters hide the
paragraphs so one must manually mark the beginning of the paragraph, move
to the end, then execute the script to filter that range.
I have my own fmt command which has a ``-q'' option to handle quoted text
which may be executed as ``myfmt -q''.
Position the cursor on the first line of the block of text to filter.
Press ``ma'' (Mark a) which marks that location as ``a'' (you can have 26
marks, a-z). Position the cursor at the end of the block you want to
filter, and press ``!'amyfmt -q<ENTER>''. The ``!'' character tells vi to
filter. The sinqlequote a tells it to filter from the current cursor
location to the mark a. The rest of the line is the command to filter it
through.
Another useful trick with ``vi'' is to type a command on a line, place the
cursor in the line, and press ``!!sh<ENTER>'' which replaces the line with
the output of the command. The following is the output of the ``uptime''
command on this machine using this:
8:42am up 708 days 1:45, 6 users, load average: 0.04, 0.04, 0.06
Bill
--
INTERNET: bill@xxxxxxxxxxxxx Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
Anyone who cannot cope with mathematics is not fully human. At best he
is a tolerable subhuman who has learned to wear shoes, bathe and not
make messes in the house.
-- Lazarus Long, "Time Enough for Love"
.
- Follow-Ups:
- Re: Using vi
- From: Sven Mascheck
- Re: Using vi
- References:
- Using vi
- From: Nachman Yaakov Ziskind
- Using vi
- Prev by Date: 5.0.5 Licensing Question
- Next by Date: Re: Using vi
- Previous by thread: Using vi
- Next by thread: Re: Using vi
- Index(es):
Relevant Pages
|