How do I append the same text to the end of several lines?
V select then :norm A text
Selecting lines and running :norm A text appends the same text to the end of every selected line.
2125 results for "i' a'"
V select then :norm A text
Selecting lines and running :norm A text appends the same text to the end of every selected line.
:let @b = @a
The :let @b = @a command copies the contents of register a into register b.
:{range}w filename
The :w command with a range and filename saves only the specified lines to a new file.
qa I1. <Esc>j q
This simple macro inserts a list number prefix at the beginning of each line.
:let @a = substitute(@a, "old", "new", "g")
When a recorded macro has a typo or wrong command buried inside it, you don't have to re-record the entire thing.
v/pattern<CR>
Starting a search while in visual mode extends the selection to the search match.
:'<,'>s/\%Vpattern/replacement/g
Using \%V in a substitute pattern restricts matching to within the visual block area only, rather than the full lines.
:tab split
:tab split opens the current buffer in a brand new tab page, giving you a second independent view of the same file.
:%norm A;
The :%norm command runs normal mode commands on every line in the file (or a range).
m{A-Z}
Uppercase marks (A-Z) are global marks that remember both the file and the cursor position.
I
The I (uppercase) command moves the cursor to the first non-blank character of the current line and enters insert mode.
:earlier 10m
The :earlier command restores the buffer to its state at a specific time in the past.
:call setreg('a', @a, 'l')
Registers in Vim have a type — characterwise, linewise, or blockwise — that affects how their contents are pasted.
:'<,'>norm @q
When you visually select lines and then type a : command, Vim automatically inserts ' (the visual range marks) into the command line.
v + repeated iw/aw/i(/a(/ip/ap
Once you enter visual mode, you can progressively expand your selection by typing increasingly larger text objects.
visual-mode #visual-mode #text-objects #editing #selection #productivity
<C-w>]
The ] command opens the definition of the tag under the cursor in a new horizontal split.
:set tildeop
By default, ~ toggles the case of a single character and advances the cursor.
:view {file}
:view opens a file with the readonly option set, preventing accidental writes.
:Vexplore
Vim ships with netrw, a built-in file explorer that requires no plugins.
<C-x>
The command decrements the number under or after the cursor by 1.