Friday, February 4, 2011

Re: How can I position the "find next" result at a given line on the screen?

On 02/04/2011 04:38 AM, Ben Schmidt wrote:
> On 4/02/11 9:25 PM, Rostyslaw Lewyckyj wrote:
>> I want the result of a "find next" command to be displayed on a chosen line of my
>> screen,
>> e.g. at the top, or the middle, or line n; rather than on the bottom line?
>
> Maybe something like
>
> :noremap n nzz
>
> See
>
> :help scroll-cursor
>
> for some commands to move the cursor line around the screen.

If you're willing to have it be only the middle (not top/bottom)
of the screen and have the cursor in the middle (almost) *all*
the time instead of just when searching, you can

:set so=9999

which you can read about at

:help 'scrolloff'

Compromisingly, you can throw together a pair of mappings to
toggle between them:

:nnoremap <f4> :set so=9999<cr>
:nnoremap <f5> :set so=0<cr>

or even a toggle (as long as you don't mess with it otherwise):

:nnoremap <f4> :let &so=9999-&so<cr>

Hope this helps,

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: