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 jump to a specific percentage position in a file?
The {N}% command jumps the cursor to the line that is N percent of the way through the file.
category:
navigation
tags:
#navigation
#motions
#normal-mode
#productivity
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
What is the location list and how does it differ from the quickfix list?
The location list is a per-window variant of the quickfix list.
category:
buffers-windows
tags:
#navigation
#quickfix
#ex-commands
#windows
#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
How do I delete all lines that do NOT match a pattern?
The :v command (short for :vglobal) is the inverse of :g — it executes a command on every line that does not match the given pattern.
category:
command-line
tags:
#editing
#ex-commands
#search
#filtering
#productivity
What is the difference between backtick and single quote when jumping to marks?
Vim offers two ways to jump to a mark, and the difference is crucial: the backtick (` `) jumps to the exact line and column where the mark was set, while the si
category:
navigation
tags:
#navigation
#marks
#motions
#normal-mode
How do I execute the current line as a shell command and insert the output?
The :.
category:
command-line
tags:
#editing
#ex-commands
#shell
#filtering
#productivity
How do I do math calculations without leaving insert mode?
The expression register (=) lets you evaluate Vimscript expressions on the fly and insert the result directly into your text.
category:
registers
tags:
#editing
#insert-mode
#registers
#productivity
#math
How do I paste the result of a calculation or expression in normal mode?
The expression register ("=) lets you evaluate any Vimscript expression and paste the result directly into your buffer from normal mode.
category:
registers
tags:
#registers
#editing
#normal-mode
#productivity
#math
How do I autocomplete file paths while typing in insert mode?
The command triggers filename completion in insert mode.
category:
editing
tags:
#editing
#insert-mode
#completion
#file-management
#productivity
How do I set different options for different programming languages in Vim?
autocmd FileType {lang} setlocal {options}
Vim's autocmd FileType lets you apply settings that only take effect when editing a specific file type.
category:
config
tags:
#config
#autocmd
#filetype
#indentation
#vimrc
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