How do I search many files with :vimgrep but avoid opening each hit while building quickfix?
:vimgrep /{pattern}/j **/*
For project-wide searches, :vimgrep is powerful but can feel disruptive if it jumps into files while populating quickfix.
Search Vim Tricks
Searching...:vimgrep /{pattern}/j **/*
For project-wide searches, :vimgrep is powerful but can feel disruptive if it jumps into files while populating quickfix.
:filter /{pattern}/ history cmd
When command history gets crowded, scanning :history cmd manually is slow.
:cdo normal! @a | update
When you already have a precise quickfix list, :cdo is one of the safest ways to run a macro only where it matters.
:let @a = @a[:-2]
Macros and named registers are just strings, so you can surgically edit them instead of re-recording from scratch.
:'<,'>normal! .
When you already made one correct edit, replaying it is usually safer than retyping it by hand.
:keepalt sbuffer {bufnr}
The alternate-file register (#) is easy to disturb when jumping around buffers, and many advanced motions depend on it (, # expansions, quick two-file toggles).
:let @q = substitute(@q, '\n$', 'A;<Esc>\n', '')
Rerecording a long macro for one tiny change is slow and error-prone.
:set completefunc=syntaxcomplete#Complete
If omnifunc is unavailable for a filetype, Vim can still offer meaningful completion by using syntax groups.
"=strftime('%F')<CR>p
The expression register lets you compute text on demand and insert it without leaving Normal mode workflows.
registers #registers #expression-register #normal-mode #automation
:verbose autocmd BufWritePre
When a save hook starts behaving unexpectedly, the hard part is usually finding who defined it.
:'<,'>s/\%V\s\+$//
Sometimes you need to clean alignment artifacts in a rectangular region without touching the rest of each line.
visual-mode #visual-mode #substitution #regex #formatting #editing
:cfdo %s/\<GetUser\>/FetchUser/ge | update
When quickfix has many matches per file, :cdo can execute your command repeatedly in the same buffer.
command-line #command-line #quickfix #refactoring #ex-commands #search
:set timeout timeoutlen=400 ttimeoutlen=30
If custom mappings feel laggy, the issue is often timeout tuning rather than mapping design.
config #config #mappings #performance #command-line #insert-mode
:vimgrep /\<TODO\>/gj **/*.lua | copen
When you want a project-wide TODO pass without leaving Vim, :vimgrep plus quickfix is a strong built-in workflow.
search #search #quickfix #command-line #project-navigation #ex-commands
:%s/\v(\S+)\s+(\S+)/\2 \1/<CR>
When you need to flip two fields across a whole file, a single substitution is faster and safer than recording a macro.
editing #editing #substitution #regex #ex-commands #formatting
:keepalt edit {file}<CR>
The alternate-file mark (#) powers fast toggles like and commands that depend on the previous file context.
command-line #command-line #buffers #workflow #navigation #advanced
:hide edit {file}<CR>
Normally, trying to :edit another file from a modified buffer triggers a warning and blocks the switch unless you save or force the command.
buffers-windows #buffers #windows #workflow #command-line #editing
:set nrformats-=octal<CR>
By default, Vim may treat numbers with leading zeros as octal when you use and for increment/decrement.
:keeppatterns normal! @q<CR>
When you replay macros from Ex commands, Vim can overwrite @/ (the last search pattern) depending on what the macro does.
:vimgrep /pattern/j **/*<CR>:copen<CR>
When you need a project-wide search but do not want to leave Vim, :vimgrep gives you a built-in grep workflow with navigation, filtering, and batch editing thro
search #search #quickfix #vimgrep #project-workflow #command-line