Wednesday, November 19, 2014

Re: history for dot operator

Le mercredi 19 novembre 2014 13:22:06 UTC+1, Bram Moolenaar a écrit :
> > On Tuesday, 18 November 2014 14:20:56 UTC+2, Efraim Yawitz wrote:
> > > On Fri, Nov 14, 2014 at 5:10 PM, Ben Fritz <fritzo...@gmail.com> wrote:
> > > On Friday, November 14, 2014 5:44:45 AM UTC-6, Enno wrote:
> > >
> > > > Is there, perhaps via a Plugin, a way to recover the second last text editing operation in normal mode ? The dot '.' operator keeps only the last operation.
> > >
> > >
> > >
> > > Nope. This would not be possible, unless every single key is
> > > remapped in every single mode, or if somehow macros were being
> > > recorded constantly.
> > >
> > >
> > > Actually, maybe he should just record continuously, say type qz and
> > > work for a while and then type q and spit out the z reg to somewhere
> > > and take what he likes from it.  Doesn't sound like it would take a
> > > lot of resources.
> >
> > or maybe a plugin that stores an array of 5-10 "last used" operations
> > and updates this FILO list each time one exists insert mode. One could
> > access these edit operations with, say, `N<leader>.` where `N` is the
> > index of the operation.
>
> Plugins having to install a lot of maps to be able to know what was
> typed before the key that triggers an action is clumsy.
>
> How about Vim keeping a list of the last N typed keys?
> Suppose there is a function keyhistory(1), where the argument is how far
> back you look.
>
> I wonder how that would be used in a plugin.
>
> --
> ARTHUR: No, hang on! Just answer the five questions ...
> GALAHAD: Three questions ...
> ARTHUR: Three questions ... And we shall watch ... and pray.
> "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
>
> /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

For the implementation of the dot operator VIM keeps track where an editing operation starts and ends in the stream of characters the user types.

This information together with keyhistory(N) allows to build a plugin that keeps a history of the last editing operations.

--
--
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: