How do I run the same normal mode command on every line in a range?
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
category:
command-line
tags:
#editing
#ex-commands
#normal-mode
#productivity
#ranges
How do I paste the current filename into the buffer?
The % register in Vim always contains the name of the current file.
category:
registers
tags:
#registers
#editing
#insert-mode
#productivity
#filename
How do I paste the text I just typed in insert mode?
The ".
category:
registers
tags:
#registers
#editing
#insert-mode
#normal-mode
#productivity
How do I send the contents of my buffer to a shell command without replacing the text?
The :w !{cmd} command writes the buffer contents to the stdin of an external shell command without modifying the buffer or saving to disk.
category:
command-line
tags:
#command-line
#ex-commands
#shell
#editing
#productivity
How do I filter buffer contents through an external shell command?
The :%!{cmd} command pipes the entire buffer through an external shell command and replaces the buffer contents with the command's output.
category:
command-line
tags:
#editing
#ex-commands
#shell
#filtering
#productivity
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 visually select the next occurrence of my last search pattern?
The gn motion searches forward for the next match of the last search pattern and visually selects it.
category:
search
tags:
#navigation
#search
#motions
#normal-mode
#repeat
#editing
How do I insert special characters like ©, ±, or → without leaving Vim?
Vim has a built-in digraph system that lets you insert hundreds of special characters by typing two-character mnemonics.
category:
editing
tags:
#editing
#insert-mode
#special-characters
#unicode
#productivity
How do I paste from a register while staying in insert mode?
Pressing followed by a register name in insert mode inserts the contents of that register at the cursor position without leaving insert mode.
category:
registers
tags:
#editing
#insert-mode
#registers
#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 join multiple lines together with a custom separator like a comma?
Vim's J command joins lines with a single space, but sometimes you need a custom separator like a comma, pipe, or semicolon.
category:
editing
tags:
#editing
#ex-commands
#visual-mode
#substitution
#lines
How do I auto-complete words in insert mode without any plugins?
Vim has a powerful built-in completion system that requires zero plugins.
category:
editing
tags:
#editing
#insert-mode
#completion
#productivity
How do I use a macro to generate a numbered list automatically?
By recording a macro that duplicates a line and increments its number, you can generate a numbered list of any length with a single replay command.
category:
macros
tags:
#macros
#editing
#normal-mode
#automation
#productivity
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 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 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 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 cycle through my previous deletions to find the one I want to paste?
Vim stores your last 9 deletions (of one line or more) in the numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
#paste
How do I delete or change an entire paragraph of text in one motion?
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#delete
#motions
How do I quickly delete all the arguments inside a function call?
The di( command deletes everything inside the nearest pair of parentheses without removing the parentheses themselves.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#delete
#code