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 a newline in the replacement string of a :s substitution?
In Vim's :substitute command, \r in the replacement string inserts a literal newline — it splits the line at that point.
category:
search
tags:
#search
#editing
#ex-commands
#normal-mode
How do I suppress noisy search count messages while keeping search behavior unchanged?
Vim's search count feedback ([3/27]) is useful until it starts flooding the command area during rapid navigation.
category:
search
tags:
#search
#config
#command-line
#ui
How do I search backward for the word under the cursor?
The # command searches backward for the exact word under the cursor, jumping to the previous occurrence.
category:
search
tags:
#search
#navigation
#normal-mode
How do I split a line by inserting a newline with the substitute command?
In Vim's substitute command, use \r (not \n) in the replacement to insert a real newline.
category:
editing
tags:
#editing
#search
#ex-commands
#substitution
How do I highlight all occurrences of a yanked word without typing a search pattern?
After yanking text, you can promote it directly to the search register with :let @/ = @".
category:
registers
tags:
#registers
#search
#hlsearch
#normal-mode
How do I replace the next search match and repeat it easily with dot?
The cgn command combines the change operator with the gn motion to change the next occurrence of your last search pattern.
category:
editing
tags:
#editing
#search
#repeat
#normal-mode
#productivity
How do I replace text with a newline in a substitute command?
In the replacement part of :s, \r inserts a newline.
category:
search
tags:
#search
#editing
#ex-commands
How do I jump through several annotation keywords with one search command?
When you triage code, jumping among TODO, FIXME, and BUG markers quickly is often more useful than searching each token separately.
category:
search
tags:
#search
#regex
#navigation
#normal-mode
How do I make Tab and Enter behave differently when the completion popup menu is open?
The pumvisible() function returns 1 when the insert-mode completion popup menu (pum) is visible, and 0 otherwise.
category:
config
tags:
#config
#insert-mode
#completion
How do I create a Neovim mapping that runs an Ex command without entering command-line mode or changing the current mode?
The pseudo-key in Neovim allows a mapping to execute an Ex command directly, without going through command-line mode.
category:
config
tags:
#config
#neovim
#normal-mode
#visual-mode
How do I open an existing buffer in a new split window?
The :sb (short for :sbuffer) command opens a buffer that is already loaded in Vim in a new horizontal split window.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
How do I programmatically remove or unmap a keybinding in Neovim Lua without knowing its original definition?
vim.
category:
config
tags:
#config
#neovim
#mappings
#lsp
#normal-mode
How do you rearrange tab order in Vim?
Use :tabmove N to move the current tab after tab N.
category:
buffers-windows
tags:
#tabs
#move
#reorder
How do I search for the contents of a register without typing the pattern manually?
Vim's search register (@/) holds the current search pattern — the same one used by n, N, *, and hlsearch highlighting.
category:
registers
tags:
#registers
#search
#normal-mode
#ex-commands
How do I set the search pattern to the current word literally without executing a search in Vim?
:let @/ = '\V' . escape(expand('<cword>'), '\')
This pattern lets you prepare a precise search target without jumping the cursor or triggering an immediate search motion.
category:
search
tags:
#search
#registers
#patterns
#command-line
How do I search for a pattern only within specific columns of a line?
How it works Vim's search patterns support column position constraints using the \%c family of atoms.
category:
search
tags:
#search
#ex-commands
#normal-mode
How do I load the search register with a literal <cword> pattern?
:let @/ = '\V' .. escape(expand('<cword>'), '\\')
Sometimes * is too opinionated: it uses keyword boundaries and interprets regex metacharacters.
category:
search
tags:
#search
#registers
#ex-commands
#regex
#navigation
How do I search literally for the exact text I yanked last?
:let @/ = '\V' . escape(@0, '\')
When the text you yank contains regex characters, a normal / search can produce noisy or surprising matches.
category:
registers
tags:
#registers
#search
#regex
#command-line
How do I run a :g or :s command without overwriting my current search pattern?
Whenever Vim runs a command that involves searching — :g, :s, :v, or even moving the cursor with / — it overwrites the last search register (@/).
category:
search
tags:
#search
#ex-commands
#macros