On Thu, May 18, 2006 at 12:27:26PM +0000, Yakov Lerner wrote:
> I am using incsearch. I wanted to define 2 mappings that
> act while I am in /search pattern editing mode,
> and that take me to next/prev match
> while leaving the cursor in /pattern commandline.
> Is it possible ?
>
> Yakov
If you only use / and not ? then
:cmap <C-N> <CR>/<Up>
:cmap <C-P> <C-C>N/<Up>
should work. If you want it to work with both / and ?, you have to work
a little harder. Try this:
cmap <C-N> <C-R>=Next()<CR><Plug>Next
fun! Next()
if getcmdtype() == "/"
cmap <Plug>Next <CR>/<up>
elseif getcmdtype() == "?"
cmap <Plug>Next <CR>NN?<Up>
else
cmap <Plug>Next <Nop>
endif
return ""
endfun
The other direction is left as an exercise.
HTH --Benji Fisher