Re: Using vi



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, for
no 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"
.



Relevant Pages

  • Re: Access module does not continue past the Filter Method
    ... I added the "Stop" Command, but the program completely ignored it. ... proceeding to "Past the Filter". ... Public Sub Apply_Tech_Filter ... Debug.Print "Past the Filter" ...
    (microsoft.public.access.modulesdaovba)
  • Re: Printer Sharing
    ... Here is last command you wanted. ... _f Pre-processing FILTER NAME ... __TRN STAGE 2 TRANSLATE TABLES ... t1 Path Name of First Alternate Stage 2 Translate ...
    (comp.unix.aix)
  • Re: Justify Upgrade from X-10 to Z-Wave?
    ... I hooked up the Monterey PLSA behind an AF120 15A filter and got some ... repeated half of the command. ... If it's higher *with* the XTB then the two signals are combining. ...
    (comp.home.automation)
  • Re: HPL Pros and Cons
    ... Here are the command line options: ... create map ... describe format ... describe filter ...
    (comp.databases.informix)
  • Re: Interrpreting modifier codes in /etc/inputrc ??
    ... simply produces ";5C" at the cursor on my command line and Control ... Thanks for introducing me to the showkey command. ... on the command line for it to the sequences to operate on. ... # for non RH/Debian xterm, ...
    (Fedora)