How do I preview quickfix entries without leaving the quickfix window?
Answer
<C-w>z or :pclose
Explanation
The preview window shows file contents temporarily without switching your editing context. In the quickfix window, you can preview entries to inspect matches before jumping to them, keeping your current position intact.
How it works
:pedit {file}— open a file in the preview window:psearch {pattern}— search and show result in preview window<CR>in quickfix — jumps to the entry (leaves quickfix)<C-w>}— preview the tag under cursor<C-w>zor:pclose— close the preview window
Example
" After :vimgrep, open quickfix
:copen
" Navigate entries and preview
:cc 3 " jump to entry 3
:pedit +42 src/main.py " preview line 42
+---------------------------+
| Preview: src/main.py:42 | ← preview window
| function handle_request() |
+---------------------------+
| src/main.py|42| match | ← quickfix window
| src/util.py|15| match |
+---------------------------+
Tips
- Set
previewheightto control preview window size::set previewheight=15 - Only one preview window can exist at a time — opening another replaces it
- Use
<C-w>Pto jump to the preview window,<C-w>pto jump back - Neovim's LSP uses the preview window for hover documentation