How do I replace the next search match and repeat it easily with dot?
cgn
The cgn command combines the change operator with the gn motion to change the next occurrence of your last search pattern.
49 results for "c motion"
cgn
The cgn command combines the change operator with the gn motion to change the next occurrence of your last search pattern.
v
The v command enters character-wise visual mode, letting you select text one character at a time.
C
The C command deletes everything from the cursor position to the end of the line and places you in insert mode.
".
The .
"+y
The "+y command yanks (copies) text into the system clipboard register, making it available to paste in other applications outside of Vim.
y$
The y$ command yanks (copies) text from the cursor position to the end of the line.
ce
The ce command changes from the cursor position to the end of the current word.
D
The D command deletes everything from the cursor position to the end of the current line.
d2i(
Vim text objects accept a count prefix that lets you target outer layers of nested delimiters.
]]
The ]] motion jumps forward to the next line that starts with { in the first column, which is typically the beginning of a C-style function or section.
<C-a> (insert mode)
While in insert mode, pressing re-inserts the exact text you typed during your previous insert session.
qa...@aq
A recursive macro calls itself at the end of its recording, causing it to repeat until a motion or search fails.
<C-v>jj$A;
Visual block mode normally selects a fixed-width column, which makes appending tricky when lines have different lengths.
<C-v>jjlU
Visual block mode lets you select rectangular regions of text, which means you can target a specific column and apply case changes only to that area.
onoremap ih :<C-u>execute "normal! ?^==\+$\r:noh\rkvg_"<CR>
Vim lets you define custom text objects using operator-pending mode mappings (onoremap) and visual mode mappings (vnoremap).
:echo strtrans(@q)
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
42G
The 42G command jumps the cursor directly to line 42 in the current file.
<C-f> (from command-line mode)
When you are partway through typing a long or complex Ex command on the : prompt, you can press to open the command-line window.
:%s/pattern//gn
The n flag on the substitute command makes it report the match count without actually performing any replacement.
<C-v>jj$A text<Esc>
Visual block mode combined with $A lets you append text to the end of multiple lines simultaneously, even when those lines have different lengths.
visual-mode #editing #visual-mode #block-mode #productivity #insert-mode