On 8/16/06, Meino Christian Cramer <[EMAIL PROTECTED]> wrote:
From: Jürgen Krämer <[EMAIL PROTECTED]>
Subject: Re: gP-confusion
Date: Wed, 16 Aug 2006 14:33:08 +0200

>
> Hi,
>
> Meino Christian Cramer schrieb:
> >
> >  finally I found (nearly) what I am searching for...but...
> >
> >  I wanted a command which after doing a y$ from in the midth of a
> >  line, puts my yanked text after the end of the line and the cursor
> >  right after the put text.
> >
> >  The help of "gP" states (my im is "nocompatible"):
> >
> >  ["x]gP                     Just like "P", but leave the cursor just after 
the new
> >                         text.  {not in Vi}
> >
> >
> >  But it seems I understand the help wrongly. Example:
> >
> >    This is a very boring example of a line.
> >            x
> >
> >  (x=position of the cursor)
> >
> >  I do a y$gP and the line looks like:
> >
> >    This is a very boring example of a line.a very boring example of a line.
> >                                            x
> >
> >  The help says:
> >                   ...but leave the cursor just after the *new*
> >                         text.
>
> it did.
>
> >  What did I so wrong here ? What did I misundertstand ?
>
> You missed to go to the end of line before putting the text:
>
>   y$$gp
>
> Note the second dollar sign. "y$" alone does leave the cursor at its
> current position. The second "$" then puts the cursor on the last
> character of the line. "gp" (with *lower* case ell) appends the yanked
> text. If you had chosen a different text to put than the one the cursor
> is in front of, the result of your command would have been more
> obvious.
>
> Regards,
> Jürgen

  Hmmm....

  ...and what is the difference between

  y$$gp

  and

  y$$gP

  then. Or in other words: In what case I would prefer gP instead of
  gp ?

gp  puts after the cursor, gP puts before the cursor.

When you want to paste at the front of the line, you want
gP, like 0gP. When you want to paste at the end of the
line, you'll want to use $gp.

So your command for yanking till end of line and appending
at end of line will be:
           y$$gp
*not* y$$gP. y$$gP would insert at the wrong place, 1 character before
end of line.

Yakov

Reply via email to