From 2319ee082c3152ceaf74b10cdd3f0d531719198f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 18 Jul 2023 22:21:36 +0300 Subject: [PATCH 01/14] dev: custom type for extraPlugin module --- lib/types/default.nix | 2 +- lib/types/plugins.nix | 19 +++++++++++++++++++ modules/core/default.nix | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/types/default.nix b/lib/types/default.nix index 6d5777d..bfaa38d 100644 --- a/lib/types/default.nix +++ b/lib/types/default.nix @@ -4,6 +4,6 @@ typesLanguage = import ./languages.nix {inherit lib;}; in { inherit (typesDag) dagOf; - inherit (typesPlugin) pluginsOpt; + inherit (typesPlugin) pluginsOpt extraPluginType; inherit (typesLanguage) diagnostics mkGrammarOption; } diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 111fd8c..6ee0d46 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -97,7 +97,26 @@ with lib; let package ) ); + + extraPluginType = with types; + submodule { + options = { + package = mkOption { + type = pluginsType; + }; + dependencies = mkOption { + type = listOf str; + default = []; + }; + setup = mkOption { + type = lines; + default = ""; + }; + }; + }; in { + inherit extraPluginType; + pluginsOpt = { description, default ? [], diff --git a/modules/core/default.nix b/modules/core/default.nix index 9261caf..48769ec 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -158,6 +158,11 @@ in { description = "List of plugins to optionally load"; }; + extraPlugins = mkOption { + type = types.attrsOf nvim.types.extraPluginType; + default = {}; + }; + globals = mkOption { default = {}; description = "Set containing global variable values"; From 2167481cc2096e6b712f7977bedf0afc522374fe Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 21 Jul 2023 15:25:40 +0200 Subject: [PATCH 02/14] implement extraPluginConfigs --- modules/core/default.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/core/default.nix b/modules/core/default.nix index 48769ec..5d87c9c 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -302,6 +302,7 @@ in { result; in { vim = { + startPlugins = concatMap (x: x.package) (attrValues cfg.extraPlugins); configRC = { globalsScript = nvim.dag.entryAnywhere (concatStringsSep "\n" globalsScript); @@ -319,6 +320,27 @@ in { in nvim.dag.entryAfter ["globalsScript"] luaConfig; + extraPluginConfigs = let + mkSection = r: '' + -- SECTION: ${r.name} + ${r.data} + ''; + mapResult = r: (wrapLuaConfig (concatStringsSep "\n" (map mkSection r))); + extraPluginsDag = mapAttrs (_: { + dependencies, + setup, + ... + }: + nvim.dag.entryAfter dependencies setup) + cfg.extraPlugins; + pluginConfig = resolveDag { + name = "extra plugins config"; + dag = extraPluginsDag; + inherit mapResult; + }; + in + nvim.dag.entryAfter ["luaScript"] pluginConfig; + # This is probably not the right way to set the config. I'm not sure how it should look like. mappings = let maps = [ From afec39f3d98d3486d38a6f58d28df15ba6754fa2 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Fri, 21 Jul 2023 15:30:03 +0200 Subject: [PATCH 03/14] make extraPluginType singular instead of a list --- lib/types/plugins.nix | 16 ++++++++-------- modules/core/default.nix | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 6ee0d46..f4dde65 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -89,20 +89,20 @@ with lib; let "nvim-dap-ui" ]; # You can either use the name of the plugin or a package. - pluginsType = with types; - listOf ( - nullOr ( - either - (enum availablePlugins) - package - ) + pluginType = with types; + nullOr ( + either + package + (enum availablePlugins) ); + pluginsType = types.listOf pluginType; + extraPluginType = with types; submodule { options = { package = mkOption { - type = pluginsType; + type = pluginType; }; dependencies = mkOption { type = listOf str; diff --git a/modules/core/default.nix b/modules/core/default.nix index 5d87c9c..1515ca0 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -302,7 +302,7 @@ in { result; in { vim = { - startPlugins = concatMap (x: x.package) (attrValues cfg.extraPlugins); + startPlugins = map (x: x.package) (attrValues cfg.extraPlugins); configRC = { globalsScript = nvim.dag.entryAnywhere (concatStringsSep "\n" globalsScript); From cf48beb8e6ef51930c64fc1b9a0a9dbcfbe9d0fc Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 18:26:38 +0300 Subject: [PATCH 04/14] feat: make visible borders optional --- modules/completion/nvim-cmp/config.nix | 5 +++-- modules/lsp/lspconfig/config.nix | 5 +++++ modules/ui/borders/borders.nix | 9 +++++++++ modules/ui/borders/default.nix | 5 +++++ modules/ui/default.nix | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 modules/ui/borders/borders.nix create mode 100644 modules/ui/borders/default.nix diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index 72c9a1a..8ad7336 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -200,12 +200,13 @@ in { local cmp = require'cmp' cmp.setup({ + ${optionalString (config.vim.ui.borders.enable) '' + -- explicitly enabled by setting ui.borders.enable = true window = { - -- TODO: at some point, those need to be optional - -- but first nvim cmp module needs to be detached from "cfg.autocomplete" completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, + ''} snippet = { expand = function(args) diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index 70485be..cdcadc8 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -16,6 +16,11 @@ in { vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' local lspconfig = require('lspconfig') + + ${ + # TODO: make border style configurable + optionalString (config.vim.ui.borders.enable) "require('lspconfig.ui.windows').default_options.border = 'single'" + } ''; } { diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix new file mode 100644 index 0000000..b11d2cd --- /dev/null +++ b/modules/ui/borders/borders.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib) mkEnableOption mkOption; +in { + options.vim.ui.borders = { + enable = mkEnableOption "visible borders for most windows"; + + # TODO: make per-plugin borders configurable + }; +} diff --git a/modules/ui/borders/default.nix b/modules/ui/borders/default.nix new file mode 100644 index 0000000..526ac4e --- /dev/null +++ b/modules/ui/borders/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./borders.nix + ]; +} diff --git a/modules/ui/default.nix b/modules/ui/default.nix index 980a04a..757dd46 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -6,5 +6,6 @@ _: { ./smartcolumn ./colorizer ./illuminate + ./borders ]; } From d461cd903beaf5a571af21a7d0986eee7b09532e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 22:36:19 +0300 Subject: [PATCH 05/14] feat: add borders to lspsaga windows --- modules/lsp/lspsaga/config.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 3b7ea26..8f84f1d 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -39,7 +39,9 @@ in { vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' -- Enable lspsaga local saga = require 'lspsaga' - saga.init_lsp_saga() + saga.init_lsp_saga({ + border_style = 'single', + }) ''; }; } From 0951114a291aee9d42eb53d92cca95999d1fac11 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 18:26:38 +0300 Subject: [PATCH 06/14] feat: make visible borders optional --- modules/completion/nvim-cmp/config.nix | 5 +++-- modules/lsp/lspconfig/config.nix | 5 +++++ modules/ui/borders/borders.nix | 9 +++++++++ modules/ui/borders/default.nix | 5 +++++ modules/ui/default.nix | 1 + 5 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 modules/ui/borders/borders.nix create mode 100644 modules/ui/borders/default.nix diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index e49fdb9..0d6bd2c 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -192,12 +192,13 @@ in { local cmp = require'cmp' cmp.setup({ + ${optionalString (config.vim.ui.borders.enable) '' + -- explicitly enabled by setting ui.borders.enable = true window = { - -- TODO: at some point, those need to be optional - -- but first nvim cmp module needs to be detached from "cfg.autocomplete" completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, + ''} snippet = { expand = function(args) diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index 70485be..cdcadc8 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -16,6 +16,11 @@ in { vim.luaConfigRC.lspconfig = nvim.dag.entryAfter ["lsp-setup"] '' local lspconfig = require('lspconfig') + + ${ + # TODO: make border style configurable + optionalString (config.vim.ui.borders.enable) "require('lspconfig.ui.windows').default_options.border = 'single'" + } ''; } { diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix new file mode 100644 index 0000000..b11d2cd --- /dev/null +++ b/modules/ui/borders/borders.nix @@ -0,0 +1,9 @@ +{lib, ...}: let + inherit (lib) mkEnableOption mkOption; +in { + options.vim.ui.borders = { + enable = mkEnableOption "visible borders for most windows"; + + # TODO: make per-plugin borders configurable + }; +} diff --git a/modules/ui/borders/default.nix b/modules/ui/borders/default.nix new file mode 100644 index 0000000..526ac4e --- /dev/null +++ b/modules/ui/borders/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./borders.nix + ]; +} diff --git a/modules/ui/default.nix b/modules/ui/default.nix index 980a04a..757dd46 100644 --- a/modules/ui/default.nix +++ b/modules/ui/default.nix @@ -6,5 +6,6 @@ _: { ./smartcolumn ./colorizer ./illuminate + ./borders ]; } From b9e0f20e3963e094e346a3569337c6c26fe5f7bb Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 23 Jul 2023 22:36:19 +0300 Subject: [PATCH 07/14] feat: add borders to lspsaga windows --- modules/lsp/lspsaga/config.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 3b7ea26..8f84f1d 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -39,7 +39,9 @@ in { vim.luaConfigRC.lspsage = nvim.dag.entryAnywhere '' -- Enable lspsaga local saga = require 'lspsaga' - saga.init_lsp_saga() + saga.init_lsp_saga({ + border_style = 'single', + }) ''; }; } From 0667f1f9361b75b4fc76136a94699ce39774468f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 25 Jul 2023 22:16:20 +0300 Subject: [PATCH 08/14] dev: add missing hover window borders via noice.nvim --- configuration.nix | 1 + modules/ui/borders/borders.nix | 8 ++++++-- modules/ui/noice/config.nix | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configuration.nix b/configuration.nix index a38a2da..ce9b442 100644 --- a/configuration.nix +++ b/configuration.nix @@ -185,6 +185,7 @@ inputs: let }; vim.ui = { + borders.enable = true; noice.enable = true; colorizer.enable = true; modes-nvim.enable = false; # the theme looks terrible with catppuccin diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix index b11d2cd..f1fbd3c 100644 --- a/modules/ui/borders/borders.nix +++ b/modules/ui/borders/borders.nix @@ -1,8 +1,12 @@ {lib, ...}: let - inherit (lib) mkEnableOption mkOption; + inherit (lib) mkEnableOption mkOption types; in { options.vim.ui.borders = { - enable = mkEnableOption "visible borders for most windows"; + enable = mkOption { + type = types.bool; + default = true; + description = "visible borders for most windows"; + }; # TODO: make per-plugin borders configurable }; diff --git a/modules/ui/noice/config.nix b/modules/ui/noice/config.nix index 705256b..a2e3008 100644 --- a/modules/ui/noice/config.nix +++ b/modules/ui/noice/config.nix @@ -32,7 +32,7 @@ in { command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = true, -- long messages will be sent to a split inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help + lsp_doc_border = ${builtins.toString (config.vim.ui.borders.enable)}, -- add a border to hover docs and signature help }, format = { From cc1f1b2ed87f2c85155b3a33c3efff567ef04c31 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 26 Jul 2023 10:27:57 +0300 Subject: [PATCH 09/14] feat: per-plugin border styles defaults to the value of globalStyle, can be overriden --- modules/completion/nvim-cmp/config.nix | 1 + modules/lsp/lsp-signature/config.nix | 9 ++++- modules/lsp/lspconfig/config.nix | 4 ++- modules/lsp/lspsaga/config.nix | 4 ++- modules/minimap/codewindow/config.nix | 2 +- modules/ui/borders/borders.nix | 42 ++++++++++++++++++---- modules/utility/binds/which-key/config.nix | 8 ++++- 7 files changed, 59 insertions(+), 11 deletions(-) diff --git a/modules/completion/nvim-cmp/config.nix b/modules/completion/nvim-cmp/config.nix index 0d6bd2c..afbf39e 100644 --- a/modules/completion/nvim-cmp/config.nix +++ b/modules/completion/nvim-cmp/config.nix @@ -194,6 +194,7 @@ in { cmp.setup({ ${optionalString (config.vim.ui.borders.enable) '' -- explicitly enabled by setting ui.borders.enable = true + -- TODO: try to get nvim-cmp to follow global border style window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), diff --git a/modules/lsp/lsp-signature/config.nix b/modules/lsp/lsp-signature/config.nix index 738dcb5..1e73476 100644 --- a/modules/lsp/lsp-signature/config.nix +++ b/modules/lsp/lsp-signature/config.nix @@ -14,7 +14,14 @@ in { vim.luaConfigRC.lsp-signature = nvim.dag.entryAnywhere '' -- Enable lsp signature viewer - require("lsp_signature").setup() + require("lsp_signature").setup({ + ${optionalString (config.vim.ui.borders.plugins.lsp-signature.enable) '' + bind = true, -- This is mandatory, otherwise border config won't get registered. + handler_opts = { + border = "${config.vim.ui.borders.plugins.lsp-signature.style}" + } + ''} + }) ''; }; } diff --git a/modules/lsp/lspconfig/config.nix b/modules/lsp/lspconfig/config.nix index cdcadc8..e9d7b3c 100644 --- a/modules/lsp/lspconfig/config.nix +++ b/modules/lsp/lspconfig/config.nix @@ -19,7 +19,9 @@ in { ${ # TODO: make border style configurable - optionalString (config.vim.ui.borders.enable) "require('lspconfig.ui.windows').default_options.border = 'single'" + optionalString (config.vim.ui.borders.enable) '' + require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}' + '' } ''; } diff --git a/modules/lsp/lspsaga/config.nix b/modules/lsp/lspsaga/config.nix index 8f84f1d..74b91fc 100644 --- a/modules/lsp/lspsaga/config.nix +++ b/modules/lsp/lspsaga/config.nix @@ -40,7 +40,9 @@ in { -- Enable lspsaga local saga = require 'lspsaga' saga.init_lsp_saga({ - border_style = 'single', + ${optionalString (config.vim.ui.borders.plugins.lspsaga.enable) '' + border_style = '${config.vim.ui.borders.plugins.lspsaga.style}', + ''} }) ''; }; diff --git a/modules/minimap/codewindow/config.nix b/modules/minimap/codewindow/config.nix index 1025e63..ac82829 100644 --- a/modules/minimap/codewindow/config.nix +++ b/modules/minimap/codewindow/config.nix @@ -27,7 +27,7 @@ in { vim.luaConfigRC.codewindow = nvim.dag.entryAnywhere '' local codewindow = require('codewindow') codewindow.setup({ - exclude_filetypes = { 'NvimTree', 'orgagenda'}, + exclude_filetypes = { 'NvimTree', 'orgagenda', 'Alpha'}, }) ''; }; diff --git a/modules/ui/borders/borders.nix b/modules/ui/borders/borders.nix index f1fbd3c..179de44 100644 --- a/modules/ui/borders/borders.nix +++ b/modules/ui/borders/borders.nix @@ -1,13 +1,43 @@ -{lib, ...}: let - inherit (lib) mkEnableOption mkOption types; +{ + config, + lib, + ... +}: let + inherit (lib) mkOption mkEnableOption types; + + cfg = config.vim.ui.borders; + + defaultStyles = ["none" "single" "double" "rounded"]; in { options.vim.ui.borders = { - enable = mkOption { - type = types.bool; - default = true; - description = "visible borders for most windows"; + enable = mkEnableOption "visible borders for most windows"; + + globalStyle = mkOption { + type = types.enum defaultStyles; + default = "rounded"; + description = '' + global border style to use + ''; }; # TODO: make per-plugin borders configurable + plugins = let + mkPluginStyleOption = name: { + enable = mkEnableOption "whether to enable borders for the ${name} plugin" // {default = cfg.enable;}; + + style = mkOption { + type = types.enum (defaultStyles ++ lib.optionals (name != "which-key") ["shadow"]); + default = cfg.globalStyle; + description = "border style to use for the ${name} plugin"; + }; + }; + in { + # despite not having it listed in example configuration, which-key does support the rounded type + # additionall, it supports a "shadow" type that is similar to none but is of higher contrast + which-key = mkPluginStyleOption "which-key"; + lspsaga = mkPluginStyleOption "lspsaga"; + nvim-cmp = mkPluginStyleOption "nvim-cmp"; + lsp-signature = mkPluginStyleOption "lsp-signature"; + }; }; } diff --git a/modules/utility/binds/which-key/config.nix b/modules/utility/binds/which-key/config.nix index a5c1569..8b0fa6c 100644 --- a/modules/utility/binds/which-key/config.nix +++ b/modules/utility/binds/which-key/config.nix @@ -18,7 +18,13 @@ in { [""] = "SPACE", [""] = "RETURN", [""] = "TAB", - } + }, + + ${lib.optionalString (config.vim.ui.borders.plugins.which-key.enable) '' + window = { + border = "${config.vim.ui.borders.plugins.which-key.style}", + }, + ''} }) wk.register({ From 107cea4f20e69b4c3535d77d696d4e6476b32382 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 26 Jul 2023 15:12:32 +0300 Subject: [PATCH 10/14] fix: (toString false) producing an empty line --- modules/ui/noice/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui/noice/config.nix b/modules/ui/noice/config.nix index a2e3008..d12ebf0 100644 --- a/modules/ui/noice/config.nix +++ b/modules/ui/noice/config.nix @@ -32,7 +32,7 @@ in { command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = true, -- long messages will be sent to a split inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = ${builtins.toString (config.vim.ui.borders.enable)}, -- add a border to hover docs and signature help + lsp_doc_border = ${boolToString (config.vim.ui.borders.enable)}, -- add a border to hover docs and signature help }, format = { From 5981cd14f8637492b55648258c1514387f5ff802 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Wed, 26 Jul 2023 15:27:08 +0200 Subject: [PATCH 11/14] rename for clarity --- lib/types/plugins.nix | 2 +- modules/core/default.nix | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index f4dde65..c5b6e54 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -104,7 +104,7 @@ with lib; let package = mkOption { type = pluginType; }; - dependencies = mkOption { + after = mkOption { type = listOf str; default = []; }; diff --git a/modules/core/default.nix b/modules/core/default.nix index 1515ca0..bab8803 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -327,11 +327,11 @@ in { ''; mapResult = r: (wrapLuaConfig (concatStringsSep "\n" (map mkSection r))); extraPluginsDag = mapAttrs (_: { - dependencies, + after, setup, ... }: - nvim.dag.entryAfter dependencies setup) + nvim.dag.entryAfter after setup) cfg.extraPlugins; pluginConfig = resolveDag { name = "extra plugins config"; From 8d72e28c4d61e6efd891d8771b79a2bc5db4e5c5 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Wed, 26 Jul 2023 15:27:34 +0200 Subject: [PATCH 12/14] add descriptions for extraPlugins --- lib/types/plugins.nix | 3 +++ modules/core/default.nix | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index c5b6e54..7db0019 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -107,10 +107,13 @@ with lib; let after = mkOption { type = listOf str; default = []; + description = "Setup this plugin after the following ones."; }; setup = mkOption { type = lines; default = ""; + description = "Lua code to run during setup."; + example = "require('aerial').setup {}"; }; }; }; diff --git a/modules/core/default.nix b/modules/core/default.nix index bab8803..fd097ef 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -161,6 +161,22 @@ in { extraPlugins = mkOption { type = types.attrsOf nvim.types.extraPluginType; default = {}; + description = '' + List of plugins and related config. + Note that these are setup after builtin plugins. + ''; + example = literalExpression '' + with pkgs.vimPlugins; { + aerial = { + package = aerial-nvim; + setup = "require('aerial').setup {}"; + }; + harpoon = { + package = harpoon; + setup = "require('harpoon').setup {}"; + after = ["aerial"]; + }; + }''; }; globals = mkOption { From d7f4310121e3396b819ad6ad57cf60dd8eb688d9 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 12:02:51 +0300 Subject: [PATCH 13/14] dev: update nmd source --- flake.lock | 14 +++++++------- flake.nix | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 3741f25..14f4169 100644 --- a/flake.lock +++ b/flake.lock @@ -855,17 +855,17 @@ "nmd": { "flake": false, "locked": { - "lastModified": 1680213367, - "narHash": "sha256-NbSXxpFAK5IMcsQTK0vSGy099HExx3SEagqW4Lpc+X8=", - "owner": "rycee", + "lastModified": 1687627428, + "narHash": "sha256-7zGfXuNS5RHqhpEdz2fwrtqvF86JRo5U1hrxZSYgcm8=", + "owner": "~rycee", "repo": "nmd", - "rev": "abb15317ebd17e5a0a7dd105e2ce52f2700185a8", - "type": "gitlab" + "rev": "824a380546b5d0d0eb701ff8cd5dbafb360750ff", + "type": "sourcehut" }, "original": { - "owner": "rycee", + "owner": "~rycee", "repo": "nmd", - "type": "gitlab" + "type": "sourcehut" } }, "noice-nvim": { diff --git a/flake.nix b/flake.nix index d207bff..85d4bfe 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,7 @@ # For generating documentation website nmd = { - url = "gitlab:rycee/nmd"; + url = "sourcehut:~rycee/nmd"; flake = false; }; From 4dfd36e157c67334f4d44f9b20a57b755443dc97 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 28 Jul 2023 12:03:10 +0300 Subject: [PATCH 14/14] docs: document extraPlugins usage and add missing documentation entries --- docs/manual/custom-plugins.adoc | 33 +++++++++++++++++++++++++++++++- docs/manual/home-manager.adoc | 34 --------------------------------- docs/release-notes/rl-0.5.adoc | 12 ++++++++---- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/docs/manual/custom-plugins.adoc b/docs/manual/custom-plugins.adoc index 642b60e..6f6da92 100644 --- a/docs/manual/custom-plugins.adoc +++ b/docs/manual/custom-plugins.adoc @@ -3,11 +3,42 @@ 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: + + +=== 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 + } + ''; + }; + + harpoon = { + package = harpoon; + setup = "require('harpoon').setup {}"; + after = ["aerial"]; + }; + }; +} +---- + +=== Old Method +Users who have not yet updated to 0.5, or prefer a more hands-on approach may use the old method where the load orderof the plugins is determined by DAGs. + +[source,nix] +---- +{ + # fetch plugin source from GitHub and add it to startPlugins config.vim.startPlugins = [ (pkgs.fetchFromGitHub { owner = "FrenzyExists"; diff --git a/docs/manual/home-manager.adoc b/docs/manual/home-manager.adoc index a937738..df60652 100644 --- a/docs/manual/home-manager.adoc +++ b/docs/manual/home-manager.adoc @@ -43,38 +43,4 @@ Then we should be able to use the given module. E.g. } ---- -=== Custom vim/neovim plugins -It is possible to add custom plugins to your configuration by using the `vim.startPlugins` option and the this flake's lua DAG library. - -Start by adding it to startPlugins. This example uses nvim-surround, but the process will be similar for other plugins as well. - -[source,nix] ----- -{ - programs.neovim-flake = { - enable = true; - settings = { - vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ]; - }; - }; -} ----- - -Followed by requiring the plugin, should it need one, in the lua DAG. Please note that you're able to name the DAG to however you want, the name will add a `--SECTION ` in the init.vim, under which it will be initialized. `lib.nvim.dag.entryAfter ["name"]` could also be used to initialize a plugin only after a previous plugin has beeni initialize -Your final setup will likely look like this, where nvim-flake refers to your flake input or fetch. - -[source,nix] ----- -{ - programs.neovim-flake = { - enable = true; - settings = { - vim.startPlugins = [ pkgs.vimPlugins.nvim-surround ]; - luaConfigRC.nvim-surround = nvim-flake.lib.nvim.dag.entryAnywhere '' # nvim-flake is a reference to the flake. Please change this accordingly to your config. - require("nvim-surround").setup() - ''; - }; - }; -} ----- diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index 865ee3f..cde1d4b 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -8,14 +8,18 @@ https://github.com/horriblename[horriblename]: -* Add transparency support for tokyonight theme. +* Added transparency support for tokyonight theme. -* Fix bug where cmp's close and scrollDocs mappings wasn't working. +* Fixed a bug where cmp's close and scrollDocs mappings wasn't working. + +* Streamlined and simplified extra plugin API with the addition of <>. https://github.com/amanse[amanse]: -* Add daily notes options for obsidian plugin +* Added daily notes options for obsidian plugin. https://github.com/notashelf[notashelf]: -* Add GitHub Copilot to completion sources +* Added GitHub Copilot to completion sources. + +* Added <> for global and individual plugin border configuration.