How do I view the first macro or keyword definition without leaving my current position?
The [d command searches from the beginning of the file for the first line matching the define pattern for the word under the cursor, and displays it in the stat
category:
search
tags:
#search
#navigation
#normal-mode
How do I jump directly to a specific tab page by its number in Vim?
Prefixing gt (go to next tab) with a count jumps directly to the tab page at that position.
category:
buffers-windows
tags:
#tabs
#buffers-windows
#navigation
#normal-mode
How do I jump to the beginning of the next word?
The w command moves the cursor forward to the beginning of the next word.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I scroll up half a page in Vim?
The (Ctrl+u) command scrolls the window up by half a screen, moving the cursor along with it.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I duplicate the current line and place the copy directly below it?
The :t (short for :copy) command copies lines from one location to another.
category:
editing
tags:
#editing
#ex-commands
#normal-mode
How do I maximize a window to full height or make all windows equal size?
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.
category:
buffers-windows
tags:
#windows
#buffers
#navigation
#normal-mode
How do I group regex atoms in Vim without creating a backreference?
In Vim's regex engine, \( and \) create a capturing group whose contents are stored in \1, \2, etc.
category:
search
tags:
#search
#regex
#ex-commands
#normal-mode
How do I indent all lines from the cursor to the matching closing bracket in Vim?
Vim's > operator (indent) works with any motion or text object — including %, which jumps to the bracket, parenthesis, or brace matching the one under the cur
category:
editing
tags:
#editing
#indentation
#text-objects
#normal-mode
#motions
How do I create a self-repeating macro that runs until there is nothing left to process?
@q (inside macro recording)
A recursive macro calls itself as its last action, causing it to repeat indefinitely until it hits an error (like reaching end of file or failing a search).
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I select the contents inside curly braces?
The vi{ command visually selects everything inside the nearest pair of curly braces {}, without selecting the braces themselves.
category:
visual-mode
tags:
#visual-mode
#text-objects
#editing
#normal-mode
How do I jump to the enclosing curly brace or parenthesis in code?
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
category:
navigation
tags:
#navigation
#motions
#editing
#normal-mode
What is the difference between ' and ` when jumping to a mark in Vim?
Vim provides two distinct ways to jump to a mark, and they behave differently: the apostrophe ' jumps to the first non-blank character of the marked line, while
category:
navigation
tags:
#marks
#navigation
#normal-mode
How do I highlight a pattern without executing a search or moving the cursor?
Assigning a string directly to the search register @/ with :let causes Vim to highlight all matches (if hlsearch is enabled) without performing a search or movi
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I show both the absolute line number on the current line and relative numbers on all other lines?
:set number relativenumber
Enabling both number and relativenumber simultaneously activates hybrid line numbering: the current line displays its true absolute line number while every othe
category:
config
tags:
#config
#navigation
#normal-mode
#editing
How do I force a search to be case-sensitive even when ignorecase is enabled?
Adding \C anywhere in a search pattern forces case-sensitive matching for that search, overriding the global ignorecase setting.
category:
search
tags:
#search
#normal-mode
#case
How do I set up a local leader key for file-type-specific mappings that don't conflict with global mappings?
:let maplocalleader = ','
Vim provides two separate leader keys: (global) and (local to the current buffer).
category:
config
tags:
#config
#normal-mode
#ex-commands
How do I paste the contents of a register as a new line below the cursor regardless of the register type in Vim?
The :put Ex command always inserts a register's content as a new line below the current line, regardless of whether the register holds characterwise, linewise,
category:
editing
tags:
#registers
#editing
#paste
#ex-commands
#normal-mode
How do I jump between paragraphs in Vim?
The { and } commands move the cursor by paragraph — jumping to the previous or next blank line.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I highlight a custom pattern in the current window without affecting the search register?
:call matchadd('ErrorMsg', 'TODO')
matchadd() lets you highlight arbitrary patterns using any highlight group — without touching the search register or search highlighting.
category:
config
tags:
#search
#config
#normal-mode
How do I re-indent the entire paragraph under my cursor to match the surrounding code?
The =ip command combines Vim's auto-indent operator (=) with the inner paragraph text object (ip) to re-indent every line in the current paragraph in a single k
category:
editing
tags:
#editing
#indentation
#text-objects
#normal-mode