Re: Normal mode: how to get previously entered characters

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

Re: Normal mode: how to get previously entered characters

Kurt Smith

> In normal mode, I would like to nmap "y" to "yy" to save keystrokes.
> However, this causes problems if I want to yank multiple lines (for
> example: "5y").

Try the following:

:nnoremap y Y
:nnoremap Y y

The last is optional, but allows you to use Y[motion] which is often
helpful.

> So is there a way to retrieve previously entered characters? Is there
> some vim buffer/register I can access?

Not sure about this, anyone else?

Kurt

On Jul 23, 10:00 pm, gmguyx <[hidden email]> wrote:

> In normal mode, I would like to nmap "y" to "yy" to save keystrokes.
> However, this causes problems if I want to yank multiple lines (for
> example: "5y").
>
> So I would like to use the <expr> nmap feature to write a vim script
> which only replaces "y" with "yy" if there is no optional [count] in
> front of the "y".
>
> So is there a way to retrieve previously entered characters? Is there
> some vim buffer/register I can access?


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Normal mode: how to get previously entered characters

gmguyx

Thanks for the reply Kurt. I never knew that Y was a synonym for yy. I
guess I need to RTFM more. BTW, I made a mistake in my question. I
should have put "5y[motion]" and not mentioned about yanking multiple
lines because it already worked fine for that (that's what I mapped it
for). I have to be more careful with my wording in the future. Thanks
again Kurt.

On Jul 24, 9:40 am, ksmith <[hidden email]> wrote:

> > In normal mode, I would like to nmap "y" to "yy" to save keystrokes.
> > However, this causes problems if I want to yank multiple lines (for
> > example: "5y").
>
> Try the following:
>
> :nnoremap y Y
> :nnoremap Y y
>
> The last is optional, but allows you to use Y[motion] which is often
> helpful.
>
> > So is there a way to retrieve previously entered characters? Is there
> > some vim buffer/register I can access?
>
> Not sure about this, anyone else?
>
> Kurt
>


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---