Mohammed Chelouti wrote:
> I have written a plugin[1] for Vim that enables relative line numbers for
> pending operations. Unfortunately it's kinda messy to get to 'know' when an
> operation is pending and when it is executed. You have to remap every
> operator-command to call your specific plugin function (something like:
> nnoremap d :call MyFunc()<CR>d). Of course this leads to the problem that you
> cannot use more than one plugin that needs to know when you are in operation-
> pending mode. Additionally you somehow need to remap operations that come
> from
> other plugins.
>
> A much more elegant solution would be to have an event to be called when an
> operation is pending. I've looked at the Vim code and added the following
> three autocommands:
> - OperationPending: is executed when an operation is called which needs a
> motion.
> - OperationExecuted: is executed after the pending operation was executed
> (i.e. a motion or a second keystroke like yy, dd etc. is passed).
> - OperationCleared: is executed after every command that doesn't enter
> operation-pending-mode. (executed after OperationExecuted)
>
> I hope you see the reasoning behind my request and add my patch to Vim.
>
> I haven't found any hint about your preferred patch format, so I just
> attached
> the 'hg diff' output.
The problem with autocommands is that they can do lots of things that
the code where they are triggered from does not expect. It's not
unusual for Vim to crash. Try changing to another buffer, moving the
cursor, closing the window, renaming the buffer, etc. It is very
difficult to handle every single one of these. We still find problems
with existing autocommands.
Perhaps there is another way to do what you want?
--
The Characters and incidents portrayed and the names used are fictitious and
any similarity to the names, characters, or history of any person is entirely
accidental and unintentional.
Signed RICHARD M. NIXON
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 ///
--
You received this message from the "vim_dev" 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