On Thu, 18 May 2006, Eric Arnold wrote:
On 5/18/06, Eric Arnold <[EMAIL PROTECTED]> wrote:
I think this does what you want. You only need to use "/", though,
since you can now go up and down while in "/" :
cmap <silent> <C-X> <c-c>N:redraw<CR>/<c-p>
cmap <silent> <C-Z> <c-c>n:redraw<CR>/<c-p>
Rats. This works only if you set the @/ variable first by hitting
return normally, which will highlight the pattern, then subsequence ^X
or ^Y will move to the right pattern.
Benji's simple example has the same problem if you start with <c-p>
These come close, but the first time you use them, they do something
slightly different than subsequent times. ^R go up *2* matches, and
^S just goes to what looks like the current match (i.e. it doesn't
appear to move). It's all a problem of where the cursor actually is
v.s. where the highlighting is for incsearch.
cmap <silent> <c-r> <cr>NN:redraw<CR>/<c-p>
cmap <silent> <c-s> <cr>:redraw<CR>/<c-p>
I have
set incsearch hlsearch
and so I use this:
cmap <C-n> <CR>:noh<CR>/<Up>
cmap <C-p> <CR>:noh<CR>?<Up>
The only (unavoidable) downside to this is that it expects the cursor to
be at the start of the searched item after the first <CR>. However,
there's no way to be sure of that.
Hence, any use of "n" and "N" (Normal mode) in the mappings will throw
the search off by one, two, etc.
I also have to be careful not to hit <C-n> or <C-p> while I'm typing an
:Ex command.
HTH :)
--
Gerald