On 12/7/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:
On 12/6/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

> I think it is doable, but it's not my province really. Some other Vim
> old-timers are much more versed than I in the creation of that kind of
> "self-undoing" mappings.

It can probably be simplified by mapping <CR> in command mode and
check if getcmdtype() is '/' or '?' and, if so, call :match as
appropriate.

Hm, you of course need to know how you got /into/ search mode, so that
you only do this at the appropriate times.  Setting a variable and
checking for it would work, but you have to make sure to unset it if
the command line is abandoned as well.  We need
CmdLineEnter/CmdLineLeave and v:cmdexecuted or some such, so that we
can tell if the line was executed or not.  Or perhaps even better:
CmdLineEnter/CmdLineLeave/CmdLineExecutePre/CmdLineExecutePost.  With
the *Pre autocmd one can perhaps change the command line in some way
before executing it.  With *Post one can do stuff after it, like
:matching.  *Leave would be called when it is abandoned, although
perhaps the name suggests other cases as well?

Anyway, good night.

 nikolai

Reply via email to