On occasion you may have a Neovim plugin you use, but find that you wish some aspect of it's behavior were different. If the plugin does not expose configuration for that behavior your options are to attempt to have the maintainer(s) upstream your change, maintain a fork of the plugin, or maintain patches against the upstream. This project is intended to be a minimal helper tool for the latter use case.
This plugin was created because I 1) wanted a minor tweak in a plugin I use and 2) wanted to learn about how plugins work in Neovim.
The functionality provided by this plugin is sparse.
- Apply patches to plugins
- Remove patches from plugins
- Check whether patches are applied to plugins
- Inform you if patches are not applied on startup (Optional)
Warning
Updating plugins while patched could have interesting and unintended interactions. Dispatcher.nvim applies patches to the working tree of the plugin's cloned repo. As of writing vim.pack will stash changes in the working tree before updating and will not pop them afterwards, effectively unpatching the plugins. How you deal with this is up to you, but I would recommend removing patches before updating.
With vim.pack:
vim.pack.add({
{ src = "https://github.com/kkwik/dispatcher.nvim" },
})require("dispatcher").setup({
-- Optional configuration goes here
})-- The default configuration used if not overriden in setup()
{
-- Notify user via vim.notify() if any patches are not applied on startup
check_on_startup = false,
-- Create :Dispatcher user command
create_user_commands = true,
-- The directory where you store your patches
patches_directory = vim.fn.stdpath("config") .. "/patches",
-- The directory where your package manager stores plugins. Default assumes usage of vim.pack
plugin_directory = vim.fn.stdpath("data") .. "/site/pack/core/opt",
}