How do I match a pattern only when it is preceded or followed by another pattern, without including that context in the match?
\@=
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ family of atoms.
795 results for "G"
\@=
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ family of atoms.
:normal! {cmds}
:normal {cmds} executes normal-mode keystrokes from the command line, but it honors your custom key mappings — so remapped keys produce unexpected results in
command-line #ex-commands #macros #normal-mode #command-line
matchadd()
The matchadd() function adds a persistent highlight for a pattern in the current window without touching your search register or interfering with n/N navigation
:s/pattern/~/
In a Vim substitution, using ~ as the replacement string repeats the replacement text from the most recent :s command.
:wincmd {cmd}
:wincmd {key} is the Ex command equivalent of every {key} window shortcut.
buffers-windows #buffers-windows #windows #ex-commands #normal-mode
vim.ui.select() and vim.ui.input()
Neovim provides vim.
:lvimgrepadd /pattern/gj **/*
When investigating a bug or refactor, you often need to gather results from several related patterns before deciding what to edit.
:cfdo %s/old/new/ge | update
When you grep across your project and want to perform a search-and-replace on every file that matched, :cfdo is the most efficient approach.
command-line #quickfix #substitute #search #ex-commands #editing
:let @q = "dd"
Macros are just strings stored in named registers.
:set diffopt+=linematch:60
Neovim's linematch diffopt enables intra-line diff highlighting — instead of marking an entire changed line, Neovim highlights only the specific characters th
vim.iter()
vim.
:bprev
The :bprev (or :bp for short) command switches to the previous buffer in Vim's buffer list.
:%s/old/new/gc
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
:noautocmd write
The :noautocmd modifier (abbreviated :noa) runs any subsequent Ex command while temporarily disabling all autocommand events.
grn, gra, grr, gri
Starting with Neovim 0.
:set winfixwidth
Setting winfixwidth on a window tells Vim not to adjust its width when other windows are created, closed, or resized with =.
[<C-d>
Vim's [ command jumps to the first definition of the macro or identifier under the cursor, searching from the beginning of the current file and through any file
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
<C-v>$A
When you need to append text to the end of several lines that have different lengths, visual block mode with $ is the key.
<C-r>-
In insert mode, - pastes the contents of the small delete register ("-).