0

This question already has an answer here:

For example if I have a line at the beginning of the screen and in the opened file there are other lines above it so the screen is not at the beginning of the file (it is scrolled down), if I go to that line and use a command I should see that line in the middle of the screen or as close as possible to the middle of the screen.

marked as duplicate by muru May 3 '16 at 8:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Is zz not what you're looking for?

0

In the page to which I offered a link in the old answer below I just had to look harder to find the zz command which does exactly the same thing.


Old answer:

I ended up using a solution inspired from this page by putting these lines in my .vimrc:

" Use <F5> to scroll the current line to the middle of the screen
inoremap <F5> <Esc>:set so=999<CR>:set so=0<CR>i
nnoremap <F5> :set so=999<CR>:set so=0<CR>

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