How do I make @ characters count as part of filenames for gf and path motions?
:set isfname+=@-@
gf is fast until it stops exactly at characters common in modern import paths, especially @ in scoped package names (@org/pkg/file).
Search Vim Tricks
Searching...:set isfname+=@-@
gf is fast until it stops exactly at characters common in modern import paths, especially @ in scoped package names (@org/pkg/file).
:normal! @q
Recorded macros can become fragile when your config defines mappings that shadow built-in keys.
:set shortmess+=S
Vim's search count feedback ([3/27]) is useful until it starts flooding the command area during rapid navigation.
:set showcmdloc=statusline
When you chain operators and motions, showcmd feedback is critical, but the default bottom-line location can fight with command messages and prompts.
:set inccommand=nosplit
When you are crafting a risky :substitute command, the expensive part is usually confidence, not typing.
:setlocal winfixheight winfixwidth
If you use a dedicated utility pane (logs, quick notes, REPL output), Vim's default equalization behavior can keep resizing it whenever other splits change.
:keepjumps normal! gg=G
Bulk formatting commands are common in cleanup sessions, but they often leave side effects in your navigation history.
:set diffopt+=algorithm:histogram,indent-heuristic
Default diff behavior can produce noisy hunks when code is moved or indentation changes significantly.
:%s/\vfoo\zsbar/baz/g
When your match has a stable prefix but you only want to replace the trailing segment, \zs is often cleaner than introducing extra capture groups.
:argdo %s/\<old\>/new/ge | update
When you need to apply the same substitution across a curated set of files, :argdo is safer than a broad project-wide command.
command-line #command-line #ex-commands #search #buffers #formatting
:djump /MY_MACRO/
:djump searches for matches using Vim's definition search rules and jumps to the selected hit.
:let s:u=&l:undolevels | setlocal undolevels=-1 | execute "normal! a\<BS>\<Esc>" | let &l:undolevels=s:u
Sometimes you finish a risky refactor and want a clean undo boundary before handing the buffer off or continuing with unrelated edits.
:ijump /MySymbol/
:ijump is an include-aware jump command that searches the current file plus files discovered through your include and path settings, then jumps directly to a se
:lgetexpr systemlist('rg --vimgrep TODO %') | lopen
When you want search results tied to only the current window, use :lgetexpr instead of :cgetexpr.
buffers-windows #location-list #quickfix #buffers #command-line #search
:cgetexpr systemlist('rg --vimgrep TODO')
When you already have a shell command that emits file:line:col:message records, :cgetexpr is a fast way to populate quickfix directly.
/pattern/e+1<CR>
Most Vim searches place the cursor at the start of the match.
:undojoin<CR>
By default, separate edits often become separate undo entries, which makes replaying or backing out a multi-part change noisy.
"ayyj"Ayyk"ap
Named registers are much more powerful when you treat them as accumulators instead of one-shot clipboards.
:windo diffthis<CR>
If you already have several related files open in splits, enabling diff mode one window at a time is slow and error-prone.
buffers-windows #buffers-windows #diff #windows #ex-commands
]m / [m
When you're reviewing or refactoring C-style code, jumping by words or paragraphs is too coarse, and search can become noisy.
navigation #navigation #motions #code-navigation #normal-mode