How to paste while keep the cursor at the same place?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to paste while keep the cursor at the same place?

Peng Yu
Hi,

Suppose I use p to paste something, the cursor always goes to the end
of the pasted text. Is there any other key to paste will keep the
cursor before the pasted text?

Thanks,
Peng
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

Gary Johnson
On 2007-03-13, Peng Yu <[hidden email]> wrote:
> Hi,
>
> Suppose I use p to paste something, the cursor always goes to the end
> of the pasted text. Is there any other key to paste will keep the
> cursor before the pasted text?

See

    :help `[

You could either type `[ after the p to move the cursor, or you
could remap p like this

    :noremap p p`[

to have it behave that way all the time.

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Mobile Broadband Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

Raphael Bauduin
On 3/14/07, Gary Johnson <[hidden email]> wrote:

> On 2007-03-13, Peng Yu <[hidden email]> wrote:
> > Hi,
> >
> > Suppose I use p to paste something, the cursor always goes to the end
> > of the pasted text. Is there any other key to paste will keep the
> > cursor before the pasted text?
>
> See
>
>     :help `[


Is it possible to jump to a mark at the exact same position in the
line as when the mark was set? When I jump to a mark I always get back
to the first character of the line.

Even '< described as "To the first character of the last selected
Visual area in the current buffer" puts me at the start of the line.

Thanks

Raph


>
> You could either type `[ after the p to move the cursor, or you
> could remap p like this
>
>     :noremap p p`[
>
> to have it behave that way all the time.
>
> HTH,
> Gary
>
> --
> Gary Johnson                 | Agilent Technologies
> [hidden email]     | Mobile Broadband Division
>                              | Spokane, Washington, USA
>


--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

Albie Janse van Rensburg
Raphael Bauduin wrote:
> Is it possible to jump to a mark at the exact same position in the
> line as when the mark was set? When I jump to a mark I always get back
> to the first character of the line.
You are using ' instead of  `

On my keyboard, ` is on the same key as ~.  ` is used to jump to a mark
characterwise, whereas ' does so line-wise.

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | <http://counter.li.org>
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

A.J.Mechelynck
In reply to this post by Raphael Bauduin
Raphael Bauduin wrote:

> On 3/14/07, Gary Johnson <[hidden email]> wrote:
>> On 2007-03-13, Peng Yu <[hidden email]> wrote:
>> > Hi,
>> >
>> > Suppose I use p to paste something, the cursor always goes to the end
>> > of the pasted text. Is there any other key to paste will keep the
>> > cursor before the pasted text?
>>
>> See
>>
>>     :help `[
>
>
> Is it possible to jump to a mark at the exact same position in the
> line as when the mark was set? When I jump to a mark I always get back
> to the first character of the line.

Let's say you have set the x mark using the mx command. To go back to the
exact same cursor location, use `x (where ` is a backtick, i.e. something more
or less like a grave accent with no letter under it: 0x60), not an apostrophe.
Using 'x (with an apostrophe, 0x27) would bring you back to the first nonblank
on the same line instead. `x (with backtick) is a characterwise motion, 'x
(with apostrophe) is linewise.

>
> Even '< described as "To the first character of the last selected
> Visual area in the current buffer" puts me at the start of the line.
>
> Thanks
>
> Raph

Here too, `< (with backtick) goes characterwise to the start of the (latest)
visual area while '< (with apostrophe) goes linewise to the first nonblank in
the same line.

See ":help mark-motions".


Best regards,
Tony.
--
In a world without walls and borders, who needs windows and gates?
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

A.J.Mechelynck
In reply to this post by Albie Janse van Rensburg
Albie Janse van Rensburg wrote:
> Raphael Bauduin wrote:
>> Is it possible to jump to a mark at the exact same position in the
>> line as when the mark was set? When I jump to a mark I always get back
>> to the first character of the line.
> You are using ' instead of  `
>
> On my keyboard, ` is on the same key as ~.  ` is used to jump to a mark
> characterwise, whereas ' does so line-wise.
>

On mine (which is an AZERTY fr-BE layout) the apostrophe is lowercase 4 while
the backtick is AltGr+µ (i.e. the Greek letter mu with AltGr modifier)
followed by space. (The same key, when followed by one of the letters aeinouwy
instead of a space, would add a grave accent to the letter.)

Best regards,
Tony.
--
I gave up Smoking, Drinking and Sex.  It was the most *horrifying* 20
minutes of my life!
Reply | Threaded
Open this post in threaded view
|

Re: How to paste while keep the cursor at the same place?

Raphael Bauduin
On 3/14/07, A.J.Mechelynck <[hidden email]> wrote:

> Albie Janse van Rensburg wrote:
> > Raphael Bauduin wrote:
> >> Is it possible to jump to a mark at the exact same position in the
> >> line as when the mark was set? When I jump to a mark I always get back
> >> to the first character of the line.
> > You are using ' instead of  `
> >
> > On my keyboard, ` is on the same key as ~.  ` is used to jump to a mark
> > characterwise, whereas ' does so line-wise.
> >
>
> On mine (which is an AZERTY fr-BE layout) the apostrophe is lowercase 4 while
> the backtick is AltGr+µ (i.e. the Greek letter mu with AltGr modifier)
> followed by space. (The same key, when followed by one of the letters aeinouwy
> instead of a space, would add a grave accent to the letter.)
>

Thanks albie and tony.

I'm also using a fr-BE, so I guess I'd better set an alternate mapping
to make it easily accessible :-)

Raph





> Best regards,
> Tony.
> --
> I gave up Smoking, Drinking and Sex.  It was the most *horrifying* 20
> minutes of my life!
>


--
Web database: http://www.myowndb.com
Free Software Developers Meeting: http://www.fosdem.org