How do I configure :grep to use ripgrep with quickfix output and include hidden files?
:set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --glob\ !.git
Vim's :grep becomes much more useful when grepprg is tuned for ripgrep and quickfix-compatible output.
category:
config
tags:
#config
#search
#command-line
#quickfix
How do I reuse my last search pattern literally in :substitute without re-escaping it?
When your last search pattern contains punctuation, slashes, or regex atoms, retyping it inside :substitute is error-prone.
category:
command-line
tags:
#command-line
#search
#ex-commands
#editing
How do I strip trailing whitespace without clobbering my last search pattern?
:keeppatterns %s/\s\+$//e
Bulk cleanup commands often damage your navigation flow by overwriting the last search pattern (@/).
category:
command-line
tags:
#command-line
#search
#substitution
#whitespace
How do I inspect a macro register with escaped control characters so I can debug it safely?
:echo string(getreg('q'))
Macros can fail for subtle reasons: hidden control keys, extra whitespace, or unexpected register contents.
category:
registers
tags:
#registers
#macros
#debugging
#automation
#command-line
How do I inspect only Ex command history so I can quickly rerun a complex command?
When you work with long substitution pipelines or multi-part Ex commands, digging through all history (:history) adds noise.
category:
command-line
tags:
#command-line
#history
#ex-commands
#workflow
How do I reindent the whole buffer without adding jumplist entries?
:keepjumps normal! gg=G<CR>
Whole-buffer reindent is common, but doing it naively can pollute your jumplist and break navigation flow during review.
category:
command-line
tags:
#command-line
#formatting
#undo-redo
#workflow
How do I set each window's local working directory to its buffer path?
When multiple splits point at files from different projects, relative-path commands can become inconsistent and error-prone.
category:
buffers-windows
tags:
#buffers
#windows
#command-line
#workflow
How do I capture command-line output directly into a register?
:redir @a | messages | redir END<CR>
When debugging a session or building repeatable edits, it is useful to turn command output into editable text.
category:
registers
tags:
#registers
#command-line
#debugging
#workflow
How do I delete all lines between two delimiter patterns without removing the delimiters themselves?
:g/BEGIN/+1,/END/-1 delete
By combining the :global command with a relative address range, you can delete the content between repeating delimiter pairs while leaving the delimiters intact
category:
command-line
tags:
#command-line
#ex-commands
#search
#editing
How do I configure command-line tab completion to show the longest match first then cycle?
:set wildmode=longest:full,full
The wildmode option controls what happens when you press in the command line.
category:
config
tags:
#command-line
#completion
#config
How do I send a range of lines as stdin to a shell command without modifying the buffer?
The :[range]w !{cmd} command writes a range of lines to the standard input of a shell command, leaving the buffer completely unchanged.
category:
command-line
tags:
#ex-commands
#command-line
#shell
#normal-mode
How do I inspect the contents of specific Vim registers without listing all of them?
The :registers command dumps every register at once, which is noisy when you only care about a handful.
category:
registers
tags:
#registers
#command-line
#macros
#normal-mode
How do I open a URL or file from Neovim using the system's default application?
vim.
category:
command-line
tags:
#neovim
#lua
#config
#command-line
How do I evaluate and pretty-print a Lua expression from the Neovim command line without writing print(vim.inspect(...))?
In Neovim, :lua = expr is a shorthand that evaluates a Lua expression and pretty-prints the result using vim.
category:
command-line
tags:
#neovim
#lua
#command-line
#debugging
How do I create interactive selection menus and text input prompts in Neovim Lua scripts?
vim.ui.select() and vim.ui.input()
Neovim provides vim.
category:
plugins
tags:
#editing
#command-line
How do I run a global command only on lines that match two different patterns simultaneously?
:g/pattern1/g/pattern2/command
Vim's :g command can be nested — the command part of one :g can itself be another :g.
category:
command-line
tags:
#ex-commands
#search
#editing
#command-line
How do I open a file in Vim without triggering any autocmds for faster loading?
When you have heavy autocmds registered for BufRead, BufEnter, or FileType events — such as LSP clients, formatters, or syntax processors — opening a large
category:
command-line
tags:
#command-line
#ex-commands
#buffers-windows
#config
How do I save the current buffer to a different filename and continue editing under the new name?
:saveas saves the buffer to a new file and redirects all future :w commands to write to that new filename — making it the true "Save As" command in Vim.
category:
command-line
tags:
#command-line
#editing
#buffers
How do I define a custom Ex command that can accept a line range or count like built-in Vim commands?
:command -range {Name} ...
Custom Ex commands defined with :command -range can be called with a line range (e.
category:
command-line
tags:
#command-line
#ex-commands
#config
How do I insert all command-line completion matches at once without pressing Tab repeatedly?
Pressing on the command line expands all current completion matches into the command at once, rather than cycling through them one at a time with .
category:
command-line
tags:
#command-line
#completion
#ex-commands