How do I preview a fuzzy tag match in the preview window without immediately switching buffers?
Answer
:ptjump /{pattern}
Explanation
When a symbol name is ambiguous, jumping directly with :tag can bounce you around the codebase and disrupt your working context. :ptjump /{pattern} searches the tags stack with a pattern match and opens the selected hit in the preview window, so you can inspect candidates before committing to a full navigation jump. This is a strong workflow for large projects where many functions share prefixes or overload-like naming conventions.
How it works
:ptjumpcombines tag search behavior with preview-window display/{pattern}lets you search tags by pattern rather than requiring an exact tag name- The result opens in the preview window, keeping your current editing window focused
- You can scan definition details, then either close the preview or jump more deliberately with tag commands
Example
You are on a call site and want the right parse_* implementation without losing your spot.
:ptjump /parse_
Vim opens a matching tag target in preview, while your cursor stays in the original window.
Current window: parser_test.go (cursor unchanged)
Preview window: parser_impl.go at parse_config
You inspect quickly, then decide whether to continue, refine the pattern, or perform a full tag jump.
Tips
- Use
<C-w>Pto move into the preview window only when you actually need to edit there. - Combine with
:ptnext/:ptpreviousto cycle previewed tag matches. - Keep
:set previewheight=tuned so preview does not crowd your main editing pane.