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

How do I open quickfix at the bottom with a fixed height and keep cursor focus in my editing window?

Answer

:botright copen 8 | wincmd p

Explanation

Quickfix is powerful, but opening it can disrupt window layout and yank focus away from your current editing context. This command opens quickfix at the bottom, constrains it to a predictable height, and immediately returns focus to the previous window. It works well for search-heavy workflows where you want the list visible while continuing to type in the main buffer.

How it works

:botright copen 8 | wincmd p
  • :botright forces the new window to the bottom of the screen
  • copen 8 opens quickfix with height 8 lines
  • | chains another Ex command on the same line
  • wincmd p jumps back to the previously active window

This gives you persistent situational awareness: quickfix stays visible as a reference panel, but your cursor remains where real editing happens.

Example

After running a project search:

:vimgrep /TODO/j **/*.go

Open quickfix without losing editing focus:

:botright copen 8 | wincmd p

Result:

Bottom window: quickfix list (8 lines tall)
Main window: your current file remains active for editing

Tips

  • Increase height (copen 12) when triaging many matches
  • Add a mapping for this exact command if you frequently inspect quickfix while editing

Next

How do I configure :grep to use ripgrep with quickfix output and include hidden files?