When horizontally splitting windows in vim, the content which is being edited will float up or down based on the position of the newly created window.

For example, when editing a C file in vim, and I want to autocomplete functions via YCM, hitting Ctrl+Space causes a new preview window to appear either at the top or bottom. The line which I am editing will float down or up, and that makes my eyes out of focus.

How can I disable such a float?

  • I don't know if this will fully solve you're problem, but you might look into :h winsaveview().
    – Tumbler41
    Jul 20, 2016 at 0:04
  • :set noequalalways and hit H before opening the new window?
    – Antony
    Jul 20, 2016 at 0:32

1 Answer 1


There is no direct feature for this.

Workarounds could be

  • keeping the preview open
  • setting cursorline and cursorcolumn (:se cuc! cul! to toggle, or [ox and ]ox if you use https://github.com/tpope/vim-unimpaired)
  • using scrolloffset smartly. This would really only achieve the desired effect if you edit near the opposite end of your window to where the preview opens, I guess, but it could be enough to significantly reduce the movement in a percentage of the cases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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