How do I add custom markers or icons in Vim's sign column next to specific lines without any plugins?
:sign define and :sign place
Vim's built-in sign system lets you define custom symbols and place them in the sign column — the narrow gutter to the left of line numbers.
category:
command-line
tags:
#command-line
#ex-commands
#vimscript
How do I search for an exact multi-word phrase or special text I've selected?
In normal mode, searches for the word under the cursor with word-boundary anchors.
category:
search
tags:
#search
#visual-mode
#navigation
How do I split a complex Vim macro into reusable subroutines?
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
category:
macros
tags:
#macros
#registers
#editing
How do I delete text from the cursor to the next occurrence of a pattern?
Vim lets you use a / search as a motion for any operator.
category:
editing
tags:
#editing
#search
#motions
#delete
#normal-mode
How do I run a recorded macro on every line in a range without using a count?
The :normal command executes normal-mode keystrokes on each line in a range — including macro playback.
category:
macros
tags:
#macros
#ex-commands
#normal-mode
#editing
How do I define key mappings in Neovim using Lua instead of the old Vimscript API?
vim.
category:
config
tags:
#config
#macros
#normal-mode
How do I insert the filename under the cursor directly into the command line?
While typing a command, inserts the filename under the cursor in the buffer at the command-line prompt.
category:
command-line
tags:
#command-line
#navigation
#editing
How do I list all possible completions for the current command-line entry in Vim?
Pressing in Vim's command line displays the full list of matching completions below the command prompt, without cycling through them one at a time.
category:
command-line
tags:
#command-line
#completion
#ex-commands
#navigation
How do I set a different working directory for each split window in Vim?
:lcd (local cd) sets the working directory for the current window only, leaving other windows at their previous directory.
category:
buffers-windows
tags:
#buffers-windows
#navigation
#ex-commands
#config
How do I insert a Unicode character by its code point in Vim?
In insert mode, followed by u and a 4-digit hex code inserts the Unicode character with that code point.
category:
editing
tags:
#editing
#unicode
#insert-mode
#special-characters
How do I call a Lua function or evaluate a Lua expression from within Vimscript in Neovim?
luaeval('lua_expression')
When you have existing Vimscript code that needs to reach into Neovim's Lua ecosystem, luaeval() is the bridge.
category:
config
tags:
#neovim
#config
#vimscript
#lua
How do I quickly switch between the current file and the last edited file?
Pressing (Ctrl-6 on most keyboards) instantly toggles between the current buffer and the alternate file — the last file you were editing.
category:
buffers-windows
tags:
#navigation
#buffers
#normal-mode
#productivity
#windows
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 change the cursor shape to a thin bar in insert mode and a block in normal mode in Neovim?
:set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20
Neovim's guicursor option lets you assign a distinct cursor shape and style to each mode, providing immediate visual feedback about which mode you are in.
category:
config
tags:
#config
#normal-mode
#insert-mode
#visual-mode
How do I insert the same text at the start (or end) of multiple lines simultaneously?
<C-v>{motion}I{text}<Esc>
Visual block mode () lets you select a rectangular region across multiple lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I run a macro on every line in the file silently, ignoring errors on lines where the macro fails?
Combining :silent!, the % range, and :normal @q gives you a powerful pattern for applying a macro across an entire file while gracefully skipping lines that don
category:
macros
tags:
#macros
#editing
#ex-commands
#normal-mode
How do I prevent duplicate autocommands when reloading vimrc?
augroup name | autocmd! | ... | augroup END
Using augroup with autocmd! inside prevents duplicate autocommands from accumulating when you reload your vimrc.
category:
config
tags:
#config
#command-line
#ex-commands
How do I move the current line up or down without cutting and pasting?
The :m (move) command relocates lines to a new position in the file without using registers.
category:
editing
tags:
#editing
#ex-commands
#lines
#productivity
#mappings
How do I convert selected text to uppercase?
In visual mode, pressing U converts all selected text to uppercase.
category:
visual-mode
tags:
#visual-mode
#editing