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

How do I keep a utility split from resizing when other windows open or close?

Answer

:setlocal winfixheight winfixwidth

Explanation

If you use a dedicated utility pane (logs, quick notes, REPL output), Vim's default equalization behavior can keep resizing it whenever other splits change. Setting winfixheight and winfixwidth on that one window pins its dimensions so your main editing layout can change without disturbing the utility pane. This is especially useful in workflows that frequently open transient windows.

How it works

  • :setlocal applies options only to the current window
  • winfixheight asks Vim to avoid changing this window's height during layout operations
  • winfixwidth does the same for width
  • Using both gives predictable geometry for sidebars, terminals, or scratch panes

Example

Imagine a right-side notes split that should stay 40 columns wide while you open and close file previews on the left. In the notes window, run:

:setlocal winfixheight winfixwidth

Now when new splits appear, Vim prefers resizing other windows first, preserving that notes pane shape.

Tips

  • Set these only on windows that truly need fixed dimensions
  • Remove with :setlocal nowinfixheight nowinfixwidth when you want normal resizing back
  • Pair with :vert resize {N} or :resize {N} once, then lock the window

Next

How do I reindent the whole file without adding extra jump-list entries?