How do I use bracket mappings for paired operations?
[q, ]q, [b, ]b (vim-unimpaired)
vim-unimpaired by Tim Pope provides consistent bracket mappings for navigating paired items like quickfix entries, buffers, and more.
272 results for ":q!"
[q, ]q, [b, ]b (vim-unimpaired)
vim-unimpaired by Tim Pope provides consistent bracket mappings for navigating paired items like quickfix entries, buffers, and more.
q{a-z}...q
Recording a macro captures a sequence of keystrokes into a register, which you can replay later.
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
qa...q
Press q followed by a lowercase letter (a-z) to start recording into that register.
<C-r>/ or q/
Press q/ to open search history in a window.
:let @q = substitute(@q, '\n', '', 'g')
A common macro failure mode is accidentally hitting while recording.
:let @q = substitute(@q, '\n$', 'A;<Esc>\n', '')
Rerecording a long macro for one tiny change is slow and error-prone.
:let @q = substitute(@q, 'old', 'new', '')
Vim macros are stored as plain text in named registers, which means you can inspect and modify them directly using :let and :echo.
]q and [q
The vim-unimpaired plugin by Tim Pope provides pairs of bracket mappings for common navigation and toggling tasks.
qA...q
Use uppercase register letter qA to append to macro a instead of overwriting.
:let @q = substitute(@q, 'old', 'new', 'g')
When a recorded macro has a typo or needs a small tweak, re-recording the entire thing is error-prone.
qq;.q then @q or @@
The dot command (.
:let @q = substitute(@q, 'foo', 'bar', 'g')
Recorded macros are plain text stored in registers, which means you can refactor them instead of re-recording from scratch.
qa/[A-Z]\ni_<Esc>l~q
Record a macro that finds the next uppercase letter, inserts an underscore before it, and lowercases it.
qaf r_q
Record a macro that finds the next space with f and replaces it with an underscore using r_.
:let @q = substitute(@q, 'from', 'to', 'g')
Macros are stored as plain text in named registers, so you can manipulate them with any Vimscript string function.
qa{jI## Section \n<Esc>}q
Record a macro that goes to the start of each paragraph and inserts a section header.
:let @q = substitute(@q, "old", "new", "g")
Vim macros are stored as plain text in registers, which means you can inspect and modify them like any other string.
qaf'r"q
Record a macro that finds the next single quote with f' and replaces it with a double quote using r".
qaf,i"<Esc>la"<Esc>q
Record a macro that finds the next comma, inserts a quote before it, moves past the comma, and inserts a quote after.