When I do a search with vim or gvim, the resulting positioning of the cursor within the window is somewhat random, all too frequently landing on the last (or first) line in the window. Search highlighting helps, but it's still cumbersome to have to look all around on the screen to find the cursor ... and a bit ironic, that after vim locates the next result in some megabytes-long log file, I have to use the ol' neocortex to isolate it from the last 4K or so.
I can manually get the effect I want by hitting 'zz' after every search, but would prefer to doctor up my _vimrc to make this happen automatically.
From stackoverflow
-
Will this work for you ?
:nmap n nzz :nmap p pzz
JustJeff : figured it was probably about that easy. that's awesome. thanks! -
I use this trick with other commands too:
nnoremap n nzz nnoremap N Nzz nnoremap <C-o> <C-o>zz nnoremap <C-i> <C-i>zz
0 comments:
Post a Comment