How do I use POSIX character classes like [:alpha:] and [:digit:] in Vim search patterns?
Vim's regex engine supports POSIX character classes inside bracket expressions, giving you locale-aware, readable alternatives to manual character ranges like [
category:
search
tags:
#search
#regex
#patterns
#character-classes
How do I handle errors gracefully in Vimscript using try-catch blocks?
Vimscript has a structured exception handling system using :try, :catch, :finally, and :endtry.
category:
command-line
tags:
#ex-commands
#macros
#config
How do I normalize curly quotes to straight quotes in the current buffer?
:%s/[“”]/"/ge<CR>:%s/[‘’]/'/ge<CR>
When text comes from docs, email, or CMS exports, it often contains typographic quotes (“”‘’) that break code snippets, Markdown tooling, or shell comma
category:
editing
tags:
#editing
#substitute
#formatting
#text-cleanup
How do I inspect what key sequences are stored in a macro register?
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
category:
macros
tags:
#macros
#registers
#debugging
How do I delete all lowercase marks in the current buffer at once?
Marks accumulate as you work — ma, mb, mc and so on record positions for later jumps.
category:
navigation
tags:
#navigation
#marks
#editing
#ex-commands
How do I use a macro to wrap each word in quotes?
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
category:
macros
tags:
#macros
#editing
#normal-mode
#insert-mode
How do I change surrounding quotes or brackets from one type to another with vim-surround?
The vim-surround plugin (by Tim Pope) adds three powerful operators for working with surrounding delimiters — quotes, brackets, parentheses, and HTML tags.
category:
plugins
tags:
#plugins
#text-objects
#editing
How do I make Vim's command-line tab completion case-insensitive for file and buffer names?
:set wildignorecase makes Vim's command-line tab completion treat uppercase and lowercase letters as equivalent when completing file names, buffer names, and ot
category:
command-line
tags:
#command-line
#completion
#config
#ex-commands
How do I match text only when it is followed by a specific pattern using zero-width lookahead?
Vim's regex engine supports zero-width positive lookahead via the \@= operator.
category:
search
tags:
#search
#regex
#lookahead
#advanced
#pattern
How do I run a command without moving the cursor or changing the scroll position?
:let view=winsaveview() | {cmd} | call winrestview(view)
When writing Vimscript functions or mappings, commands like :substitute, gg, or :%normal will move the cursor and change the scroll position.
category:
command-line
tags:
#ex-commands
#editing
#vimscript
#navigation
How do I add blank lines above or below the current line using vim-unimpaired?
vim-unimpaired (by Tim Pope) provides paired bracket mappings for dozens of common operations.
category:
plugins
tags:
#editing
#normal-mode
How do I add a per-window title bar in Neovim that shows context like the current filename?
Neovim 0.
category:
config
tags:
#config
#windows
#buffers-windows
How do I register custom filetype detection rules in Neovim using Lua without editing filetype.vim?
vim.
category:
config
tags:
#filetype
#neovim
#lua
#config
How do I jump to the last line of a file in Vim?
The G command moves the cursor to the last line of the file.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I jump to the beginning of the next word?
The w command moves the cursor forward to the beginning of the next word.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I extract the directory, filename, or extension from the current file path inside a Vim command?
Vim's filename modifiers let you derive path components from the current buffer's filename directly on the command line.
category:
command-line
tags:
#ex-commands
#command-line
#editing
How do I run a command without triggering any autocommands, such as saving without auto-formatting?
The :noautocmd (abbreviated :noa) prefix suppresses all autocommand events for the duration of the command that follows it.
category:
command-line
tags:
#ex-commands
#config
#editing
How do I wrap a word in quotes or brackets using vim-surround?
The ysiw" command wraps the word under the cursor in double quotes using the vim-surround plugin.
category:
plugins
tags:
#plugins
#text-objects
#editing
#insert-mode
How do I write autocommands that don't duplicate when I reload my vimrc?
augroup name | autocmd! | autocmd ... | augroup END
Autocommand groups (augroup) with autocmd! prevent duplicate autocommands from accumulating every time you source your vimrc.
category:
config
tags:
#config
#autocommands
#vimrc
#best-practices
How do I make the gq operator format code with an external tool like prettier or black?
When formatprg is set, the gq operator pipes the selected text through that external program and replaces it with the program's output.
category:
editing
tags:
#editing
#formatting
#ex-commands
#config