Re: Put the cursor in the middle of screen when replacing
- Robert Cussons wrote:
> Carlos Liu wrote:yes, but only temporarily. zz moves the current cursor line to the
>> On 8/2/06, Tim Chase <vim@...> wrote:
>>> > How to put cursor in the middle of screen when replacing words? I have
>>> > to see the next few lines to know replace or not, but the word always
>>> > sit in the bottom of the screen.
>>> Sounds like you're looking for the 'scrolloff' setting.
>>> :help 'scrolloff'
>>> will provide details on this. It allows you to keep a certain
>>> number of lines on the screen at the same time. If you set it to
>>> an outrageously high value, it will keep the cursor centered
>>> vertically on the screen.
>> That's exactly what I want. Thank you!
> This is more out of interest to increase my knowledge of vim, but
> wouldn't incorporting the 'zz' command from normal mode somehow achieve
> the same?
middle of the screen, then proceeds with normal editing (and, if
inserting, the cursor will usually stray to the bottom before scrolling
starts again). With a non-zero 'scrolloff' you can keep a user-defined
number of "context lines" above and below the cursor line: for instance,
with ":set scrolloff=1" Vim will always (if possible) show not only the
cursor line but also one line on each side of it; with ":set
scrolloff=99999" it will keep the cursor line centered and scroll the
text as you type.