How do I join every line matching a pattern with the line that follows it?
The :g/pattern/join command combines the :global command with :join to merge every line matching a pattern with the line immediately following it.
category:
command-line
tags:
#ex-commands
#editing
#command-line
#search
#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 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 delete each line matching a pattern along with a fixed number of lines that follow it?
Inside a :global command, .
category:
command-line
tags:
#ex-commands
#global
#delete
#editing
#command-line
How do I prevent a split window from being resized by Vim?
When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim
category:
buffers-windows
tags:
#buffers-windows
#windows
#resize
#layout
How do I insert the same text multiple times without a macro or copy-paste?
Vim's insert commands accept a count prefix that repeats everything you type.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
#formatting
How do I open a file and automatically jump to the first line matching a pattern?
The +{cmd} flag on :edit (and most file-opening commands) runs an Ex command immediately after the file loads.
category:
command-line
tags:
#command-line
#ex-commands
#navigation
#search
#buffers
How do I control exactly what Vim saves when I create a session with :mksession?
The sessionoptions option (abbreviated ssop) is a comma-separated list of flags that determine what :mksession stores in the session file.
category:
buffers-windows
tags:
#buffers-windows
#config
#workflow
#sessions
How do I insert text at the very first column of a line, ignoring indentation?
Most Vim users know I to insert at the start of a line — but I actually jumps to the first non-blank character, skipping leading whitespace.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
#indentation
How do I read the contents of a Vim register into a variable or expression using Vimscript?
The getreg({name}) function returns the content of any register as a string.
category:
registers
tags:
#registers
#ex-commands
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 show only buffers matching a pattern in Vim's :ls output?
When you have many open buffers, plain :ls output gets noisy fast.
category:
buffers-windows
tags:
#buffers
#command-line
#regex
#workflow
How do I duplicate every non-blank line in a buffer with one Ex command?
The :global command can apply an Ex action to every line that matches a pattern.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
#search
How do I match a pattern only if it is followed by another pattern?
The \ze atom marks the end of the match, so you can match a pattern only when it appears before specific text.
category:
search
tags:
#search
#normal-mode
How do I align columns in a visual selection using an external command?
:'<,'>!awk '{printf "%-20s %s\n", $1, $2}'
By piping a visual selection through awk with printf formatting, you can align columns to fixed widths.
category:
visual-mode
tags:
#visual-mode
#formatting
#alignment
#external-command
How do I uppercase only the text inside braces using a visual text object?
When editing structured text, you often need to transform content inside delimiters without touching the delimiters themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#motions
How do I set a colorscheme with a fallback in case it is not installed?
try | colorscheme gruvbox | catch | colorscheme default | endtry
How it works When you share your vimrc across multiple machines, a colorscheme you have installed on one system may not exist on another.
category:
config
tags:
#editing
#formatting
How do I use marks inside a macro to return to a specific position?
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
category:
macros
tags:
#macros
#marks
#normal-mode
#editing
How do I append a range of lines from the current buffer to another file in Vim?
:[range]write >> filename
The >> modifier on :write appends lines to a file instead of overwriting it.
category:
command-line
tags:
#command-line
#ex-commands
#file-handling
#editing
How do I use a macro to align text on a specific character like the equals sign?
qa0f=20i <Esc>20|C= <Esc>lDjq
How it works Aligning text on a delimiter such as = without plugins requires a clever macro technique.
category:
macros
tags:
#macros
#editing
#formatting
#normal-mode