How do you record a macro to enclose each word in parentheses?
qaciwi(<C-r>")<Esc>wq
Record a macro that changes the inner word, types an opening paren, pastes the original word, types a closing paren, and moves to the next word.
15 results for ":wq"
qaciwi(<C-r>")<Esc>wq
Record a macro that changes the inner word, types an opening paren, pastes the original word, types a closing paren, and moves to the next word.
qaciw"<C-r>""<Esc>wq
This macro wraps the current word in double quotes by changing the word, inserting quotes around the original content, and moving to the next word.
qabi"<Esc>ea"<Esc>wq
How it works This macro wraps the current word in double quotes and moves to the next word, making it easy to repeat across a line or file.
:cnoreabbrev {lhs} {rhs}
:cnoreabbrev defines a non-recursive command-line abbreviation — like noremap but for Ex commands.
:cabbrev tn tabnew
Command-line abbreviations with cabbrev let you create short aliases for frequently used Ex commands.
command-line #command-line #abbreviation #shortcuts #productivity
ZZ
ZZ is a normal mode shorthand that saves and quits only if the buffer has been modified.
ZQ
ZQ is the discard-and-quit counterpart to ZZ.
:cabbrev
:cabbrev (command-line abbreviation) lets you define short aliases for longer Ex commands.
q/k?pattern<CR>
Vim's command-line history window (q: for Ex commands, q/ for search) opens a full editing buffer containing your history.
:reg {names}
The :registers command dumps every register at once, which is noisy when you only care about a handful.
:noautocmd w
The :noautocmd modifier runs any Ex command while suppressing all autocmd events for its duration.
:history
:history displays a numbered list of your recently entered Ex commands, giving you a full audit of what you have run in the current session (and across sessions
: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
:w !diff % -
The command :w !diff % - pipes the current buffer's contents to an external diff command that compares it against the saved file on disk.
buffers-windows #buffers-windows #ex-commands #editing #navigation
<C-w>c
The c (Ctrl+w then c) command closes the current window without closing the buffer it contains.