Mohsin wrote:
Mechelynck,
It has to be done with one mapping, the reason being *simultaneous*
display, since
sometimes the same word is with wrong case, should be immediately visible
without having to make a mental switch to find it.
I will try using with the syntax/highlight mappings.
thanks,
mohsin.
Well, I won't give you an answer, because I'm too liable to stumble while
writing it, but here is how it can be done:
- Make a permanent mapping for / and ?. Each of them should, as part of the
{rhs}, issue a cmap for <CR> (see below), and map the start of the search
command, until but not including the start of the search pattern.
- The cmap should not only finalize the search command but also issue :match
and :2match with the variable part represented by <C-R>/ (Ctrl-R slash), and
finally it should also unmap itself (and the next mapping) so the next use of
<Enter> (or <Esc>) in command mode should not invoke these special cmaps.
- If you want completeness, the maps for / and ? should also create a
temporary cmap for <Esc> to cancel the search, and also unmap itself and the
cmap for <CR>.
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.
Best regards,
Tony.