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
:botrightforces the new window to the bottom of the screencopen 8opens quickfix with height 8 lines|chains another Ex command on the same linewincmd pjumps 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