Tuesday, March 3, 2015

Re: How to cancel [count] prefix?

Hi Tim!

On Di, 03 Mär 2015, Tim Chase wrote:

> On 2015-03-03 05:39, Alexey wrote:
> > How do you cancel the count prefix in Vim?
> >
> > Say, i've typed '42' before a motion key, but then changed my mind
> > and decided to use a different motion or a different count. How do
> > i cancel '42' if i am in Visual mode? (In Normal mode i can press
> > <Esc>, but in Visual mode this would also cancel the selection.)
> >
> > The only solution for Visual mode i've found so far is to press
> > '@_'. Is there a better way?
>
> I generally just hit <esc> and then use "gv" to re-highlight the
> previously-selected region. The "@_" is a nice trick though (files
> that away)

Another (less-hackish) way is to use Ctrl-O (:h v_CTRL-O)

> > What if i've typed a wrong count in Operator-pending mode, like
> > 'd42'?
>
> Since most of the time the command is a single letter, I find little
> overhead in the usual "hit <esc> then re-issue the command". However
> it's true that it doesn't hold for certain multi-key commands such as
> "gU" which makes re-issuing it a bit more of an annoyance.
>
> That said, I don't believe I've heard of anything that will clear
> the count without also clearing the command.

I don't know any. Is there a need for such a key? "gC" perhaps?

Best,
Christian
--
Abwesenheit muß man durch Erinnerung ergänzen. Das Gedächtnis ist
der Spiegel, in dem wir die abwesenden erblicken.
-- Joseph Joubert (Gedanken, Versuche und Maximen)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: