[net.bugs.4bsd] The yank command in vi.

mmm@weitek.UUCP (Mark Thorson) (12/30/85)

In vi, I want Y to do the same thing as Dp.  Dp yanks to end of line.  I use
Dp a lot.  Instead, Y yanks the whole line.  I use yy for that.  So Y is
useless to me.  I contend it would be a more useful and more consistent
implementation of Y to yank to end of line.

Mark Thorson  (...!cae780!weitek!mmm)

PS  Why is the Sun logo rotated 45 degrees?  I hate it that way.  I can't
    imagine the original artist intended it to be that way.

kae@ihuxl.UUCP (edwards) (01/03/86)

> ...  I contend it would be a more useful and more consistent
> implementation of Y to yank to end of line.

Have you ever tried the string "y$" ?  After all since the vi
command syntax seems to be <count><command><location> that
should work!  And whadayaknow it does!  I bet "d$" and "c$" work
too but I think "D" is a lot easier.  However, "c$" comes in handy
now and then.  You too can makeup new vi commands everyday or maybe
only every other day!  Actually, maybe they're not new except to you.
Show them to your friends!  Post'em to the net!  After all, someone
might be looking for that particular "new" command.  :-)

-- 

 -K. Alan Edwards
  IX 1G-315 x1199
  (ihuxl!kae)

rwl@uvacs.UUCP (Ray Lubinsky) (01/05/86)

> > ...  I contend it would be a more useful and more consistent
> > implementation of Y to yank to end of line.
> 
> Have you ever tried the string "y$" ?  After all since the vi
> command syntax seems to be <count><command><location> that
> should work!  And whadayaknow it does!
  :
>                You too can makeup new vi commands everyday or maybe
> only every other day!  Actually, maybe they're not new except to you.
> Show them to your friends!  Post'em to the net!  After all, someone
> might be looking for that particular "new" command.  :-)

Hey, cut the guy some slack!  Of course I knew about "y$" (he probably did
too), but the original article is just complaining about lack of orthogonality
in the key definitions.  After I thought about it for a minute, I decided he's
right.  Defining "Y" to mean "yank to the end of line" does make more sense.
-- 

Ray Lubinsky		     University of Virginia, Dept. of Computer Science
			     uucp: decvax!mcnc!ncsu!uvacs!rwl

maartenj@ark.UUCP (Maarten Jan Huisjes) (01/06/86)

-- 

			Maarten Jan  Huisjes.  (maartenj@ark.UUCP)
			{seismo|decvax|philabs}!mcvax!vu44!ark!maartenj

maartenj@ark.UUCP (Maarten Jan Huisjes) (01/06/86)

>> ...  I contend it would be a more useful and more consistent
>> implementation of Y to yank to end of line.
> 
> Have you ever tried the string "y$" ?  After all since the vi
> command syntax seems to be <count><command><location> that
> should work!  And whadayaknow it does!  I bet "d$" and "c$" work
> too but I think "D" is a lot easier.  However, "c$" comes in handy
> now and then.  You too can makeup new vi commands everyday or maybe
> only every other day!  Actually, maybe they're not new except to you.
> Show them to your friends!  Post'em to the net!  After all, someone
> might be looking for that particular "new" command.  :-)


If your version of vi supports the "map" command you could even do this :
		:map Y y$
Actually you can just about map everything to anything as long as the
mapped string is a one character or if the string does not start with a 
alpha character. It is a very useful command, for instance you can map whole
C-constructions to one or two keys !!
-- 

			Maarten Jan  Huisjes.  (maartenj@ark.UUCP)
			{seismo|decvax|philabs}!mcvax!vu44!ark!maartenj

ed@mtxinu.UUCP (Ed Gould) (01/06/86)

In article <355@weitek.UUCP> mmm@weitek.UUCP (Mark Thorson) writes:
>In vi, I want Y to do the same thing as Dp.  Dp yanks to end of line.  I use
>Dp a lot.  Instead, Y yanks the whole line.  I use yy for that.  So Y is
>useless to me.

Try y$ to yank to the end of a line.

>I contend it would be a more useful and more consistent
>implementation of Y to yank to end of line.

That's a religious question, given how inconsistent vi already is.
I'd prefer D to delete the whole line; I use Y all the time.

-- 
Ed Gould                    mt Xinu, 2910 Seventh St., Berkeley, CA  94710  USA
{ucbvax,decvax}!mtxinu!ed   +1 415 644 0146

"A man of quality is not threatened by a woman of equality."

ritter@spp1.UUCP (Phillip A. Ritter) (01/07/86)

In article <82@uvacs.UUCP> rwl@uvacs.UUCP (Ray Lubinsky) writes:
>> > ...  I contend it would be a more useful and more consistent
>> > implementation of Y to yank to end of line.
>> 
>> Have you ever tried the string "y$" ?  After all since the vi
>> command syntax seems to be <count><command><location> that
>> should work!  And whadayaknow it does!
>  :

Why not just add the following line to your `.exrc' file?
   map Y y$

From now on, Y will yank to end of line.

Please don't flame on any of the following points:
   (1) I know he was complaining about the lack of orthogonality in the
       defaults,
   (2) I know that .exrc might be a Berkeleyism, and
   (3) I understand the arguments about changes to the defaults [you have to
       redo them when you move, you forget its non-standard when helping
       someone else, etc]
Other flames welcome (sorta...).

Phil Ritter
-- 
Phillip A. Ritter