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 enable relative line numbers in Vim?
The :set relativenumber command displays line numbers relative to the cursor position instead of absolute line numbers.
category:
config
tags:
#config
#navigation
#normal-mode
How do I paste the last Ex command I ran into my buffer?
The : register holds the most recently executed Ex command.
category:
registers
tags:
#registers
#ex-commands
#normal-mode
#productivity
How do I create a recursive macro that repeats itself until it fails?
A recursive macro calls itself at the end of its sequence, creating a loop that automatically repeats until a motion or command fails (such as hitting the last
category:
macros
tags:
#macros
#editing
#normal-mode
#registers
How do I hard-wrap or reformat a paragraph to fit the current textwidth?
The gq{motion} operator reformats text to fit within Vim's textwidth setting, inserting hard line breaks where lines are too long.
category:
editing
tags:
#editing
#formatting
#motions
#normal-mode
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 view the list of positions where I made edits in Vim?
How it works Vim maintains a change list that records the position of every change you make to a buffer.
category:
navigation
tags:
#navigation
#ex-commands
#normal-mode
How do I use a count prefix in a custom Vim mapping where no count defaults to 1?
The v:count1 variable holds the count typed before a command, defaulting to 1 if no count was given.
category:
macros
tags:
#macros
#vimscript
#mappings
#normal-mode
How do I position the cursor at a specific character offset from a search match?
Vim's search command supports an offset suffix that controls where the cursor lands after a match.
category:
search
tags:
#search
#navigation
#motions
#normal-mode
How do I customize which invisible characters are shown in list mode, including trailing spaces and off-screen indicators?
The listchars option controls exactly which invisible characters Vim highlights when list mode is active.
category:
config
tags:
#config
#editing
#formatting
#normal-mode
How do I close the current window in Vim?
The c (Ctrl+w then c) command closes the current window without closing the buffer it contains.
category:
buffers-windows
tags:
#buffers-windows
#windows
#normal-mode
How do I search for text I just yanked using the register?
How it works After yanking text, you can use it directly as a search pattern by inserting the yank register contents into the search prompt.
category:
registers
tags:
#registers
#search
#normal-mode
How do I move to the diagonally opposite corner of a blockwise visual selection?
In Visual-Block mode (), pressing O moves the cursor to the diagonally opposite corner of the rectangular selection.
category:
visual-mode
tags:
#visual-mode
#editing
#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 use a named mark as a motion target for operators like delete, yank, or indent in Vim?
Named marks are not just jump destinations — they serve as motion targets for any operator.
category:
navigation
tags:
#navigation
#marks
#editing
#motions
#normal-mode
How do I scroll the current line to the center or top of the screen and simultaneously move my cursor to the first non-blank character?
Vim has two parallel sets of scroll commands: the well-known zz, zt, zb which reposition the view without moving the cursor, and the lesser-known z.
category:
navigation
tags:
#navigation
#normal-mode
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 move the cursor to the middle or bottom of the visible screen?
M to move to the middle, L to move to the bottom
How it works Vim offers three commands to jump the cursor to specific vertical positions on the visible screen without scrolling: H moves to the top of the scre
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I run a macro until it can no longer proceed without specifying an exact count?
When you give a large count to a macro — such as 100@a — Vim automatically stops replaying the macro as soon as any step inside it fails.
category:
macros
tags:
#macros
#normal-mode