Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When typing text I don't like the way the cursor slowly descends towards the bottom of the screen. Instead I would prefer if the cursor stayed in the same place and the text above the cursor moved up. I know about the 'scrolloff' option but I don't like it as it messes up H, L, and M commands and the 'zz' command is too much hassle.

Anyone know how to achieve this behaviour in vim?

share|improve this question
Welcome iorrus to SuperUser Please read the FAQs before posting questions. Please edit your question to include your operating system, and the program your typing into. – wizlog Nov 21 '11 at 17:52
@wizlog: – Ignacio Vazquez-Abrams Nov 21 '11 at 17:56
and the operating system on which its running? – wizlog Nov 21 '11 at 17:58
Doesn't matter in this case. vim performs the same on almost all of them, with the exception of a few keystrokes which aren't needed here. There is plenty of information to give an answer. – Ignacio Vazquez-Abrams Nov 21 '11 at 17:59
up vote 1 down vote accepted

You can set the 'scrolloff' option to a high number to keep the cursor in the middle of the display:

:set scrolloff=9999

To do this only in insert mode you will need to use autocmd:

:autocmd InsertEnter * :set scrolloff=9999
:autocmd InsertLeave * :set scrolloff=0

If you have line wrapping turned off, you can do the same with the 'sidescrolloff' option.

Place the command(s) in your ~/.vimrc (~/_vimrc for Windows) to make them permanent.


:help 'scrolloff'
:help 'sidescrolloff'
:help autocmd.txt
share|improve this answer

As a cheap and cheesy way of doing it, you can use

:imap <CR> <ESC>zzo

to perform zz every time you press Enter in Insert mode.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.