How do I make Vim display partial key sequences and selected character counts in real time?
The showcmd option makes Vim display the currently-typed command in the bottom-right corner of the screen, giving you live feedback as you build up key sequence
category:
config
tags:
#config
#normal-mode
#visual-mode
How do I edit an existing macro without re-recording it from scratch?
When a recorded macro contains a typo or needs a small tweak, you can modify it directly via the :let command rather than re-recording the entire sequence.
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I edit a recorded macro in Vim?
Vim stores macros in registers, which means you can paste a macro's contents into a buffer, edit it as regular text, and yank it back into the register.
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I run commands automatically when certain events occur?
:autocmd Event pattern command
Autocommands let you execute commands automatically in response to events like opening a file, saving, or changing buffers.
category:
command-line
tags:
#command-line
#config
#ex-commands
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
How do I copy from the cursor to the end of the line?
The y$ command yanks (copies) text from the cursor position to the end of the line.
category:
editing
tags:
#editing
#normal-mode
How do I create a custom key mapping?
The :nnoremap command creates a non-recursive normal mode mapping.
category:
config
tags:
#config
#ex-commands
How do I create a new empty buffer?
The :enew command creates a new unnamed empty buffer in the current window.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
How do I move backward to the end of the previous word?
The ge motion moves the cursor backward to the end of the previous word.
category:
navigation
tags:
#navigation
#motions
#normal-mode
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 search for a pattern that spans multiple lines in Vim?
Vim's regular expressions support multi-line matching through underscore-prefixed atoms.
category:
search
tags:
#search
#regex
#multiline
#patterns
How do I use POSIX character classes in Vim search patterns?
Vim supports POSIX character classes inside bracket expressions, providing a portable and readable way to match categories of characters.
category:
search
tags:
#search
#regex
#character-classes
#posix
How do I cycle through my jump history in Vim?
Vim maintains a jump list of positions you have visited.
category:
navigation
tags:
#navigation
#motions
#normal-mode
What is the difference between 0 and ^ for moving to the beginning of a line?
Vim has two distinct motions for moving to the start of a line: 0 goes to column 1 (the absolute start), while ^ goes to the first non-blank character.
category:
navigation
tags:
#navigation
#motions
#line-navigation
#indentation
How do I revert a file to its state from a specific time ago?
:earlier {time} / :later {time}
Vim's :earlier and :later commands let you navigate the undo history by wall-clock time rather than by individual undo steps.
category:
editing
tags:
#editing
#undo-redo
#ex-commands
#advanced
#productivity
How do I search for visually selected text?
To search for the exact text you have selected in visual mode, yank it and paste it into the search prompt.
category:
search
tags:
#search
#visual-mode
#registers
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 automatically equalize window sizes when the terminal is resized?
:autocmd WinResized * wincmd =
When you resize your terminal window, Vim's split layout can become unbalanced.
category:
buffers-windows
tags:
#buffers-windows
#autocmd
#resize
#layout
How do I make a buffer completely read-only and unmodifiable?
While :set readonly prevents accidental writes, nomodifiable goes further by preventing any changes to the buffer contents entirely.
category:
buffers-windows
tags:
#buffers-windows
#readonly
#modifiable
#protection
How do I view or manipulate the search pattern register in Vim?
The / register holds the most recent search pattern.
category:
registers
tags:
#registers
#search
#pattern
#special-registers