How do I quickly surround a word with quotes, brackets, or parentheses?
Vim doesn't have a built-in "surround" operator, but you can wrap any word in quotes or brackets with a short sequence: ciw""P.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#productivity
#surround
How do I quickly switch between the current file and the last edited file?
Pressing (Ctrl-6 on most keyboards) instantly toggles between the current buffer and the alternate file — the last file you were editing.
category:
buffers-windows
tags:
#navigation
#buffers
#normal-mode
#productivity
#windows
How do I toggle the case of an entire word in Vim?
The g~iw command toggles the case of every character in the word under the cursor — uppercase letters become lowercase and vice versa.
category:
editing
tags:
#editing
#text-objects
#case
#normal-mode
How do I navigate undo branches to recover changes that were overwritten by a new edit?
Vim doesn't have a simple linear undo stack — it maintains a full undo tree with branches.
category:
editing
tags:
#editing
#undo-redo
#normal-mode
#advanced
#productivity
How do I change the same column of text across multiple lines at once?
<C-v>jjc replacement<Esc>
Visual block mode's change command lets you replace a rectangular column of text across multiple lines in a single operation.
category:
visual-mode
tags:
#editing
#visual-mode
#block-mode
#normal-mode
#productivity
How do I scroll the screen so the current line is at the top?
The zt command repositions the viewport so that the line where your cursor sits moves to the top of the screen, without changing your cursor position within the
category:
navigation
tags:
#navigation
#scrolling
#normal-mode
#viewport
#productivity
How do I execute a single normal mode command without leaving insert mode?
Pressing in insert mode lets you execute one normal mode command and then automatically returns you to insert mode.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
#productivity
How do I see spelling correction suggestions for a misspelled word?
When spell checking is enabled, the z= command opens a numbered list of spelling suggestions for the misspelled word under the cursor.
category:
editing
tags:
#editing
#spell-check
#normal-mode
#productivity
#prose
How do I search for the word under the cursor without whole-word boundaries?
The g command searches forward for the text under the cursor without adding word boundary anchors.
category:
search
tags:
#search
#navigation
#normal-mode
#motions
#productivity
How do I create a macro that runs itself repeatedly until it fails?
A recursive macro calls itself at the end of its recording, creating a loop that repeats until a motion or command fails (like reaching the end of the file or f
category:
macros
tags:
#macros
#editing
#normal-mode
#automation
#advanced
How do I repeat the last f, t, F, or T character search on a line?
After using f, t, F, or T to jump to a character on the current line, pressing ; repeats the same search in the same direction, and , repeats it in the opposite
category:
navigation
tags:
#navigation
#motions
#normal-mode
#editing
#productivity
How do I repeat the last Ex command I ran?
The @: command re-executes the most recently run Ex command (any command starting with :).
category:
command-line
tags:
#command-line
#ex-commands
#repeat
#normal-mode
#productivity
How do I repeat the last substitute command quickly?
The & command in normal mode repeats the last :s substitution on the current line.
category:
search
tags:
#search
#substitution
#ex-commands
#repeat
#normal-mode
How do I overwrite existing text character by character without deleting first?
Replace mode lets you type over existing text one character at a time, like the "Insert" key behavior in traditional editors.
category:
editing
tags:
#editing
#normal-mode
#insert-mode
#replace
How do I jump back to where I last inserted text and continue typing?
The gi command moves the cursor to the position where you last exited insert mode and immediately enters insert mode again.
category:
navigation
tags:
#navigation
#insert-mode
#marks
#normal-mode
#productivity
How do I jump back to where I last made an edit?
The g; and g, commands let you navigate Vim's changelist — a per-buffer history of every position where you made a change.
category:
navigation
tags:
#navigation
#changelist
#editing
#normal-mode
#marks
How do I quickly jump between function or method definitions in code?
The ]] and [[ commands let you jump forward and backward between section boundaries, which in most programming languages correspond to function or method defini
category:
navigation
tags:
#navigation
#motions
#normal-mode
#code
#functions
What is the difference between :map and :noremap, and why should I use non-recursive mappings?
:nnoremap / :inoremap / :vnoremap
Vim has two types of key mappings: recursive (:map, :nmap, :imap) and non-recursive (:noremap, :nnoremap, :inoremap).
category:
config
tags:
#config
#mappings
#normal-mode
#insert-mode
#vimrc
How do I run the same normal mode command on every line in a range?
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
category:
command-line
tags:
#editing
#ex-commands
#normal-mode
#productivity
#ranges
How do I open a file path that appears in my code without manually typing it?
The gf command ("go to file") opens the file whose path is under the cursor.
category:
navigation
tags:
#navigation
#normal-mode
#buffers
#productivity
#file-management