Macrothis.nvim was created since I had a basic need for storing and loading macros. A side effect is that it works on all registers. It does most operations on register.
Works with or without telescope.
Telescope (optional)
{
"desdic/macrothis.nvim",
opts = {},
keys = {
{ "<Leader>kkd", function() require('macrothis').delete() end, desc = "delete" },
{ "<Leader>kke", function() require('macrothis').edit() end, desc = "edit" },
{ "<Leader>kkl", function() require('macrothis').load() end, desc = "load" },
{ "<Leader>kkn", function() require('macrothis').rename() end, desc = "rename" },
{ "<Leader>kkq", function() require('macrothis').quickfix() end, desc = "run macro on all files in quickfix" },
{ "<Leader>kkr", function() require('macrothis').run() end, desc = "run macro" },
{ "<Leader>kks", function() require('macrothis').save() end, desc = "save" },
{ "<Leader>kkx", function() require('macrothis').register() end, desc = "edit register" },
{ "<Leader>kkp", function() require('macrothis').copy_register_printable() end, desc = "Copy register as printable" },
{ "<Leader>kkm", function() require('macrothis').copy_macro_printable() end, desc = "Copy macro as printable" },
}
},
See documentation for defaults
require "telescope".load_extension("macrothis")
require("telescope").extensions = {
macrothis = {}
}
:Telescope macrothis
Shortcut | Description |
---|---|
<CR> | Load selected entry into register |
<C-c> | Copy macro as printable |
<C-d> | Delete selected entry or delete all marked entries |
<C-e> | Edit content of macro |
<C-h> | Show key bindings |
<C-n> | Rename selected entry |
<C-q> | Run macro on files in quickfix list |
<C-r> | Run macro |
<C-s> | Save a macro/register |
<C-x> | Edit register (<C-c> can be used to copy the register as printable) |
Shortcuts, sorters and more can be overridden via telescope options for this plugin.
Macrothis keeps a file in the default data directory called macrothis.json