How do I insert a literal control character or special key in insert mode?
When you need to insert a literal tab character despite expandtab being set, or embed a control character like ^M (carriage return) into your text, in insert mo
category:
editing
tags:
#editing
#insert-mode
#special-characters
#control-characters
How do I center or right-align a block of text using Vim's built-in Ex commands?
Vim provides three built-in Ex commands for text alignment: :center, :right, and :left.
category:
command-line
tags:
#ex-commands
#editing
#formatting
#visual-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 run a substitution across the arglist and write only modified files?
:argdo %s/foo/bar/ge | update
Bulk replacements across many files are risky when every buffer gets written unconditionally.
category:
command-line
tags:
#command-line
#arglist
#refactor
#ex-commands
How do I define a multi-line string in Vimscript without concatenation or escape sequences?
Vim 8.
category:
command-line
tags:
#ex-commands
#config
#macros
How do I replay a macro many times without cluttering the jumplist?
Running a macro hundreds of times is efficient, but it can flood your jumplist and make normal navigation painful afterward.
category:
macros
tags:
#macros
#automation
#normal-mode
#navigation
How do I run Normal mode commands in a script without triggering my custom mappings?
:normal {keys} executes keystrokes as if typed in Normal mode — but it respects your custom mappings and abbreviations.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
How do I display a vertical line at a specific column width?
The :set colorcolumn=80 command displays a vertical highlight at column 80, giving you a visual guide for line length.
category:
config
tags:
#config
#formatting
#ex-commands
How do I filter the output of a Vim command to show only lines matching a pattern?
:filter /pattern/ {command}
:filter /pattern/ {command} runs any Ex command but suppresses every output line that does not match the pattern.
category:
command-line
tags:
#command-line
#ex-commands
#search
#buffers
How do I paste the contents of a register at a specific line number without moving my cursor?
How it works The :put Ex command pastes the contents of a register after a specified line.
category:
editing
tags:
#editing
#registers
#ex-commands
How do I hide a buffer from the buffer list without closing it?
Setting nobuflisted removes a buffer from the :ls output and buffer-switching commands like :bnext/:bprev, while keeping it loaded and accessible.
category:
buffers-windows
tags:
#buffers-windows
#buffers
#unlisted
#management
How do I quickly append text to the end of a word under the cursor in Vim?
The ea compound shortcut moves to the last character of the current word with e, then enters insert mode after the cursor with a.
category:
editing
tags:
#editing
#motions
#insert-mode
#normal-mode
How do I delete text and save it to a specific named register?
How it works When you delete text in Vim with commands like dd, dw, or x, the deleted text goes into the unnamed register and the numbered registers (1-9).
category:
registers
tags:
#registers
#editing
#normal-mode
How do I duplicate every line in a buffer so each line appears twice in place?
The command :g/^/t.
category:
command-line
tags:
#ex-commands
#editing
#global
#command-line
How do I transform text in a visual selection using awk or sed?
:'<,'>!awk '{print toupper($0)}'
Vim can pipe any visual selection through external Unix commands and replace the selection with the output.
category:
visual-mode
tags:
#visual-mode
#external-command
#awk
#text-transformation
How do I run a search and replace only within a visually selected region?
:'<,'>s/pattern/replacement/g
When you make a visual selection and then type :, Vim automatically inserts ' as the range — the marks for the start and end of the last visual selection.
category:
visual-mode
tags:
#visual-mode
#search
#editing
How do I jump back several entries in the jumplist with a single command?
Most Vim users know jumps backward in the jumplist, but fewer use a count with it.
category:
navigation
tags:
#navigation
#jumplist
#motions
#workflow
How do I make a macro conditionally execute commands based on line content?
:if condition | execute 'normal cmd' | endif
How it works Vim macros can include Ex commands with conditional logic.
category:
macros
tags:
#macros
#ex-commands
#editing
How do I see available key mappings as I type?
vim-which-key displays a popup showing available key bindings as you type a prefix key.
category:
plugins
tags:
#plugins
#navigation
#config
How do I hide or replace the ~ characters that appear at the end of a buffer?
By default, Vim fills empty lines after the end of a buffer with ~ characters.
category:
config
tags:
#config
#display
#visual