How do I build a macro programmatically using Vimscript instead of recording it?
:call setreg('q', keys, 'c')
The setreg() function writes any string directly into a named register, letting you construct macro keystrokes from Vimscript expressions rather than live recor
category:
macros
tags:
#macros
#registers
#ex-commands
How do I create a self-referential recursive macro that repeats until it fails?
A recursive macro in Vim calls itself at the end of its body, repeating automatically until one of its commands fails.
category:
macros
tags:
#macros
#registers
#advanced
#normal-mode
How do I display the current LSP server progress messages in the Neovim statusline?
vim.
category:
config
tags:
#lsp
#neovim
#config
#statusline
How do I apply a recorded macro to a specific set of files using the argument list?
:argdo execute 'normal @q' | update
:argdo runs an Ex command on every file in Vim's argument list (the arglist).
category:
macros
tags:
#macros
#ex-commands
#editing
How do I open a URL or file from Neovim using the system's default application?
vim.
category:
command-line
tags:
#neovim
#lua
#config
#command-line
How do I jump to a tag in Vim and automatically choose if there is only one match?
Vim's :tjump is the smarter sibling of :tag and :tselect.
category:
navigation
tags:
#navigation
#tags
#ctags
#search
How do I open the command-line window while in the middle of typing a command?
While typing in Vim's command line (after pressing :), pressing opens the command-line window with your current, unfinished command already filled in.
category:
command-line
tags:
#command-line
#ex-commands
#editing
How do I paste a register literally in insert mode without triggering auto-indent or special key handling?
When you press x in insert mode to paste a register, Vim inserts the text "as if you typed it" — meaning autoindent, textwidth, and other insert behaviors can
category:
registers
tags:
#registers
#insert-mode
#editing
How do I search for text I just yanked using the register?
How it works After yanking text, you can use it directly as a search pattern by inserting the yank register contents into the search prompt.
category:
registers
tags:
#registers
#search
#normal-mode
How do I jump back to my previous cursor position?
The (Ctrl+o) command jumps the cursor backward through the jump list, returning you to previous cursor positions.
category:
navigation
tags:
#navigation
#motions
#normal-mode
How do I jump to a tag in a new split window showing all matching tags?
g] splits the window and then runs :tselect for the identifier under the cursor, displaying a numbered list of all matching tags so you can pick the exact defin
category:
buffers-windows
tags:
#navigation
#buffers
#windows
#tags
How do I sort lines by a specific column or field in Vim?
Vim does not have a built-in multi-column sort, but you can leverage the external sort command to sort selected lines by any field.
category:
editing
tags:
#editing
#sorting
#ex-commands
#external-commands
#command-line
How do I insert a literal control character or special key into the command line?
<C-v> (command-line mode)
In command-line mode (after : or /), pressing followed by any key inserts that key literally — bypassing all key notation, mappings, and special interpretatio
category:
command-line
tags:
#command-line
#search
#editing
#insert-mode
How do I scroll the current line to the center or top of the screen and simultaneously move my cursor to the first non-blank character?
Vim has two parallel sets of scroll commands: the well-known zz, zt, zb which reposition the view without moving the cursor, and the lesser-known z.
category:
navigation
tags:
#navigation
#normal-mode
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 run a macro until it can no longer proceed without specifying an exact count?
When you give a large count to a macro — such as 100@a — Vim automatically stops replaying the macro as soon as any step inside it fails.
category:
macros
tags:
#macros
#normal-mode
How do I center the screen on the cursor line?
The zz command scrolls the window so that the current cursor line appears in the middle of the screen.
category:
navigation
tags:
#navigation
#normal-mode
How do I set buffer-local keymaps that only activate when an LSP server attaches to a buffer in Neovim?
vim.api.nvim_create_autocmd('LspAttach', ...)
Setting your LSP keymaps inside a LspAttach autocmd ensures they are only active in buffers where a language server is actually running.
category:
config
tags:
#lsp
#neovim
#config
#autocmd
#keymaps
How do I prevent a macro from stopping when a command fails?
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
category:
macros
tags:
#macros
#error-handling
#ex-commands
#batch-editing
How do I jump forward through the jump list after going back with Ctrl-O?
Every time you make a "jump" — using G, /, %, :tag, , or similar commands — Vim records your position in the jump list.
category:
navigation
tags:
#navigation
#normal-mode