Maintain cursor position in window when typing (Using vim on Windows and/or Linux)

Solution 1:

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.

See:

:help 'scrolloff'
:help 'sidescrolloff'
:help autocmd.txt

Solution 2:

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.