When I open a new split Vim is scrolling both buffers up despite having enough space.

Here is an asciicast

This behaviour comes out-of-the box in vim -u NONE.

It is really annoying. My guess it tries to keep the cursor in the middle of the screen or something. But even if the both splits end up well above the middle line the buffers are being scrolled up.

Is there a way to turn it off? Thanks.

2 Answers 2


I found a solution which came from Vim's own help docs. It's not perfect but it is an improvement.

nnoremap <C-W>s Hmx`` \|:split<CR>`xzt``

If I understand your question correctly you are wishing that the split would automatically move the cursor location to the bottom of the screen? If thats the case then here is a slightly goofy way to handle it.

If you create a function that performs a split and then then zb on both halves then you should get the output you desire.

function! BetterSplit ()
  execute "normal zb"
  wincmd j
  execute "normal zb"
  wincmd k

command! -nargs=0 BetterSplit call BetterSplit()

Now if you call :BetterSplit you get your nice output. As an added option you can use cabbrev to modify how :split is handled and trigger your new function directly.

cabbrev split<c-r>=(getcmdtype()==':' && getcmdpos()==1 ? 'BetterSplit' : 'split')<cr>

Now :split operates like :BetterSplit. One down side is that this doesn't allow for :split {filename} but you could extend this script further and add in this support.

  • I just want text to not move. Why it is doing that in the first place? I thought there is some setting that can improve said behaviour.
    – firedev
    Apr 14, 2015 at 4:07
  • when the window is resized (or split in this case) the cursor is moved to the center of the buffer. Not sure you can do anything besides make split do something different.
    – jecxjo
    Apr 14, 2015 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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