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 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 cursor shape for different Vim modes in the terminal?
Modern terminals support cursor shape changes via escape sequences.
category:
config
tags:
#config
#cursor
#terminal
#visual-feedback
What is the difference between cw and ciw when changing a word?
The cw and ciw commands both change a word, but they behave differently depending on cursor position.
category:
editing
tags:
#editing
#text-objects
#motions
#normal-mode
#productivity
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 change the key that opens Vim's command-line window?
Vim's command-line window is invaluable for editing long : commands, search patterns, and complex substitutions with normal-mode tools.
category:
config
tags:
#config
#command-line
#options
#workflow
How do I fold and unfold sections of code to hide details I'm not working on?
Vim's folding system lets you collapse blocks of code into a single line, hiding the details so you can focus on the structure.
category:
editing
tags:
#editing
#folding
#navigation
#normal-mode
#productivity
How do I run the same Ex command in every open window at once?
:windo {cmd} executes an Ex command in every window in the current tab page, cycling through each one and applying the command before returning focus to the ori
category:
buffers-windows
tags:
#windows
#buffers
#ex-commands
#buffers-windows
How do I visually select a code block enclosed in curly braces including the braces themselves?
The aB text object (around Block) selects everything from the matching { to the closing } — including the braces themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
How do I change the case of selected text in visual mode?
U, u, or ~ in visual mode
How it works When you have text selected in visual mode, you can change its case with three simple keys: U - Convert the entire selection to UPPERCASE u - Conve
category:
visual-mode
tags:
#visual-mode
#editing
#formatting
How do I reopen Vim and jump directly to where I was editing last time?
Pressing '0 in normal mode jumps to the exact cursor position in the most recently edited file, even after closing and reopening Vim.
category:
navigation
tags:
#navigation
#marks
#viminfo
#shada
#sessions
How do I open a scratch split that is not listed and disappears when I close it?
:vnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
For quick throwaway notes, command output cleanup, or temporary edits, a normal buffer is noisy: it appears in :ls, can prompt you to save, and may leave swap a
category:
buffers-windows
tags:
#buffers-windows
#buffers
#windows
#scratch
#workflow
How do I keep concealed text hidden even on the cursor line so Markdown or LaTeX stays formatted while I navigate?
When 'conceallevel' is 2 or higher, Vim hides syntax markers—turning raw Markdown like bold into visual bold or collapsing LaTeX commands.
category:
config
tags:
#config
#formatting
#conceal
#markdown
How do I create a macro that converts lines to a numbered list?
This simple macro inserts a list number prefix at the beginning of each line.
category:
macros
tags:
#macros
#editing
How do I quickly switch between the current file and the last file I was editing?
:e # opens the alternate file — the file you were editing just before the current one.
category:
buffers-windows
tags:
#buffers
#editing
#ex-commands
#navigation
How do you use the alternate file register?
The # register holds the alternate (previously edited) filename.
category:
registers
tags:
#registers
#alternate
#file
How do I record a macro to wrap each line in HTML tags?
qaI<li><Esc>A</li><Esc>jq
This macro wraps each line in tags by inserting the opening tag at the start and appending the closing tag at the end.
category:
macros
tags:
#macros
#editing
How do I edit and reuse previous Ex commands in a full editing buffer?
The command-line window is a special buffer that shows your entire Ex command history and lets you edit entries using the full power of Vim's normal mode before
category:
command-line
tags:
#command-line
#ex-commands
#history
#editing
#productivity
How do you create a custom key mapping in Vim?
nnoremap <leader>s :w<CR>
Use nnoremap for non-recursive normal mode mappings.
category:
config
tags:
#config
#mapping
#nnoremap
How do you use a macro to append a comma to every line?
Record a macro that moves to end of line with A, types a comma, escapes to normal mode, and moves down.
category:
macros
tags:
#macros
#append
#comma