From d12846211b3430c0c0ec73b4395f7df8a64ea668 Mon Sep 17 00:00:00 2001 From: TheColorman Date: Mon, 3 Mar 2025 21:12:58 +0100 Subject: [PATCH 01/11] session/nvim-session-manager: fix autoload_mode type Fixes `Error detected while processing VimEnter Autocommands for "*"` by using an enum type for "autoload_mode" instead of a string --- docs/release-notes/rl-0.8.md | 5 +++++ .../session/nvim-session-manager/nvim-session-manager.nix | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 6027736a..b16ed6b2 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -200,3 +200,8 @@ [alfarel](https://github.com/alfarelcynthesis): - Add missing `yazi.nvim` dependency (`snacks.nvim`). + +[TheColorman](https://github.com/TheColorman) + +- Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value + for `autoload_mode`. diff --git a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix index 05d0b01b..41cff8a4 100644 --- a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix @@ -1,5 +1,6 @@ {lib, ...}: let inherit (lib.types) nullOr str bool; + inherit (lib.generators) mkLuaInline; inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule; in { imports = let @@ -68,6 +69,8 @@ in { autoload_mode = mkOption { type = types.enum ["Disabled" "CurrentDir" "LastSession"]; + # variable `sm` referenced from ./config.nix + apply = value: mkLuaInline "sm.AutoloadMode.${value}"; default = "LastSession"; description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession"; }; From 27978c7186b26e78c7765de4c093a816617f9f39 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 4 Mar 2025 23:30:52 +0300 Subject: [PATCH 02/11] session/nvim-session-manager: fix option descriptions; more explicit library inherits --- .../nvim-session-manager.nix | 83 +++++++++++++------ 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix index 41cff8a4..e60a4a5d 100644 --- a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix @@ -1,7 +1,10 @@ {lib, ...}: let - inherit (lib.types) nullOr str bool; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.modules) mkRenamedOptionModule; + inherit (lib.strings) isString; + inherit (lib.types) nullOr str bool int enum listOf either; inherit (lib.generators) mkLuaInline; - inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule; + inherit (lib.nvim.types) luaInline mkPluginSetupOption; in { imports = let renameSetupOpt = oldPath: newPath: @@ -51,70 +54,100 @@ in { usePicker = mkOption { type = bool; default = true; - description = "Whether or not we should use dressing.nvim to build a session picker UI"; + description = '' + Whether we should use `dressing.nvim` to build a session picker UI + ''; }; - setupOpts = { + setupOpts = mkPluginSetupOption "which-key" { path_replacer = mkOption { - type = types.str; + type = str; default = "__"; - description = "The character to which the path separator will be replaced for session files"; + description = '' + The character to which the path separator will be replaced for session files + ''; }; colon_replacer = mkOption { - type = types.str; + type = str; default = "++"; - description = "The character to which the colon symbol will be replaced for session files"; + description = '' + The character to which the colon symbol will be replaced for session files + ''; }; autoload_mode = mkOption { - type = types.enum ["Disabled" "CurrentDir" "LastSession"]; - # variable `sm` referenced from ./config.nix - apply = value: mkLuaInline "sm.AutoloadMode.${value}"; + type = either (enum ["Disabled" "CurrentDir" "LastSession"]) luaInline; + # Variable 'sm' is defined in the pluginRC of nvim-session-manager. The + # definition is as follows: `local sm = require('session_manager.config')` + apply = val: + if isString val + then mkLuaInline "sm.AutoloadMode.${val}" + else val; default = "LastSession"; - description = "Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession"; + description = '' + Define what to do when Neovim is started without arguments. + + Takes either one of `"Disabled"`, `"CurrentDir"`, `"LastSession` in which case the value + will be inserted into `sm.AutoloadMode.`, or an inline Lua value. + ''; }; max_path_length = mkOption { - type = types.nullOr types.int; + type = nullOr int; default = 80; - description = "Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all"; + description = '' + Shorten the display path if length exceeds this threshold. + + Use `0` if don't want to shorten the path at all + ''; }; autosave_last_session = mkOption { - type = types.bool; + type = bool; default = true; - description = "Automatically save last session on exit and on session switch"; + description = '' + Automatically save last session on exit and on session switch + ''; }; autosave_ignore_not_normal = mkOption { - type = types.bool; + type = bool; default = true; - description = "Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed"; + description = '' + Plugin will not save a session when no buffers are opened, or all of them are + not writable or listed + ''; }; autosave_ignore_dirs = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; description = "A list of directories where the session will not be autosaved"; }; autosave_ignore_filetypes = mkOption { - type = types.listOf types.str; + type = listOf str; default = ["gitcommit"]; - description = "All buffers of these file types will be closed before the session is saved"; + description = '' + All buffers of these file types will be closed before the session is saved + ''; }; autosave_ignore_buftypes = mkOption { - type = types.listOf types.str; + type = listOf str; default = []; - description = "All buffers of these buffer types will be closed before the session is saved"; + description = '' + All buffers of these buffer types will be closed before the session is saved + ''; }; autosave_only_in_session = mkOption { - type = types.bool; + type = bool; default = false; - description = "Always autosaves session. If true, only autosaves after a session is active"; + description = '' + Always autosaves session. If `true`, only autosaves after a session is active + ''; }; }; }; From 85ca2bc11fe59fc0eb8d0064264b4341dd4c12fb Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 21:03:46 -0500 Subject: [PATCH 03/11] utility/mkdir-nvim: init --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/utility/default.nix | 1 + modules/plugins/utility/mkdir/config.nix | 12 ++++++++++++ modules/plugins/utility/mkdir/default.nix | 6 ++++++ modules/plugins/utility/mkdir/mkdir.nix | 7 +++++++ npins/sources.json | 12 ++++++++++++ 6 files changed, 40 insertions(+) create mode 100644 modules/plugins/utility/mkdir/config.nix create mode 100644 modules/plugins/utility/mkdir/default.nix create mode 100644 modules/plugins/utility/mkdir/mkdir.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index b16ed6b2..9679a2c1 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -200,6 +200,8 @@ [alfarel](https://github.com/alfarelcynthesis): - Add missing `yazi.nvim` dependency (`snacks.nvim`). +- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin + for automatic creation of parent directories when editing a nested file. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 47579070..02d155ee 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -8,6 +8,7 @@ ./icon-picker ./images ./leetcode-nvim + ./mkdir ./motion ./multicursors ./new-file-template diff --git a/modules/plugins/utility/mkdir/config.nix b/modules/plugins/utility/mkdir/config.nix new file mode 100644 index 00000000..2f6a1fe7 --- /dev/null +++ b/modules/plugins/utility/mkdir/config.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + cfg = config.vim.utility.mkdir; +in { + vim = mkIf cfg.enable { + startPlugins = ["mkdir-nvim"]; + }; +} diff --git a/modules/plugins/utility/mkdir/default.nix b/modules/plugins/utility/mkdir/default.nix new file mode 100644 index 00000000..1ee6379b --- /dev/null +++ b/modules/plugins/utility/mkdir/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./mkdir.nix + ]; +} diff --git a/modules/plugins/utility/mkdir/mkdir.nix b/modules/plugins/utility/mkdir/mkdir.nix new file mode 100644 index 00000000..c591e6e6 --- /dev/null +++ b/modules/plugins/utility/mkdir/mkdir.nix @@ -0,0 +1,7 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; +in { + options.vim.utility.mkdir.enable = mkEnableOption '' + parent directory creation when editing a nested path that does not exist using `mkdir.nvim` + ''; +} diff --git a/npins/sources.json b/npins/sources.json index d196ff99..957d3b93 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1205,6 +1205,18 @@ "url": "https://github.com/wfxr/minimap.vim/archive/57287e2dd28fa3e63276a32d11c729df14741d54.tar.gz", "hash": "05k4cgcrz0gj92xy685bd4p6nh2jmaywc2f5sw1lap0v685h7n79" }, + "mkdir-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "jghauser", + "repo": "mkdir.nvim" + }, + "branch": "main", + "revision": "c55d1dee4f099528a1853b28bb28caa802eba217", + "url": "https://github.com/jghauser/mkdir.nvim/archive/c55d1dee4f099528a1853b28bb28caa802eba217.tar.gz", + "hash": "0zpyvkbw7wfqdxfgidr7zfxqb5ldci4pflx50rsm1hbwai0ybv23" + }, "modes-nvim": { "type": "Git", "repository": { From 9209a9da37616f1d1b0f1272a87e627d8ccc3218 Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 21:16:32 -0500 Subject: [PATCH 04/11] utility/nix-develop: init --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/utility/default.nix | 1 + modules/plugins/utility/nix-develop/config.nix | 12 ++++++++++++ modules/plugins/utility/nix-develop/default.nix | 6 ++++++ modules/plugins/utility/nix-develop/nix-develop.nix | 5 +++++ npins/sources.json | 12 ++++++++++++ 6 files changed, 38 insertions(+) create mode 100644 modules/plugins/utility/nix-develop/config.nix create mode 100644 modules/plugins/utility/nix-develop/default.nix create mode 100644 modules/plugins/utility/nix-develop/nix-develop.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 9679a2c1..85f21580 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -202,6 +202,8 @@ - Add missing `yazi.nvim` dependency (`snacks.nvim`). - Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic creation of parent directories when editing a nested file. +- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin + for in-neovim `nix develop`, `nix shell` and more. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 02d155ee..6a4b4a7e 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -12,6 +12,7 @@ ./motion ./multicursors ./new-file-template + ./nix-develop ./outline ./preview ./surround diff --git a/modules/plugins/utility/nix-develop/config.nix b/modules/plugins/utility/nix-develop/config.nix new file mode 100644 index 00000000..e1c57ff6 --- /dev/null +++ b/modules/plugins/utility/nix-develop/config.nix @@ -0,0 +1,12 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + cfg = config.vim.utility.nix-develop; +in { + vim = mkIf cfg.enable { + startPlugins = ["nix-develop-nvim"]; + }; +} diff --git a/modules/plugins/utility/nix-develop/default.nix b/modules/plugins/utility/nix-develop/default.nix new file mode 100644 index 00000000..7d227af5 --- /dev/null +++ b/modules/plugins/utility/nix-develop/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./nix-develop.nix + ]; +} diff --git a/modules/plugins/utility/nix-develop/nix-develop.nix b/modules/plugins/utility/nix-develop/nix-develop.nix new file mode 100644 index 00000000..cee77a6d --- /dev/null +++ b/modules/plugins/utility/nix-develop/nix-develop.nix @@ -0,0 +1,5 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; +in { + options.vim.utility.nix-develop.enable = mkEnableOption "in-neovim `nix develop`, `nix shell`, and more using `nix-develop.nvim`"; +} diff --git a/npins/sources.json b/npins/sources.json index 957d3b93..8a4e555e 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1316,6 +1316,18 @@ "url": "https://github.com/otavioschwanck/new-file-template.nvim/archive/6ac66669dbf2dc5cdee184a4fe76d22465ca67e8.tar.gz", "hash": "0c7378c3w6bniclp666rq15c28akb0sjy58ayva0wpyin4k26hl3" }, + "nix-develop-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "figsoda", + "repo": "nix-develop.nvim" + }, + "branch": "main", + "revision": "afea026f5c478c000a8af8de87f7b711676387ab", + "url": "https://github.com/figsoda/nix-develop.nvim/archive/afea026f5c478c000a8af8de87f7b711676387ab.tar.gz", + "hash": "0nwjgr19pzdxd7yygz380b388qcfbzp9svs916kh0zayzi9yxc2k" + }, "noice-nvim": { "type": "Git", "repository": { From a5d7313abb8741ff2c3f3735e1b9a03f50d4e6ca Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 21:24:43 -0500 Subject: [PATCH 05/11] utility/direnv-vim: init --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/utility/default.nix | 1 + modules/plugins/utility/direnv/config.nix | 13 +++++++++++++ modules/plugins/utility/direnv/default.nix | 6 ++++++ modules/plugins/utility/direnv/direnv.nix | 5 +++++ npins/sources.json | 12 ++++++++++++ 6 files changed, 39 insertions(+) create mode 100644 modules/plugins/utility/direnv/config.nix create mode 100644 modules/plugins/utility/direnv/default.nix create mode 100644 modules/plugins/utility/direnv/direnv.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 85f21580..5cf939be 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -204,6 +204,8 @@ for automatic creation of parent directories when editing a nested file. - Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for in-neovim `nix develop`, `nix shell` and more. +- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin + for automatic syncing of nvim shell environment with direnv's. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 6a4b4a7e..0f0956fb 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -3,6 +3,7 @@ ./binds ./ccc ./diffview + ./direnv ./fzf-lua ./gestures ./icon-picker diff --git a/modules/plugins/utility/direnv/config.nix b/modules/plugins/utility/direnv/config.nix new file mode 100644 index 00000000..b2211deb --- /dev/null +++ b/modules/plugins/utility/direnv/config.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + + cfg = config.vim.utility.direnv; +in { + vim = mkIf cfg.enable { + startPlugins = ["direnv-vim"]; + }; +} diff --git a/modules/plugins/utility/direnv/default.nix b/modules/plugins/utility/direnv/default.nix new file mode 100644 index 00000000..7a489920 --- /dev/null +++ b/modules/plugins/utility/direnv/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./direnv.nix + ]; +} diff --git a/modules/plugins/utility/direnv/direnv.nix b/modules/plugins/utility/direnv/direnv.nix new file mode 100644 index 00000000..98d3f1f6 --- /dev/null +++ b/modules/plugins/utility/direnv/direnv.nix @@ -0,0 +1,5 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption; +in { + options.vim.utility.direnv.enable = mkEnableOption "syncing nvim shell environment with direnv's using `direnv.vim`"; +} diff --git a/npins/sources.json b/npins/sources.json index 8a4e555e..b69bf509 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -315,6 +315,18 @@ "url": "https://github.com/sindrets/diffview.nvim/archive/4516612fe98ff56ae0415a259ff6361a89419b0a.tar.gz", "hash": "0brabpd02596hg98bml118bx6z2sly98kf1cr2p0xzybiinb4zs9" }, + "direnv-vim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "direnv", + "repo": "direnv.vim" + }, + "branch": "master", + "revision": "ab2a7e08dd630060cd81d7946739ac7442a4f269", + "url": "https://github.com/direnv/direnv.vim/archive/ab2a7e08dd630060cd81d7946739ac7442a4f269.tar.gz", + "hash": "1hhwfnaj9ibz17ggxvhzrkinghfy51fqfa0bs482z484jpvjc31g" + }, "dracula": { "type": "Git", "repository": { From 9e35fd8d02c745291c0a0504baae53bcad5c8637 Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 22:33:11 -0500 Subject: [PATCH 06/11] completion/blink-cmp: blink sources options Use a submodule to allow arbitrary source additions. Automatically load sources that are enabled. Automatically add enabled sources via blink-cmp setupOpts. Prepopulate with a few basic sources, disabled by default. --- docs/release-notes/rl-0.8.md | 1 + .../completion/blink-cmp/blink-cmp.nix | 61 ++++++++++++++++++- .../plugins/completion/blink-cmp/config.nix | 56 +++++++++++------ npins/sources.json | 36 +++++++++++ 4 files changed, 136 insertions(+), 18 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 5cf939be..a28ffd67 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -206,6 +206,7 @@ for in-neovim `nix develop`, `nix shell` and more. - Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic syncing of nvim shell environment with direnv's. +- Add [blink.cmp] source options and some default-disabled sources. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/completion/blink-cmp/blink-cmp.nix b/modules/plugins/completion/blink-cmp/blink-cmp.nix index 13cdb9f4..9bb76b71 100644 --- a/modules/plugins/completion/blink-cmp/blink-cmp.nix +++ b/modules/plugins/completion/blink-cmp/blink-cmp.nix @@ -2,7 +2,7 @@ inherit (lib.options) mkEnableOption mkOption literalMD; inherit (lib.types) listOf str either attrsOf submodule enum anything int nullOr; inherit (lib.generators) mkLuaInline; - inherit (lib.nvim.types) mkPluginSetupOption luaInline; + inherit (lib.nvim.types) mkPluginSetupOption luaInline pluginType; inherit (lib.nvim.binds) mkMappingOption; inherit (lib.nvim.config) mkBool; @@ -118,5 +118,64 @@ in { scrollDocsUp = mkMappingOption "Scroll docs up [blink.cmp]" ""; scrollDocsDown = mkMappingOption "Scroll docs down [blink.cmp]" ""; }; + + sourcePlugins = let + sourcePluginType = submodule { + options = { + package = mkOption { + type = pluginType; + description = '' + `blink-cmp` source plugin package. + ''; + }; + module = mkOption { + type = str; + description = '' + Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers..module`. + + Should be present in the source's documentation. + ''; + }; + enable = mkEnableOption "this source"; + }; + }; + in + mkOption { + type = submodule { + freeformType = attrsOf sourcePluginType; + options = let + defaultSourcePluginOption = name: package: module: { + package = mkOption { + type = pluginType; + default = package; + description = '' + `blink-cmp` ${name} source plugin package. + ''; + }; + module = mkOption { + type = str; + default = module; + description = '' + Value of {option}`vim.autocomplete.blink-cmp.setupOpts.sources.providers.${name}.module`. + ''; + }; + enable = mkEnableOption "${name} source"; + }; + in { + # emoji completion after : + emoji = defaultSourcePluginOption "emoji" "blink-emoji-nvim" "blink-emoji"; + # spelling suggestions as completions + spell = defaultSourcePluginOption "spell" "blink-cmp-spell" "blink-cmp-spell"; + # words from nearby files + ripgrep = defaultSourcePluginOption "ripgrep" "blink-ripgrep-nvim" "blink-ripgrep"; + }; + }; + default = {}; + description = '' + `blink.cmp` sources. + + Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`. + ''; + }; }; } diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix index 914821f9..96ced502 100644 --- a/modules/plugins/completion/blink-cmp/config.nix +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -6,6 +6,8 @@ inherit (lib.modules) mkIf; inherit (lib.strings) optionalString; inherit (lib.generators) mkLuaInline; + inherit (lib.attrsets) attrValues filterAttrs; + inherit (lib.lists) map; inherit (lib.nvim.lua) toLuaObject; inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs; @@ -19,9 +21,12 @@ else if (plugin ? pname && (tryEval plugin.pname).success) then plugin.pname else plugin.name; + + enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins; + blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources); in { vim = mkIf cfg.enable { - startPlugins = ["blink-compat"]; + startPlugins = ["blink-compat"] ++ blinkSourcePlugins; lazy.plugins = { blink-cmp = { package = "blink-cmp"; @@ -32,12 +37,14 @@ in { # # event = ["InsertEnter" "CmdlineEnter"]; - after = '' - ${optionalString config.vim.lazy.enable - (concatStringsSep "\n" (map - (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") - cmpCfg.sourcePlugins))} - ''; + after = + # lua + '' + ${optionalString config.vim.lazy.enable + (concatStringsSep "\n" (map + (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") + cmpCfg.sourcePlugins))} + ''; }; }; @@ -45,13 +52,26 @@ in { enableSharedCmpSources = true; blink-cmp.setupOpts = { sources = { - default = ["lsp" "path" "snippets" "buffer"] ++ (attrNames cmpCfg.sources); + default = + [ + "lsp" + "path" + "snippets" + "buffer" + ] + ++ (attrNames cmpCfg.sources) + ++ (attrNames enabledBlinkSources); providers = mapAttrs (name: _: { inherit name; module = "blink.compat.source"; }) - cmpCfg.sources; + cmpCfg.sources + // (mapAttrs (name: definition: { + inherit name; + inherit (definition) module; + }) + enabledBlinkSources); }; snippets = mkIf config.vim.snippets.luasnip.enable { preset = "luasnip"; @@ -67,16 +87,18 @@ in { ${mappings.next} = [ "select_next" "snippet_forward" - (mkLuaInline '' - function(cmp) - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + (mkLuaInline + # lua + '' + function(cmp) + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + has_words_before = col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - if has_words_before then - return cmp.show() + if has_words_before then + return cmp.show() + end end - end - '') + '') "fallback" ]; ${mappings.previous} = [ diff --git a/npins/sources.json b/npins/sources.json index b69bf509..a68a1ea4 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -51,6 +51,18 @@ "url": "https://api.github.com/repos/saghen/blink.cmp/tarball/v0.12.4", "hash": "0jdifjifxjqa8r80wlqgkn5rm48wziap92340xz228nrgd0c9g69" }, + "blink-cmp-spell": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "ribru17", + "repo": "blink-cmp-spell" + }, + "branch": "master", + "revision": "38d6797dea6f72baa6e8b3bfca6da96d8fcac64d", + "url": "https://github.com/ribru17/blink-cmp-spell/archive/38d6797dea6f72baa6e8b3bfca6da96d8fcac64d.tar.gz", + "hash": "19pnasa446iiapgsr3z2fpk0nnrzh8g5wrzrq8n0y4q0z6spc9f6" + }, "blink-compat": { "type": "Git", "repository": { @@ -63,6 +75,30 @@ "url": "https://github.com/saghen/blink.compat/archive/4104671562c663d059d91a99da3780bead5bc467.tar.gz", "hash": "0bsf8kg5s3m1xk9d4n0yl0h5xyk484hip3z8va547f6ibim9ccv4" }, + "blink-emoji-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "moyiz", + "repo": "blink-emoji.nvim" + }, + "branch": "master", + "revision": "a77aebc092ebece1eed108f301452ae774d6b67a", + "url": "https://github.com/moyiz/blink-emoji.nvim/archive/a77aebc092ebece1eed108f301452ae774d6b67a.tar.gz", + "hash": "0n4qv2mk7zx910gnwf9ri2w5qxwx8szx99nqqzik4yyvl4axm41d" + }, + "blink-ripgrep-nvim": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "mikavilpas", + "repo": "blink-ripgrep.nvim" + }, + "branch": "main", + "revision": "305e1ae5363f527abdfd71915a3fe1f42af52824", + "url": "https://github.com/mikavilpas/blink-ripgrep.nvim/archive/305e1ae5363f527abdfd71915a3fe1f42af52824.tar.gz", + "hash": "1hcfyicgf33dlr2hhgnhhzdcxxqw1v8v1yjfbnwvlcsgw0rhjl8w" + }, "bufdelete-nvim": { "type": "Git", "repository": { From 449b943b9579f8104438fa4d580333c54c74bfca Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 23:17:19 -0500 Subject: [PATCH 07/11] completion/blink-cmp: option to enable friendly-snippets Just adds it to the environment, `blink-cmp` will pick up on it automatically. --- docs/release-notes/rl-0.8.md | 3 +++ modules/plugins/completion/blink-cmp/blink-cmp.nix | 2 ++ modules/plugins/completion/blink-cmp/config.nix | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index a28ffd67..dfc232b8 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -207,6 +207,9 @@ - Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic syncing of nvim shell environment with direnv's. - Add [blink.cmp] source options and some default-disabled sources. +- Add [blink.cmp] option to add + [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) + so blink.cmp can source snippets from it. [TheColorman](https://github.com/TheColorman) diff --git a/modules/plugins/completion/blink-cmp/blink-cmp.nix b/modules/plugins/completion/blink-cmp/blink-cmp.nix index 9bb76b71..4290e1cb 100644 --- a/modules/plugins/completion/blink-cmp/blink-cmp.nix +++ b/modules/plugins/completion/blink-cmp/blink-cmp.nix @@ -177,5 +177,7 @@ in { Attribute names must be source names used in {option}`vim.autocomplete.blink-cmp.setupOpts.sources.default`. ''; }; + + friendly-snippets.enable = mkEnableOption "friendly-snippets for blink to source from automatically"; }; } diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix index 96ced502..875a4fd4 100644 --- a/modules/plugins/completion/blink-cmp/config.nix +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -7,7 +7,7 @@ inherit (lib.strings) optionalString; inherit (lib.generators) mkLuaInline; inherit (lib.attrsets) attrValues filterAttrs; - inherit (lib.lists) map; + inherit (lib.lists) map optional; inherit (lib.nvim.lua) toLuaObject; inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs; @@ -26,7 +26,7 @@ blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources); in { vim = mkIf cfg.enable { - startPlugins = ["blink-compat"] ++ blinkSourcePlugins; + startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets"); lazy.plugins = { blink-cmp = { package = "blink-cmp"; From 0e00c41a42f11b0bc28c3a5523e52bce9b1d1c15 Mon Sep 17 00:00:00 2001 From: alfarel Date: Tue, 25 Feb 2025 23:37:33 -0500 Subject: [PATCH 08/11] docs/release-notes: fix missing colons and periods Also fixes a misaligned contributor name. --- docs/release-notes/rl-0.8.md | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index dfc232b8..cf4dd169 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -3,7 +3,7 @@ ## Breaking changes - `git-conflict` keybinds are now prefixed with `` to avoid conflicting - with builtins + with builtins. [NotAShelf](https://github.com/notashelf): @@ -18,7 +18,7 @@ - Add a search widget to the options page in the nvf manual. - Add [render-markdown.nvim] under - `languages.markdown.extensions.render-markdown-nvim` + `languages.markdown.extensions.render-markdown-nvim`. - Implement [](#opt-vim.git.gitsigns.setupOpts) for user-specified setup table in gitsigns configuration. @@ -62,7 +62,7 @@ [blink.cmp]: https://github.com/saghen/blink.cmp -- Add [blink.cmp] support +- Add [blink.cmp] support. [diniamo](https://github.com/diniamo): @@ -76,8 +76,8 @@ [aerial.nvim]: (https://github.com/stevearc/aerial.nvim) [nvim-ufo]: (https://github.com/kevinhwang91/nvim-ufo) -- Add [aerial.nvim] -- Add [nvim-ufo] +- Add [aerial.nvim]. +- Add [nvim-ufo]. [LilleAila](https://github.com/LilleAila): @@ -160,7 +160,7 @@ Inspiration from `vim.languages.clang.dap` implementation. - Add [leetcode.nvim] plugin under `vim.utility.leetcode-nvim`. -[nezia1](https://github.com/nezia1) +[nezia1](https://github.com/nezia1): - Add support for [nixd](https://github.com/nix-community/nixd) language server. @@ -170,30 +170,31 @@ available plugins, under `vim.utility.multicursors`. - Add [hydra.nvim](https://github.com/nvimtools/hydra.nvim) as dependency for `multicursors.nvim` and lazy loads by default. - [folospior](https://github.com/folospior) + +[folospior](https://github.com/folospior): - Fix plugin name for lsp/lspkind. - Move `vim-illuminate` to `setupOpts format` -[iynaix](https://github.com/iynaix) +[iynaix](https://github.com/iynaix): - Add lsp options support for [nixd](https://github.com/nix-community/nixd) language server. -[Mr-Helpful](https://github.com/Mr-Helpful) +[Mr-Helpful](https://github.com/Mr-Helpful): -- Corrects pin names used for nvim themes +- Corrects pin names used for nvim themes. -[Libadoxon](https://github.com/Libadoxon) +[Libadoxon](https://github.com/Libadoxon): - Add [git-conflict](https://github.com/akinsho/git-conflict.nvim) plugin for - resolving git conflicts + resolving git conflicts. - Add formatters for go: [gofmt](https://go.dev/blog/gofmt), [golines](https://github.com/segmentio/golines) and - [gofumpt](https://github.com/mvdan/gofumpt) + [gofumpt](https://github.com/mvdan/gofumpt). -[MaxMur](https://github.com/TheMaxMur) +[MaxMur](https://github.com/TheMaxMur): - Add YAML support under `vim.languages.yaml`. @@ -211,7 +212,7 @@ [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so blink.cmp can source snippets from it. -[TheColorman](https://github.com/TheColorman) +[TheColorman](https://github.com/TheColorman): - Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value for `autoload_mode`. From 4648c3b28f004dd2799442da798d81ad1e3cf516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Theodor=20Bj=C3=B6rkman?= <38960155+UltraGhostie@users.noreply.github.com> Date: Thu, 6 Mar 2025 15:40:57 +0100 Subject: [PATCH 09/11] utility/harpoon: init --- docs/release-notes/rl-0.8.md | 21 ++++---- modules/plugins/utility/default.nix | 1 + modules/plugins/utility/harpoon/config.nix | 41 ++++++++++++++++ modules/plugins/utility/harpoon/default.nix | 6 +++ modules/plugins/utility/harpoon/harpoon.nix | 53 +++++++++++++++++++++ npins/sources.json | 12 +++++ 6 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 modules/plugins/utility/harpoon/config.nix create mode 100644 modules/plugins/utility/harpoon/default.nix create mode 100644 modules/plugins/utility/harpoon/harpoon.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index cf4dd169..c2e180ea 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -194,6 +194,10 @@ [golines](https://github.com/segmentio/golines) and [gofumpt](https://github.com/mvdan/gofumpt). +[UltraGhostie](https://github.com/UltraGhostie) + +- Add [harpoon](https://github.com/ThePrimeagen/harpoon) plugin for navigation + [MaxMur](https://github.com/TheMaxMur): - Add YAML support under `vim.languages.yaml`. @@ -201,16 +205,17 @@ [alfarel](https://github.com/alfarelcynthesis): - Add missing `yazi.nvim` dependency (`snacks.nvim`). -- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin - for automatic creation of parent directories when editing a nested file. -- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin - for in-neovim `nix develop`, `nix shell` and more. -- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin - for automatic syncing of nvim shell environment with direnv's. + +- Add [mkdir.nvim](https://github.com/jghauser/mkdir.nvim) plugin for automatic + creation of parent directories when editing a nested file. +- Add [nix-develop.nvim](https://github.com/figsoda/nix-develop.nvim) plugin for + in-neovim `nix develop`, `nix shell` and more. +- Add [direnv.vim](https://github.com/direnv/direnv.vim) plugin for automatic + syncing of nvim shell environment with direnv's. - Add [blink.cmp] source options and some default-disabled sources. - Add [blink.cmp] option to add - [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) - so blink.cmp can source snippets from it. + [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so + blink.cmp can source snippets from it. [TheColorman](https://github.com/TheColorman): diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 0f0956fb..a1574b97 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -6,6 +6,7 @@ ./direnv ./fzf-lua ./gestures + ./harpoon ./icon-picker ./images ./leetcode-nvim diff --git a/modules/plugins/utility/harpoon/config.nix b/modules/plugins/utility/harpoon/config.nix new file mode 100644 index 00000000..487e67e4 --- /dev/null +++ b/modules/plugins/utility/harpoon/config.nix @@ -0,0 +1,41 @@ +{ + options, + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.binds) pushDownDefault mkKeymap; + + cfg = config.vim.navigation.harpoon; + + keys = cfg.mappings; + inherit (options.vim.navigation.harpoon) mappings; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = ["plenary-nvim"]; + + lazy.plugins.harpoon = { + package = "harpoon"; + setupModule = "harpoon"; + inherit (cfg) setupOpts; + + cmd = ["Harpoon"]; + + keys = [ + (mkKeymap "n" keys.markFile "lua require('harpoon'):list():add()" {desc = mappings.markFile.description;}) + (mkKeymap "n" keys.listMarks "lua require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())" {desc = mappings.listMarks.description;}) + (mkKeymap "n" keys.file1 "lua require('harpoon'):list():select(1)" {desc = mappings.file1.description;}) + (mkKeymap "n" keys.file2 "lua require('harpoon'):list():select(2)" {desc = mappings.file2.description;}) + (mkKeymap "n" keys.file3 "lua require('harpoon'):list():select(3)" {desc = mappings.file3.description;}) + (mkKeymap "n" keys.file4 "lua require('harpoon'):list():select(4)" {desc = mappings.file4.description;}) + ]; + }; + + binds.whichKey.register = pushDownDefault { + "a" = "Harpoon Mark"; + }; + }; + }; +} diff --git a/modules/plugins/utility/harpoon/default.nix b/modules/plugins/utility/harpoon/default.nix new file mode 100644 index 00000000..21637c5b --- /dev/null +++ b/modules/plugins/utility/harpoon/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./harpoon.nix + ./config.nix + ]; +} diff --git a/modules/plugins/utility/harpoon/harpoon.nix b/modules/plugins/utility/harpoon/harpoon.nix new file mode 100644 index 00000000..4478c938 --- /dev/null +++ b/modules/plugins/utility/harpoon/harpoon.nix @@ -0,0 +1,53 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) bool; + inherit (lib.nvim.binds) mkMappingOption; + inherit (lib.nvim.types) mkPluginSetupOption luaInline; + inherit (lib.generators) mkLuaInline; +in { + options.vim.navigation.harpoon = { + mappings = { + markFile = mkMappingOption "Mark file [Harpoon]" "a"; + listMarks = mkMappingOption "List marked files [Harpoon]" ""; + file1 = mkMappingOption "Go to marked file 1 [Harpoon]" ""; + file2 = mkMappingOption "Go to marked file 2 [Harpoon]" ""; + file3 = mkMappingOption "Go to marked file 3 [Harpoon]" ""; + file4 = mkMappingOption "Go to marked file 4 [Harpoon]" ""; + }; + + enable = mkEnableOption "Quick bookmarks on keybinds [Harpoon]"; + + setupOpts = mkPluginSetupOption "Harpoon" { + defaults = { + save_on_toggle = mkOption { + type = bool; + default = false; + description = '' + Any time the ui menu is closed then we will save the + state back to the backing list, not to the fs + ''; + }; + sync_on_ui_close = mkOption { + type = bool; + default = false; + description = '' + Any time the ui menu is closed then the state of the + list will be sync'd back to the fs + ''; + }; + key = mkOption { + type = luaInline; + default = mkLuaInline '' + function() + return vim.loop.cwd() + end + ''; + description = '' + How the out list key is looked up. This can be useful + when using worktrees and using git remote instead of file path + ''; + }; + }; + }; + }; +} diff --git a/npins/sources.json b/npins/sources.json index a68a1ea4..f5e12e4b 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -519,6 +519,18 @@ "url": "https://github.com/ellisonleao/gruvbox.nvim/archive/089b60e92aa0a1c6fa76ff527837cd35b6f5ac81.tar.gz", "hash": "0mr8q2xi4s2anibll8lhxax7q1akyg687bp5r58gckkhi04064q4" }, + "harpoon": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "ThePrimeagen", + "repo": "harpoon" + }, + "branch": "harpoon2", + "revision": "ed1f853847ffd04b2b61c314865665e1dadf22c7", + "url": "https://github.com/ThePrimeagen/harpoon/archive/ed1f853847ffd04b2b61c314865665e1dadf22c7.tar.gz", + "hash": "1dcpdlna2lff9dlsh6i4v16qmn5r9279wdvn0ry3xg4abqwnzc9g" + }, "haskell-tools-nvim": { "type": "Git", "repository": { From 4bf2bc9db602fb7ba6e1651e3812b751d725a967 Mon Sep 17 00:00:00 2001 From: Erwin de Vries <139006912+esdevries@users.noreply.github.com> Date: Thu, 6 Mar 2025 21:53:33 +0100 Subject: [PATCH 10/11] theme/supported-themes: add github-nvim-theme (#688) --- docs/release-notes/rl-0.8.md | 6 ++++++ modules/plugins/statusline/lualine/lualine.nix | 11 +++++++++++ modules/plugins/theme/supported-themes.nix | 16 ++++++++++++++++ npins/sources.json | 14 +++++++++++++- 4 files changed, 46 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index c2e180ea..6b5ed694 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -221,3 +221,9 @@ - Fix plugin `setupOpts` for `neovim-session-manager` having an invalid value for `autoload_mode`. + +[esdevries](https://github.com/esdevries): + +[projekt0n/github-nvim-theme]: https://github.com/projekt0n/github-nvim-theme + +- Add `github-nvim-theme` theme from [projekt0n/github-nvim-theme]. diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 6e95f03b..9943f78e 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -21,6 +21,17 @@ "codedark" "dracula" "everforest" + "github_dark" + "github_light" + "github_dark_dimmed" + "github_dark_default" + "github_light_default" + "github_dark_high_contrast" + "github_light_high_contrast" + "github_dark_colorblind" + "github_light_colorblind" + "github_dark_tritanopia" + "github_light_tritanopia" "gruvbox" "gruvbox_dark" "gruvbox_light" diff --git a/modules/plugins/theme/supported-themes.nix b/modules/plugins/theme/supported-themes.nix index 4029a1c0..0b5cb90b 100644 --- a/modules/plugins/theme/supported-themes.nix +++ b/modules/plugins/theme/supported-themes.nix @@ -195,4 +195,20 @@ in { vim.cmd.colorscheme("nord") ''; }; + github = { + setup = { + style ? "dark", + transparent ? false, + ... + }: '' + require('github-theme').setup({ + options = { + transparent = ${boolToString transparent}, + }, + }) + + vim.cmd[[colorscheme github_${style}]] + ''; + styles = ["dark" "light" "dark_dimmed" "dark_default" "light_default" "dark_high_contrast" "light_high_contrast" "dark_colorblind" "light_colorblind" "dark_tritanopia" "light_tritanopia"]; + }; } diff --git a/npins/sources.json b/npins/sources.json index f5e12e4b..bced2451 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -483,6 +483,18 @@ "url": "https://github.com/akinsho/git-conflict.nvim/archive/a1badcd070d176172940eb55d9d59029dad1c5a6.tar.gz", "hash": "05rnwhm1fmg3yb7j2xc9nmw262jc687qxhwabn97qarrk2da0r0a" }, + "github": { + "type": "Git", + "repository": { + "type": "Github", + "owner": "projekt0n", + "repo": "github-nvim-theme" + }, + "branch": "main", + "revision": "c106c9472154d6b2c74b74565616b877ae8ed31d", + "url": "https://github.com/projekt0n/github-nvim-theme/archive/c106c9472154d6b2c74b74565616b877ae8ed31d.tar.gz", + "hash": "/A4hkKTzjzeoR1SuwwklraAyI8oMkhxrwBBV9xb59PA=" + }, "gitsigns-nvim": { "type": "Git", "repository": { @@ -2194,4 +2206,4 @@ } }, "version": 3 -} \ No newline at end of file +} From 414c92276efd552e0491eca8e20c4a68acfec255 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 7 Mar 2025 13:51:54 +0300 Subject: [PATCH 11/11] pins: fix github-nvim-theme repository type --- npins/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npins/sources.json b/npins/sources.json index bced2451..bc149180 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -486,7 +486,7 @@ "github": { "type": "Git", "repository": { - "type": "Github", + "type": "GitHub", "owner": "projekt0n", "repo": "github-nvim-theme" },