vimtricks.wiki Concise Vim tricks, one at a time.

How do I prevent a split window from being resized by Vim?

Answer

:set winfixheight

Explanation

When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim from resizing that window when other windows are opened, closed, or equalized.

How it works

  • :set winfixheight — fixes the current window's height
  • :set winfixwidth — fixes the current window's width
  • The window won't change size when you use <C-w>= or open/close other splits
  • You can still manually resize with <C-w>+, <C-w>-, etc.

Example

" Create a 10-line terminal at the bottom, keep it fixed
:botright 10split | terminal
:set winfixheight

" Now opening/closing other windows won't change this terminal's height
+---------------------------+
| Main editing window       |
| (resizes normally)        |
+---------------------------+
| Terminal (10 lines fixed) |  ← winfixheight
+---------------------------+

Tips

  • Combine both: :set winfixheight winfixwidth for a completely fixed window
  • Use :resize 10 | set winfixheight to set an exact size then lock it
  • Useful for reference windows, log tails, or REPL terminals
  • Reset with :set nowinfixheight

Next

How do I return to normal mode from absolutely any mode in Vim?