diff --git a/docs/custom-plugins.adoc b/docs/custom-plugins.adoc new file mode 100644 index 0000000..642b60e --- /dev/null +++ b/docs/custom-plugins.adoc @@ -0,0 +1,34 @@ +[[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. +This is an example of adding the FrenzyExists/aquarium-vim plugin: + +[source,nix] +---- +{ + config.vim.startPlugins = [ + (pkgs.fetchFromGitHub { + owner = "FrenzyExists"; + repo = "aquarium-vim"; + rev = "d09b1feda1148797aa5ff0dbca8d8e3256d028d5"; + sha256 = "CtyEhCcGxxok6xFQ09feWpdEBIYHH+GIFVOaNZx10Bs="; + }) + ]; +} +---- + +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. +These options are attribute sets, and you need to give the configuration you're adding some name, like this: + +[source,nix] +---- +{ + config.vim.configRC.aquarium = "colorscheme aquiarum"; +} +---- + +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. + +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. diff --git a/docs/manual.xml b/docs/manual.xml index 3f01228..5597b36 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -19,6 +19,7 @@ + diff --git a/docs/release-notes/rl-0.4.adoc b/docs/release-notes/rl-0.4.adoc index f13350f..318732e 100644 --- a/docs/release-notes/rl-0.4.adoc +++ b/docs/release-notes/rl-0.4.adoc @@ -16,6 +16,10 @@ https://github.com/n3oney[n3oney]: * Moved default keybinds into keybinds section of each module +* Simplified luaConfigRC and configRC setting - they can now just take strings + +* Refactored the resolveDag function - you can just provide a string now, which will default to dag.entryAnywhere + https://github.com/horriblename[horriblename]: * Added `clangd` as alternative lsp for C/++. diff --git a/modules/core/default.nix b/modules/core/default.nix index 91cccf5..9261caf 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -132,13 +132,13 @@ in { configRC = mkOption { description = "vimrc contents"; - type = nvim.types.dagOf types.lines; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; default = {}; }; luaConfigRC = mkOption { description = "vim lua config"; - type = nvim.types.dagOf types.lines; + type = types.oneOf [(nvim.types.dagOf types.lines) types.str]; default = {}; }; @@ -282,7 +282,13 @@ in { dag, mapResult, }: let - sortedDag = nvim.dag.topoSort dag; + # When the value is a string, default it to dag.entryAnywhere + finalDag = lib.mapAttrs (name: value: + if builtins.isString value + then nvim.dag.entryAnywhere value + else value) + dag; + sortedDag = nvim.dag.topoSort finalDag; result = if sortedDag ? result then mapResult sortedDag.result