How do I insert special Unicode characters and symbols using Vim's built-in digraph system?
Vim's digraph system lets you type hundreds of special characters — arrows, fractions, accented letters, currency symbols, and more — using intuitive two-ch
category:
editing
tags:
#insert-mode
#editing
How do I uppercase or lowercase the entire current line in one keystroke?
The gUU command uppercases every character on the current line instantly — no visual selection or motion required.
category:
editing
tags:
#editing
#normal-mode
#formatting
How do I invert the case of an entire paragraph with one operator command?
g~ap is a fast way to invert letter case across a full paragraph without entering Visual mode.
category:
editing
tags:
#editing
#operators
#text-objects
#case
#normal-mode
How do I uppercase only the current search match using gn as a motion?
gn is often treated as a visual selection command, but it is more powerful when used as a motion target for operators.
category:
search
tags:
#search
#motions
#editing
#normal-mode
How do I zero-pad every number in a buffer with one substitution?
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g
When you need stable-width numeric fields, manual edits are slow and error-prone.
category:
command-line
tags:
#command-line
#substitution
#regex
#refactoring
How do I add or subtract a specific number to a number under the cursor?
{count}<C-a> / {count}<C-x>
While increments and decrements a number by 1, you can prefix either with a count to add or subtract a specific amount.
category:
editing
tags:
#editing
#normal-mode
#motions
How do I copy the current file's path into the system clipboard from Vim?
The % register always holds the name of the current file (as a relative path).
category:
registers
tags:
#registers
#editing
#ex-commands
How do I center, right-align, or left-align lines of text within a fixed column width using Ex commands?
Vim has built-in Ex commands for text alignment: :center, :right, and :left.
category:
command-line
tags:
#ex-commands
#formatting
#editing
#command-line
How do I repeat the last substitute command preserving its flags?
After running a :s/pattern/replacement/g command, you often need to repeat it on another line or range.
category:
search
tags:
#substitute
#search
#ex-commands
#editing
How do I auto-indent an entire file in Vim?
The gg=G command re-indents every line in the current file according to Vim's indentation rules.
category:
editing
tags:
#editing
#indentation
#formatting
#normal-mode
How do I configure what types of numbers Vim recognizes when using Ctrl-A and Ctrl-X to increment or decrement?
The nrformats option controls which number formats (increment) and (decrement) recognize.
category:
config
tags:
#config
#editing
#normal-mode
How do I hide noisy completion messages in Vim's command line?
Insert-mode completion can spam the command line with status text like "match 1 of N" and related prompts.
category:
config
tags:
#config
#completion
#command-line
#options
#insert-mode
How do I open a file in read-only mode so I cannot accidentally modify it?
:view opens a file with the readonly option set, preventing accidental writes.
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
How do I jump to the beginning of a file in Vim?
The gg command moves the cursor to the first line of the file.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I preview, stage, and navigate Git hunks inline with gitsigns?
gitsigns.
category:
plugins
tags:
#plugins
#git
#gitsigns
#version-control
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 insert text at the beginning of a line?
The I (uppercase) command moves the cursor to the first non-blank character of the current line and enters insert mode.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
How do I filter text through an external program using a motion in normal mode?
The ! operator in normal mode lets you pipe a range of text through any external program and replace it with the output.
category:
editing
tags:
#editing
#normal-mode
#ex-commands
#formatting
How do I duplicate a line in Vim?
The yyp command duplicates the current line by yanking it and immediately pasting it below.
category:
editing
tags:
#editing
#yank
#normal-mode
How do I pipe the entire buffer through an external shell command like sort, jq, or a formatter?
:%!{command} replaces the entire buffer contents with the output of piping them through a shell command.
category:
editing
tags:
#editing
#ex-commands
#filtering
#normal-mode