How do you record a macro into a specific named register?
qa...q
Press q followed by a lowercase letter (a-z) to start recording into that register.
52 results for "macro record qa"
qa...q
Press q followed by a lowercase letter (a-z) to start recording into that register.
qa/^$/\ndd@aq
Record a macro that searches for blank lines, deletes them, and recurses.
qa/^#\nddq
Record a macro that finds lines starting with # and deletes them.
qa/[A-Z]\ni_<Esc>l~q
Record a macro that finds the next uppercase letter, inserts an underscore before it, and lowercases it.
qa:s/^ / /\njq
Record a macro that substitutes leading 4-space indentation with 2 spaces on each line.
qa:s/\s\+$//e\n jq
Record a macro that runs a substitution on the current line to remove trailing spaces, then moves down.
qa:s/\t/ /g\njq
Record a macro that substitutes all tabs with spaces on the current line, then moves down.
qa/https\?:\/\/\nyiW:put\nq
Record a macro that searches for URLs, yanks the URL, and puts it at the end of the file.
qa/true\|false\ncgn<C-r>=@"=='true'?'false':'true'\n<Esc>q
Record a macro using cgn with an expression register to toggle between true and false.
qa/pattern\nyy}pq
Record a macro that searches for a pattern, yanks the matching line, goes to the end of the paragraph, and pastes it.
qa f,ldt,F(p q
This macro swaps two comma-separated arguments inside parentheses by cutting the second argument and placing it before the first.
qa ... q ... @a
Macros let you record a sequence of commands and replay them.
qa ci"replacement<Esc> /next<CR> q
Macros can contain any Vim command including text objects, searches, and multi-key motions.
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
qa{motions}@aq
A recursive macro is one that calls itself at the end of its own recording.
qa{edits}@bq
How it works Vim macros can call other macros, creating a modular system of reusable building blocks.
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
qa{jI## Section \n<Esc>}q
Record a macro that goes to the start of each paragraph and inserts a section header.
qa$bywdw0Pa <Esc>q
Record a macro that yanks the last word, deletes it, pastes it at the beginning of the line.
qa*Ncgn<C-r>=newName\n<Esc>q
Record a macro using * to search for the word under cursor, cgn to change the next match, type the new name.