How do I open the command-line window mid-command to edit it with full Vim capabilities?
<C-f> (in command-line mode)
When you're already on the Vim command line and realize you need complex edits — inserting text from multiple positions, reordering arguments, or referencing
category:
command-line
tags:
#command-line
#ex-commands
#editing
How do I switch between split windows in Vim?
The (Ctrl+w Ctrl+w) command cycles the cursor to the next window in the current tab.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#normal-mode
How do I jump back to my previous cursor position?
The (Ctrl+o) command jumps the cursor backward through the jump list, returning you to previous cursor positions.
category:
navigation
tags:
#navigation
#motions
#normal-mode
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 yank and paste a vertical block of text using blockwise registers?
How it works Vim registers remember not just the text content but also the type of selection that was used to yank it: characterwise, linewise, or blockwise.
category:
registers
tags:
#registers
#visual-mode
#editing
How do I center the screen on the cursor line?
The zz command scrolls the window so that the current cursor line appears in the middle of the screen.
category:
navigation
tags:
#navigation
#normal-mode
How do I jump forward through the jump list after going back with Ctrl-O?
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
category:
navigation
tags:
#navigation
#normal-mode
How do I open the command-line window while typing a command on the : prompt?
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
category:
search
tags:
#command-line
#ex-commands
#editing
#normal-mode
How do I make a macro prompt for user input at a specific point during its execution?
<C-r>=input('Enter: ')<CR>
By embedding =input('prompt: ') inside a recorded macro, you can pause the macro at any point to ask for user input and insert the result.
category:
macros
tags:
#macros
#insert-mode
#registers
#editing
How do I add more commands to a macro I already recorded?
If you finish recording a macro and realize you forgot a step, you don't need to re-record the whole thing.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
#productivity
How do I copy a range of lines to another location without yanking and pasting?
The :t command (short for :copy) duplicates lines from one location to another without touching any registers.
category:
command-line
tags:
#editing
#ex-commands
#lines
#productivity
#ranges
How do I land the cursor a few lines above or below a search match?
Vim's search command accepts an offset after the pattern that shifts where the cursor lands relative to the match.
category:
search
tags:
#search
#navigation
#motions
#regex
#advanced
How do I create a temporary scratch buffer for quick notes without saving a file?
:enew | setlocal buftype=nofile bufhidden=wipe noswapfile
A scratch buffer is a temporary, unnamed buffer that exists only in memory — it won't prompt you to save when you close it and leaves no trace on disk.
category:
buffers-windows
tags:
#buffers
#editing
#ex-commands
#productivity
#workflow
How do I switch between buffers without being forced to save first?
By default, Vim refuses to let you switch away from a buffer that has unsaved changes, forcing you to save or discard with :w or :e! before moving on.
category:
config
tags:
#config
#buffers
#vimrc
#productivity
#workflow
How do I autocomplete an entire line based on existing lines in the file?
The command triggers whole-line completion in insert mode.
category:
editing
tags:
#editing
#insert-mode
#completion
#productivity
How do I delete the word before the cursor without leaving insert mode?
Pressing in insert mode deletes the word before the cursor instantly, without requiring you to switch to normal mode.
category:
editing
tags:
#editing
#insert-mode
#delete
#productivity
How do I save a recorded macro permanently so it persists across Vim sessions?
let @a = 'macro_contents'
Recorded macros are stored in registers, which are lost when you quit Vim (unless viminfo saves them).
category:
macros
tags:
#macros
#config
#registers
#vimrc
#productivity
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 expand or shrink a visual selection to the next text object boundary?
v + repeated iw/aw/i(/a(/ip/ap
Once you enter visual mode, you can progressively expand your selection by typing increasingly larger text objects.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#selection
#productivity
How do I get improved % matching for language keywords like if/else/endif in Vim?
The vim-matchup plugin by Andy Massimino is a drop-in replacement for Vim's built-in matchit plugin that supercharges the % key to work with language-specific k
category:
plugins
tags:
#plugins
#matchup
#navigation
#text-objects
#matching