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

How do I keep the quickfix window height from resizing when splitting?

Answer

:setlocal winfixheight

Explanation

Quickfix windows are easy to disturb when you open, close, or rebalance other splits. If the quickfix panel keeps growing and shrinking, it steals visual focus and forces constant manual resizing. Setting winfixheight locally on the quickfix window locks its height so your layout stays stable while you work through errors.

How it works

:setlocal winfixheight
  • setlocal applies the option only to the current window
  • winfixheight tells Vim to avoid changing this window's height during automatic layout adjustments
  • This is ideal for utility windows like quickfix, preview panes, and logs where predictable size matters

Use it after opening quickfix (for example, right after :copen). You can still resize manually when needed; this setting mainly prevents automatic reshaping caused by other window operations.

Example

Before
- Open quickfix at 8 lines
- Create another split or run window equalization
- Quickfix height changes unexpectedly

After
- Open quickfix, then :setlocal winfixheight
- Split/edit normally
- Quickfix keeps its configured height

Tips

  • Pair this with a command or autocmd that runs when quickfix opens
  • For utility sidebars, combine with winfixwidth to lock width too
  • If you want temporary flexibility, disable with :setlocal nowinfixheight

Next

How do I search for 'bar' that is not preceded by 'foo'?