2023-05-22 14:21:47 +00:00
|
|
|
[[ch-custom-plugins]]
|
|
|
|
== Custom Plugins
|
|
|
|
|
|
|
|
You can use custom plugins, before they are implemented in the flake.
|
|
|
|
To add a plugin, you need to add it to your config's `config.vim.startPlugins` array.
|
2023-07-28 09:03:10 +00:00
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
[[sec-new-method]]
|
2023-07-28 09:03:10 +00:00
|
|
|
=== New Method
|
|
|
|
As of version 0.5, we have a more extensive API for configuring plugins, under `vim.extraPlugins`.
|
|
|
|
|
|
|
|
Instead of using DAGs exposed by the library, you may use the extra plugin module as follows:
|
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
|
|
|
config.vim.extraPlugins = with pkgs.vimPlugins; {
|
|
|
|
aerial = {
|
|
|
|
package = aerial-nvim;
|
|
|
|
setup = ''
|
|
|
|
require('aerial').setup {
|
|
|
|
-- some lua configuration here
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
2023-10-03 19:06:26 +00:00
|
|
|
|
2023-07-28 09:03:10 +00:00
|
|
|
harpoon = {
|
|
|
|
package = harpoon;
|
|
|
|
setup = "require('harpoon').setup {}";
|
|
|
|
after = ["aerial"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
[[sec-old-method]]
|
2023-07-28 09:03:10 +00:00
|
|
|
=== Old Method
|
2023-10-03 19:06:26 +00:00
|
|
|
Users who have not yet updated to 0.5, or prefer a more hands-on approach may use the old method where the load order
|
|
|
|
of the plugins is determined by DAGs.
|
2023-05-22 14:21:47 +00:00
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
2023-07-28 09:03:10 +00:00
|
|
|
# fetch plugin source from GitHub and add it to startPlugins
|
2023-05-22 14:21:47 +00:00
|
|
|
config.vim.startPlugins = [
|
|
|
|
(pkgs.fetchFromGitHub {
|
|
|
|
owner = "FrenzyExists";
|
|
|
|
repo = "aquarium-vim";
|
|
|
|
rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5";
|
|
|
|
sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
However, just making the plugin available might not be enough. In that case, you can write custom vimscript
|
|
|
|
or lua config, using `config.vim.configRC` or `config.vim.luaConfigRC` respectively.
|
2023-05-22 14:21:47 +00:00
|
|
|
These options are attribute sets, and you need to give the configuration you're adding some name, like this:
|
|
|
|
|
|
|
|
[source,nix]
|
|
|
|
----
|
|
|
|
{
|
2023-10-03 19:06:26 +00:00
|
|
|
# this will create an "aquarium" section in your init.vim with the contents of your custom config
|
|
|
|
# which will be *appended* to the rest of your configuration, inside your init.vim
|
2023-05-22 14:21:47 +00:00
|
|
|
config.vim.configRC.aquarium = "colorscheme aquiarum";
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
Note: If your configuration needs to be put in a specific place in the config, you can use functions from
|
|
|
|
`inputs.neovim-flake.lib.nvim.dag` to order it.
|
|
|
|
Refer to https://github.com/nix-community/home-manager/blob/master/modules/lib/dag.nix to find out more about
|
|
|
|
the DAG system.
|
2023-05-22 14:21:47 +00:00
|
|
|
|
2023-10-03 19:06:26 +00:00
|
|
|
Also, if you successfully made your plugin work, please make a PR to add it to the flake, or open an issue
|
|
|
|
with your findings so that we can make it available for everyone easily.
|