How do I use a Vim expression as the replacement string in a :s substitution?
:s/pattern/\=expr/g
Vim's :s command normally replaces matches with a literal string.
command-line #search #editing #ex-commands #command-line #registers
870 results for "it at"
:s/pattern/\=expr/g
Vim's :s command normally replaces matches with a literal string.
command-line #search #editing #ex-commands #command-line #registers
:stopinsert
:stopinsert is an Ex command that immediately exits insert (or replace) mode and returns to normal mode.
command-line #insert-mode #ex-commands #autocommands #normal-mode
[i
Pressing [i in normal mode displays the first line above the cursor (including included files) that contains the keyword under the cursor.
:let @a = @"
Vim's :let command lets you read and write register contents as strings, making it possible to copy, combine, or modify register values without ever leaving the
/pattern/+N or /pattern/-N
Vim's search command accepts an offset that places your cursor on a line relative to the match.
:s/\%Vfoo/bar/
The \%V atom in Vim's regex engine matches only within the area of the last visual selection.
search #search #visual-mode #substitute #advanced #ex-commands
:retab
How it works The :retab command replaces all tab characters in the current buffer with the appropriate number of spaces, based on your current tabstop and expan
<C-t> and <C-d> in insert mode
When typing in insert mode, you can adjust the current line's indentation without leaving to normal mode.
r{char}
The r{char} command replaces the character under the cursor with {char} without ever entering insert mode.
:packadd termdebug
Vim ships with a built-in termdebug plugin that integrates GDB directly into the editor.
set completeopt+=popup
Adding popup to completeopt makes Vim display extra information — such as function signatures or documentation — for the currently highlighted completion it
iW vs iw
Vim has two flavors of the "inner word" text object that are easy to confuse: iw (lowercase) and iW (uppercase).
:cdo normal! @a | update
When you already have a precise quickfix list, :cdo is one of the safest ways to run a macro only where it matters.
:%s/\<word\>/replacement/g
How it works In Vim's regular expressions, \ are word boundary anchors: \ matches the end of a word.
\v
Vim's default regex mode ("magic") requires backslashes before many special characters: \(, \ , \+, \{.
:set title
Enabling title tells Vim to update the terminal window's title bar with information about the current file.
zf{motion}
Vim supports several fold methods, but manual folding with zf gives you precise control over exactly which lines to collapse.
:setlocal {option}={value}
:setlocal sets an option only for the current buffer or window, leaving all other buffers and windows unaffected.
:earlier {time}
Vim's :earlier and :later commands let you travel through undo history using real-world time intervals instead of individual change counts.
ct{char}
The ct{char} command deletes everything from the cursor up to (but not including) the specified character and drops you into insert mode.
editing #editing #motions #normal-mode #text-objects #productivity