How do I override ignorecase or smartcase for a single search without changing my settings?
Vim's \c and \C flags let you force a search to be case-insensitive or case-sensitive on a per-search basis, regardless of your ignorecase and smartcase setting
category:
search
tags:
#search
#normal-mode
#ex-commands
How do I select a word under the cursor in visual mode?
How it works The command viw selects the word under the cursor in visual mode.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#navigation
How do I insert a newline in the replacement string of a :s substitution?
In Vim's :substitute command, \r in the replacement string inserts a literal newline — it splits the line at that point.
category:
search
tags:
#search
#editing
#ex-commands
#normal-mode
What is the difference between \n and \r in Vim substitution patterns and replacements?
One of the most confusing asymmetries in Vim's substitution syntax: \n and \r mean different things depending on whether they appear in the pattern or the repla
category:
search
tags:
#search
#ex-commands
#editing
How do I make right-click extend a selection instead of opening a popup menu?
If you use the mouse occasionally in Vim, mousemodel=extend makes selection behavior much more predictable.
category:
config
tags:
#config
#visual-mode
#selection
#mouse
How do I write a Vim search pattern that matches text spanning multiple lines?
Vim's regex engine normally treats .
category:
search
tags:
#search
#regex
#normal-mode
How do I manually fire an autocommand event to re-trigger filetype settings or test autocmds?
:doautocmd fires any autocommand event manually, exactly as if that event had occurred naturally.
category:
command-line
tags:
#ex-commands
#config
#autocmds
#command-line
How do I define custom fold boundaries using a Vimscript expression in Vim?
Setting foldmethod=expr tells Vim to call the foldexpr expression for every line to compute its fold level.
category:
config
tags:
#folding
#config
#normal-mode
How do I search only a sub-part of a larger pattern using \zs and \ze?
Sometimes you need Vim to match a long structural pattern but only treat one piece of it as the actual match.
category:
search
tags:
#search
#regex
#pattern-matching
#advanced
How do I access my delete history beyond the last delete?
Vim maintains a numbered register history from "1 through "9 that stores your last 9 deletes and changes.
category:
registers
tags:
#registers
#undo-redo
#delete
#history
#paste
How do I append text with :normal without creating an extra undo step?
:undojoin | normal! A;<CR>
When you automate edits from Ex commands, Vim usually creates a separate undo entry for each change.
category:
command-line
tags:
#command-line
#undo-redo
#ex-commands
#editing
How do I see all recent Vim messages, errors, and echo output I may have missed?
:messages displays the full log of recent Vim messages — errors, warnings, echo output, and status notifications.
category:
command-line
tags:
#ex-commands
#command-line
How do I indent or unindent selected lines in visual mode?
How it works In visual mode, you can shift selected lines to the right or left using the > and to indent them or or shifts the selected lines one shiftwidth to
category:
visual-mode
tags:
#visual-mode
#indentation
#editing
#formatting
How do I use zero-width lookbehind assertions in Vim search patterns to match text only when preceded (or not preceded) by a pattern?
Vim's \@<= and \@<! atoms let you write zero-width lookbehind assertions — they check what comes before the match position without consuming characters.
category:
search
tags:
#search
#regex
#patterns
#advanced
How do I debug a macro by stepping through it command by command?
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
category:
macros
tags:
#macros
#debugging
#troubleshooting
#registers
How do I keep each search match centered and unfolded as I jump with n?
When you are stepping through many matches, plain n often lands with poor context and can hide the match inside a closed fold.
category:
navigation
tags:
#navigation
#search
#folding
#normal-mode
How do I make Ctrl-A and Ctrl-X increment and decrement hexadecimal numbers?
By adding hex to the nrformats option, you tell Vim to recognise hexadecimal literals such as 0xFF or 0xDEAD when or is pressed.
category:
config
tags:
#config
#numbers
#increment
#normal-mode
#editing
How do I convert a word between snake_case, camelCase, MixedCase, and kebab-case with a single keystroke?
The vim-abolish plugin provides cr{type} coercions that instantly convert the word under the cursor to a different naming convention.
category:
plugins
tags:
#editing
#text-objects
#normal-mode
How do I run a recorded macro on every quickfix match without touching unrelated lines?
When a refactor target spans many files but only specific matches matter, running a macro globally is risky.
category:
macros
tags:
#macros
#quickfix
#automation
#ex-commands
How do I write a Vim regex that matches any character including newlines for multi-line pattern matching?
In Vim's regular expressions, .
category:
search
tags:
#search
#regex
#multiline
#advanced
#pattern