How do I fix a misspelled word using Vim's spell checker while staying in insert mode?
When spell checking is enabled (:set spell), s in insert mode opens a popup menu of suggested corrections for the most recently flagged misspelled word — with
category:
editing
tags:
#editing
#insert-mode
#completion
#search
How do I sort lines and remove duplicates in one command?
The :sort u command sorts all lines in the buffer (or a selected range) alphabetically and removes duplicate lines in a single pass.
category:
editing
tags:
#editing
#ex-commands
#formatting
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 sort lines by a specific column or field in Vim?
Vim does not have a built-in multi-column sort, but you can leverage the external sort command to sort selected lines by any field.
category:
editing
tags:
#editing
#sorting
#ex-commands
#external-commands
#command-line
How do I include dictionary and spelling words in Vim's insert-mode autocomplete?
Vim's built-in completion ( / ) sources matches from buffers, included files, and tags by default.
category:
editing
tags:
#completion
#insert-mode
#spell
#editing
#config
How do I insert special characters like arrows, math symbols, or accented letters in Vim?
Vim has a built-in digraph system that lets you type special characters using short two-character codes.
category:
editing
tags:
#editing
#insert-mode
#unicode
#special-characters
How do I move lines to a different position without using yank and paste?
The :move command (abbreviated :m) relocates lines to a new position in the buffer without touching any registers.
category:
editing
tags:
#ex-commands
#editing
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 fix the indentation of a code block without affecting surrounding code?
When editing code with messy indentation — after a paste, a merge conflict, or a refactor — you often need to fix just one block rather than the entire file
category:
editing
tags:
#editing
#indentation
#text-objects
#formatting
How do I move all lines matching a pattern to the top or bottom of a file?
The :global command combined with :move lets you restructure a file by relocating all lines that match a pattern.
category:
editing
tags:
#ex-commands
#editing
#text-objects
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 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 quickly re-insert the text I just typed without leaving insert mode?
While in insert mode, pressing re-inserts whatever text you typed during your previous insert session.
category:
editing
tags:
#insert-mode
#editing
#registers
#repeat
How do I copy a character from the line above or below while in insert mode?
When typing in insert mode, you can pull individual characters from adjacent lines without leaving insert mode.
category:
editing
tags:
#insert-mode
#editing
#completion
How do I increase or decrease indentation while staying in insert mode?
<C-t> and <C-d> in insert mode
When typing in insert mode, you can adjust the current line's indentation without leaving to normal mode.
category:
editing
tags:
#insert-mode
#indentation
#editing
#formatting
How do I indent or dedent the current line without leaving insert mode?
When you're typing in insert mode and realize the current line needs more or less indentation, you don't have to leave insert mode to fix it.
category:
editing
tags:
#insert-mode
#indentation
#editing
#formatting
How do I create custom folds to collapse specific sections of code?
Vim supports several fold methods, but manual folding with zf gives you precise control over exactly which lines to collapse.
category:
editing
tags:
#folding
#normal-mode
#visual-mode
#editing
How do I run commands without disturbing my marks?
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
category:
editing
tags:
#editing
#marks
#ex-commands
#scripting
How do I run a single normal-mode command without leaving insert mode?
While typing in insert mode, you sometimes need to do a quick normal-mode action — center the screen, jump to a mark, or delete a word backward.
category:
editing
tags:
#insert-mode
#normal-mode
#editing
#motions
How do I edit a binary file in hex mode using Vim?
Vim can serve as a hex editor by piping buffer contents through xxd, a hex dump utility that ships with Vim.
category:
editing
tags:
#editing
#binary
#ex-commands
#filters