How do I clear or empty a macro register in Vim?
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
2125 results for "i{ a{"
qaq
How it works To clear a macro register, you simply start recording into that register and immediately stop.
:%s/\n/ /g
Using \n in the pattern of :substitute matches the newline character at the end of each line, letting you join lines with any separator you choose — something
:let @a=@1
When you delete full lines repeatedly, Vim rotates those deletions through numbered registers.
r<CR>
You can split a line at the cursor without entering Insert mode by using r.
/\%>5l\%<10l pattern
Vim's \%>{lnum}l and \%5l — matches only at positions after line 5 (i.
:setlocal nomodifiable
While :set readonly prevents accidental writes, nomodifiable goes further by preventing any changes to the buffer contents entirely.
buffers-windows #buffers-windows #readonly #modifiable #protection
getchar()
getchar() blocks and waits for the user to press a key, returning its numeric character code.
ciw
The ciw command deletes the inner word under the cursor and drops you into insert mode so you can type a replacement.
:right
Vim has three built-in Ex commands for text alignment that most users never discover: :right [width] right-justifies lines, :left [width] left-justifies (strips
:g/^$/,/./-j
The command :g/^$/,/.
:let @a=getline('.')<CR>@a
How it works Instead of recording keystrokes interactively, you can write a sequence of Vim commands as plain text in your buffer and then execute that text as
:s/\v(\w+)\s+(\w+)/\2 \1/
By using capture groups in a substitute command with very magic mode (\v), you can swap two adjacent words in a single operation.
:pedit +/TODO %
When you need a second read-only view of the same file, opening more normal splits can disrupt your working layout.
gF
The gF command opens the file under the cursor and jumps to the line number that appears after the filename.
:g/pattern/d
The :g/pattern/d command deletes every line in the file that matches the given pattern.
:<line-number>
When you know the exact line number you want to navigate to, the colon command is the quickest way to get there.
:@a
How it works The command :@a executes the contents of register a as an Ex command.
:[range]right {width}
Vim has built-in Ex commands for text alignment — :right, :left, and :center — that work over any line range without plugins.
command-line #formatting #indentation #command-line #ex-commands
:%s/\w\+/\u&/g
Vim's substitute command supports case-conversion modifiers in the replacement string.
d'a
Named marks are not just jump destinations — they serve as motion targets for any operator.
navigation #navigation #marks #editing #motions #normal-mode