How do I force a case-sensitive search in Vim even when ignorecase is enabled?
Appending \C anywhere in a search pattern forces the entire search to be case-sensitive, regardless of whether ignorecase or smartcase is set.
category:
search
tags:
#search
#case-sensitive
#ignorecase
#smartcase
#normal-mode
How do I force a case-sensitive or case-insensitive search for just one pattern without changing my settings?
Vim's \C and \c atoms let you override ignorecase and smartcase on a per-pattern basis.
category:
search
tags:
#search
#normal-mode
#ex-commands
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 replace a character while preserving screen column alignment when tabs are involved?
The gr{char} command is Vim's virtual replace variant of r{char}.
category:
editing
tags:
#editing
#normal-mode
#replace
#tabs
How do I delete everything typed on the current line without leaving insert mode?
Pressing while in insert mode deletes all characters entered since you last entered insert mode on the current line.
category:
editing
tags:
#insert-mode
#editing
#delete
#normal-mode
How do I delete or change text without overwriting my previously yanked text?
Vim's black hole register (") acts as a write-only sink: anything sent to it is discarded without affecting any other register, including the unnamed register (
category:
registers
tags:
#registers
#delete
#editing
#normal-mode
How do I use a count with text objects to operate on multiple text objects at once?
Text objects in Vim accept a count, letting you operate on a span of multiple adjacent text objects in one command.
category:
editing
tags:
#editing
#text-objects
#normal-mode
How do I delete from a visual block column to the end of each selected line?
In visual block mode, pressing C (uppercase) deletes from the leftmost column of the selection to the end of every selected line, then drops you into insert mod
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I convert the entire current line to lowercase or uppercase in one command?
Vim's case operators gu (lowercase) and gU (uppercase) follow the same doubling convention as dd and yy: repeating the operator letter applies it to the whole c
category:
editing
tags:
#editing
#normal-mode
How do I prevent Vim from treating leading-zero numbers as octal when incrementing with Ctrl-A?
By default, Vim treats numbers prefixed with a leading zero (like 007) as octal when you use or to increment or decrement them.
category:
config
tags:
#config
#editing
#normal-mode
How do I search backward for the word under the cursor?
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
category:
search
tags:
#search
#navigation
#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 append more commands to an existing macro without re-recording it from scratch?
Recording a macro with an uppercase register letter appends to the existing macro in the corresponding lowercase register instead of overwriting it.
category:
macros
tags:
#macros
#registers
#recording
#normal-mode
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 jump to a specific percentage through a file, like the middle or three-quarters of the way?
Prefixing the % command with a count jumps the cursor to that percentage through the file.
category:
navigation
tags:
#navigation
#motions
#large-files
#normal-mode
How do I add a description to a Neovim keymapping so it appears in which-key and :map output?
vim.keymap.set('n', '{key}', {fn}, { desc = '{description}' })
When defining keymaps with vim.
category:
config
tags:
#normal-mode
#macros
#ex-commands
How do I programmatically set the contents of a register from the command line?
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
category:
registers
tags:
#registers
#ex-commands
#macros
#normal-mode
How do I open all nested folds under the cursor at once in Vim?
zO (uppercase O) opens the fold under the cursor and all folds nested inside it recursively.
category:
editing
tags:
#folding
#editing
#normal-mode
How do I highlight all occurrences of a yanked word without typing a search pattern?
After yanking text, you can promote it directly to the search register with :let @/ = @".
category:
registers
tags:
#registers
#search
#hlsearch
#normal-mode
How do I paste the text I just typed in insert mode?
The ".
category:
registers
tags:
#registers
#editing
#insert-mode
#normal-mode
#productivity