The "standard" way to edit/fix a macro that you have already recorded is to paste the macro's register contents into a buffer, edit the contents, yank them back into the same register, and then undo the changes to the buffer. That works, but it is slow and clunky.
This plugin improves the situation by providing a customizable mapping (<Leader>q{register letter} by default) that constructs an ex command to edit the macro register's contents directly, like :let @a="{contents here}".
And the ex command is inside of the command-line-window instead of the command-line, so you retain all of your mappings and modes for editing. It's as if you were in a normal buffer.
To install the plugin, you can use a plugin manager or (neo)vim's built-in package manager, like so:
- (Optional) Run
:help packagesto learn a bit about package management. - If you don't already have one, create a package containing a
startdirectory. (For example, I call mineutilities, and it contains my essential plugins.)- Vim:
mkdir -p ~/.vim/pack/utilities/start cd ~/.vim/pack/utilities/start - Neovim:
mkdir -p ~/.local/share/nvim/site/pack/utilities/start cd ~/.local/share/nvim/site/pack/utilities/start
- Vim:
- Now clone this plugin repository into that
startdirectory.
git clone https://github.com/simmsbra/vim-macaroni.git
Your directory structure will now look similar to this:
pack └── utilities └── start └── vim-macaroni ├── demo.gif ├── doc │ ├── macaroni.txt │ └── tags ├── LICENSE ├── logo.png ├── plugin │ └── macaroni.vim └── README.md - (Optional) Run
:nmap <Leader>qto make sure that the default mapping is now present.(Here, myn [q <Plug>MacaroniGetRegisterLetterThenOpenForEditing;mapleaderis set to[. If yours is unset, then\will be used.) - (Optional) Run
:help local-additionsto make sure that the plugin help now appears.*local-additions* |macaroni.txt| Edit macros with <Leader>q{register letter}
To update the plugin, run git pull in vim-macaroni/.
To remove the plugin, delete vim-macaroni/.
Refer to the help file by reading it here or by running :help macaroni.txt after installing.
Thanks to my wonderful wife for creating the logo and for listening to me talk about vim.
Thanks to zdcthomas for writing medit, which served as a reference for how to use just one mapping for all registers.
Thanks to the people who wrote the vim help pages.
Thanks to tpope for writing plugins that served as good references.
Thanks to the people whose explanations I read online while researching things about vimscript.
And thanks to you for visiting.

