How do I configure Vim's completion menu to show a popup without auto-selecting the first candidate?
:set completeopt=menuone,noselect
By default, Vim's and completion can auto-insert the first match, or only show a menu when there are multiple matches.
category:
config
tags:
#config
#completion
#insert-mode
How do I paste from a register in insert mode without Vim interpreting special characters?
In insert mode, {reg} pastes from a register but treats certain bytes as key inputs — so a register containing \n triggers a newline, \x08 triggers backspace,
category:
registers
tags:
#registers
#insert-mode
#editing
#paste
How do I load multiple files matching a pattern into Vim for batch editing?
The :args command populates Vim's argument list with files matching a glob pattern, turning any set of files into a navigable list and enabling project-wide bat
category:
buffers-windows
tags:
#buffers
#ex-commands
#editing
#navigation
How do I open the alternate (previously visited) buffer in a new split window?
Vim tracks the alternate buffer — the last file you were editing before the current one.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#windows
How do I anchor a Vim search pattern to match only at the very start or end of the entire file?
Vim's ^ and $ anchors match the start and end of a line, but sometimes you need to match the very beginning or very end of the entire buffer.
category:
search
tags:
#search
#regex
#ex-commands
How do I show a visual fold depth indicator in the Vim gutter?
Setting foldcolumn to a non-zero value adds a narrow column on the left side of each window that visually represents the fold structure of your file.
category:
config
tags:
#folding
#config
#navigation
How do I execute Lua code directly from the Neovim command line without writing a script file?
Neovim's :lua command lets you run arbitrary Lua code inline from the command line.
category:
command-line
tags:
#command-line
#lua
#neovim
#vimscript
#advanced
How do I open a file by name without knowing its full path?
The :find command searches for a file by name across all directories listed in Vim's path option, so you can open files without typing full paths.
category:
navigation
tags:
#navigation
#ex-commands
#buffers
#editing
How do I control which number formats Vim uses when incrementing and decrementing with Ctrl-A and Ctrl-X?
The nrformats option tells Vim how to interpret numbers when you press (increment) or (decrement).
category:
config
tags:
#config
#editing
#increment
#numbers
#normal-mode
How do I diff the current file against a specific git commit using vim-fugitive?
vim-fugitive's :Gdiffsplit opens a vertical split showing the current file diff against any git revision — not just HEAD.
category:
plugins
tags:
#plugins
#diff
#git
#buffers-windows
How do I define w!! to save a root-owned file without reopening Vim?
cnoreabbrev w!! w !sudo tee > /dev/null %
When you forget to open a file with elevated privileges, quitting and reopening can break your flow.
category:
command-line
tags:
#command-line
#abbreviations
#sudo
#write
#workflow
How do I save a file and automatically create missing parent directories in Neovim?
Neovim's :w ++p flag automatically creates any missing intermediate directories when writing a file.
category:
command-line
tags:
#command-line
#neovim
#file-handling
#workflow
How do I open the previous file I was editing in a split window?
In Vim, # is a special filename that always refers to the alternate file — the most recently active buffer before the current one.
category:
buffers-windows
tags:
#buffers
#windows
#navigation
#editing
How do I insert the result of a calculation directly while typing in insert mode?
The expression register (=) in insert mode lets you evaluate any Vimscript expression and insert the result inline.
category:
editing
tags:
#editing
#expression
#insert-mode
#calculator
How do I launch a GDB session in Vim with the built-in termdebug plugin?
:packadd termdebug | Termdebug
For quick debugging without leaving Vim, the built-in termdebug plugin wires a GDB session directly into your editing workflow.
category:
plugins
tags:
#plugins
#debugging
#workflow
#terminal
How do I create a macro that repeats itself automatically until there is nothing left to process?
A recursive macro calls itself at the end of its own definition, causing it to run repeatedly until Vim hits an error — such as reaching the end of the file o
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I write and edit a macro as text instead of recording it live?
Write keystrokes in buffer, then "qy$
Instead of recording a macro in real-time (where mistakes mean starting over), you can write the keystrokes as text in a buffer, edit them visually, and then ya
category:
macros
tags:
#macros
#editing
#registers
#workflow
#best-practices
How do I highlight trailing whitespace with a custom color in Vim?
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
category:
config
tags:
#editing
#formatting
#search
How do I open the file whose name is under the cursor in a new tab?
gf reads the filename under the cursor and opens it in a new tab page, keeping your current buffer untouched.
category:
navigation
tags:
#navigation
#buffers-windows
#tabs
How do I replay the last executed macro with a single key in Neovim?
In Neovim, the Q key is mapped to replay the last executed macro — the same as @@ in both Vim and Neovim.
category:
macros
tags:
#macros
#neovim
#normal-mode