🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3254

Re: vi vs. emacs

#3254
From: Chris Torek
Date: Mon, 08 Aug 1988 08:20
41 lines
2503 bytes
>>In article <12767@mimsy.UUCP> I asked about a certain vi reference:
>>>Does it document the `_' command?

>In article <678@buengc.BU.EDU>, bph@buengc (Blair P. Houghton) answers:
>>I just looked for it.  '_' is identical to '^', and the guide lists
>>the latter.  I don't know how you can say it's line-oriented, though.

In article <3721@omepd> merlyn@intelob (Randal L. Schwartz @ Stonehenge)
notes:
>Not quite.  Using the '_' as a target of a command is like doubling
>the letter, hence it is redundant, and as such, undocumented.

Exactly (which was why I asked about it :-) ).  Apparently it is a
historical artifact.  Originally, one had to type `d_', `c_', y_',
etc., to effect a line-oriented delete, change, or yank of the current
line.  Mark Horton decided that `stuttering'---`dd', `yy'---was much
simpler.  (He was right.)  Nonetheless, the old command persisted,
and still does; it even has a somewhat reasonable use (see below).

>For example, '5d_' is like '5dd', not '5d^'.  (I don't think the last
>one works, but haven't invoked vi for more than 5 minutes in the last
>two weeks, so I don't remember.)

5^ and ^ are the same: both mean `go to the first nonblank character.'
`_' is `go to the n'th line with this line being ``1''.'  (Try `3_',
e.g.)  Going to a line implies moving to its first nonblank character.
For line-oriented operations, the character position within a line is
irrelevant, of course.

The one place I find the _ command useful is in feeding a particular
range of lines to a filter.  To filter three lines through `fmt', you
can either type `!2jfmt' or `!3_fmt'.  The former requires some mental
arithmetic.  (Okay, so it is hardly onerous :-) .)

Other less-well known vi commands include: `|' (acts like 0); `&'
(repeats the last substitute command, on this line only); ^N and ^P
(same as j and k); ^R (redraw, removing `@' signs on terminals without
line insert and delete; `set redraw' implies automatic ^R).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris
Technical Details
Message-ID: <12895@mimsy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!uwvax!oddjob!mimsy!chris
References: <16697@brl-adm.ARPA> <517@uva.UUCP> <661@buengc.BU.EDU> <3721@omepd>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!uwvax!oddjob!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.editors
Subject: Re: vi vs. emacs
Message-ID: <12895@mimsy.UUCP>
Date: 8 Aug 88 08:20:46 GMT
References: <16697@brl-adm.ARPA> <517@uva.UUCP> <661@buengc.BU.EDU> <3721@omepd>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 41