Skip to content

Macrothis is a plugin for neovim to save and load macros

License

Notifications You must be signed in to change notification settings

desdic/macrothis.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Macrothis.nvim

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.

Macrothis.nvim demo

Requirements

Neovim 0.10+

Telescope (optional)

Using lazy.nvim

{
    "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

Telescope

Enable extension

require "telescope".load_extension("macrothis")

Configuration

require("telescope").extensions = {
    macrothis = {}
}

Usage

:Telescope macrothis

Default shortcuts

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.

Uninstalling

Macrothis keeps a file in the default data directory called macrothis.json