Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 1998 09:32:46 -0800 (PST)
From:      David Wolfskill <dhw@whistle.com>
To:        mlduke@concentric.net, newbies@FreeBSD.ORG
Subject:   Re: vi
Message-ID:  <199812161732.JAA14342@pau-amma.whistle.com>
In-Reply-To: <Pine.BSF.4.01.9812151652320.481-100000@concentric.net>

next in thread | previous in thread | raw e-mail | index | archive | help
>Date: Tue, 15 Dec 1998 19:24:06 -0700 (MST)
>From: ML Duke <mlduke@concentric.net>

>...

>Enter vi. Using the "de" command=delete to end of word, the garbage
>preceeding the good text vanished very quickly, then "dd" quickly
>eliminated the garbage following the good text.

If you start doing more things with vi, I expect you will be positively
impressed with some of the things it can do.

Some of them are even useful :-) [as opposed, for example, to using vi
macros to generate & solve mazes in the edit buffer -- which I heard
that someone did...].

One example of a general approach that, combined with the tendency in
UNIX systems to have fairly special-purpose, small(ish) programs that do
a small number of things, mostly by reading "standard input" and writing
"standard output" (i.e., "filters"):

	The cursor-movement commands may be used, in combination with "!",
	to select (part of) the edit buffer as "standard input" for an
	arbitrary pipeline of commands; the "standard output" of that
	pipeline will replace the selected part of the edit buffer.

	Thus, to sort a file that you're editing:

		1G!Gsort

	does the trick.

	But if you just want to sort a handful of (non-blank) lines, and
	you can arrange for an empty line above and below the lines in
	question, position the cursor at the first line and try:

		!}sort

	to sort just those lines.


	Of course, these could be rather more elaborate....


david
-- 
David Wolfskill		UNIX System Administrator
dhw@whistle.com		voice: (650) 577-7158	pager: (650) 371-4621

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-newbies" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812161732.JAA14342>