How do I show only buffers matching a pattern in Vim's :ls output?
:filter /pattern/ ls
When you have many open buffers, plain :ls output gets noisy fast.
:filter /pattern/ ls
When you have many open buffers, plain :ls output gets noisy fast.
:/BEGIN/,/END/-1s/\s\+$//
When you need to clean or refactor block-like regions, Ex ranges can target lines between two search patterns without selecting text manually.
command-line #command-line #ex-commands #ranges #search #editing
:set shortmess+=c
Insert-mode completion can spam the command line with status text like "match 1 of N" and related prompts.
config #config #completion #command-line #options #insert-mode
:let @a = getreg('0')
When you want to preserve a valuable yank before doing destructive edits, copying register 0 into a named register is safer than re-yanking text.
registers #registers #yanking #editing #command-line #refactoring
:verbose nmap <lhs>
When key behavior is inconsistent, the root cause is usually mapping precedence.
command-line #command-line #mappings #debugging #config #normal-mode
:let @/='\V'.escape(@", '\\')
When you yank text that contains regex characters like .
:let @a=@1
When you delete full lines repeatedly, Vim rotates those deletions through numbered registers.
:set cedit=<C-y>
Vim's command-line window is invaluable for editing long : commands, search patterns, and complex substitutions with normal-mode tools.
:lvimgrep /TODO/j **/* | lopen
When you are working in split-heavy sessions, global quickfix results can become noisy because every window shares the same list.
:argdo %s/\s\+$//e | update
When you need to clean up many files at once, :argdo lets you run the same command on every buffer in your argument list.
:vimgrepadd /pattern/j **/*<CR>
When you are investigating code, you often need to collect several related patterns before deciding what to edit.
:tab sbuffer {bufnr}<CR>
If a file is already loaded as a buffer, reopening it with :tabedit can trigger another read and may lose the exact in-memory context you want.
:'a,'bnormal! @q<CR>
When you need to replay a macro on a precise region, selecting lines manually can be slow and error-prone.
:undojoin | normal! A;<CR>
When you automate edits from Ex commands, Vim usually creates a separate undo entry for each change.
:keepjumps normal! gg
Sometimes you need to make a quick structural move (for example, jump to top, inspect context, then return) without polluting jump navigation history.
:<C-f>
Long Ex commands are easy to mistype when you edit inline on a single command line.
"=system('git rev-parse --short HEAD')->trim()<CR>p
If you frequently write commit references in notes, code comments, or release docs, you can avoid shell context switches and paste the hash straight from Vim.
:cexpr system('rg --vimgrep "TODO"')
When you already know you want an external search tool, :cexpr lets you import results directly into quickfix without opening a terminal buffer or shelling out
:let @a .= getline('.') . "\n"
Named registers are usually filled with yanks and deletes, but they are also plain variables you can edit with Vimscript.
:botright copen 8 | wincmd p
Quickfix is powerful, but opening it can disrupt window layout and yank focus away from your current editing context.