On Tue, Nov 14, 2006 at 12:03:45PM +0200, Yakov Lerner wrote:
> In the script below, where # and n are remapped,
> n goes the wrong direction after #. To see:
> vim -u NONE bad.bim
> :so %
> gg/ba<cr>nnn#n
> -- the last n goes forward. we expect it to move backward.
>
> But when script is rewritten to the form #2, then n after # works
> correcty. Plain moving the 'silent! exe "norm!"...' out of the
> function changes the behavior.
>
> Yakov
I think this is a side effect of the fact that functions do not
change the search pattern. I guess the search direction is stored along
with the pattern. Either
:help :endfun
and scroll up one paragraph or
:help :fun
/search
I think re-mapping "n" does not matter: mapping "#" to call a function
will not change the search direction.
I am not sure what you are trying to do, but perhaps you can store
the search direction in your own (script-local) variable and check that
with your re-mapped "n" command.
HTH --Benji Fisher