From dfd4dc8494be4f09076ce8b1239177c8a5d10420 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 19 Jan 2025 12:52:45 +0100 Subject: [PATCH 01/28] visuals/rainbow-delimiters: init --- docs/release-notes/rl-0.8.md | 1 + flake.lock | 17 +++++++++++++++++ flake.nix | 5 +++++ modules/plugins/visuals/default.nix | 1 + .../visuals/rainbow-delimiters/config.nix | 18 ++++++++++++++++++ .../visuals/rainbow-delimiters/default.nix | 6 ++++++ .../rainbow-delimiters/rainbow-delimiters.nix | 13 +++++++++++++ 7 files changed, 61 insertions(+) create mode 100644 modules/plugins/visuals/rainbow-delimiters/config.nix create mode 100644 modules/plugins/visuals/rainbow-delimiters/default.nix create mode 100644 modules/plugins/visuals/rainbow-delimiters/rainbow-delimiters.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 42927baf..a164d776 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -102,6 +102,7 @@ - `mini.trailspace` - `mini.visits` - Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua` +- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim) in `vim.visuals.rainbow-delimiters` [kaktu5](https://github.com/kaktu5): diff --git a/flake.lock b/flake.lock index 7b7f0bab..c328bda1 100644 --- a/flake.lock +++ b/flake.lock @@ -2361,6 +2361,22 @@ "type": "github" } }, + "plugin-rainbow-delimiters": { + "flake": false, + "locked": { + "lastModified": 1736686348, + "narHash": "sha256-zWHXYs3XdnoszqOFY3hA2L5mNn1a44OAeKv3lL3EMEw=", + "owner": "HiPhish", + "repo": "rainbow-delimiters.nvim", + "rev": "85b80abaa09cbbc039e3095b2f515b3cf8cadd11", + "type": "github" + }, + "original": { + "owner": "HiPhish", + "repo": "rainbow-delimiters.nvim", + "type": "github" + } + }, "plugin-registers": { "flake": false, "locked": { @@ -2893,6 +2909,7 @@ "plugin-precognition-nvim": "plugin-precognition-nvim", "plugin-project-nvim": "plugin-project-nvim", "plugin-promise-async": "plugin-promise-async", + "plugin-rainbow-delimiters": "plugin-rainbow-delimiters", "plugin-registers": "plugin-registers", "plugin-render-markdown-nvim": "plugin-render-markdown-nvim", "plugin-rose-pine": "plugin-rose-pine", diff --git a/flake.nix b/flake.nix index 05b6fc4b..5d4728f6 100644 --- a/flake.nix +++ b/flake.nix @@ -502,6 +502,11 @@ flake = false; }; + plugin-rainbow-delimiters = { + url = "github:HiPhish/rainbow-delimiters.nvim"; + flake = false; + }; + # Minimap plugin-minimap-vim = { url = "github:wfxr/minimap.vim"; diff --git a/modules/plugins/visuals/default.nix b/modules/plugins/visuals/default.nix index 0843654e..3a44aa45 100644 --- a/modules/plugins/visuals/default.nix +++ b/modules/plugins/visuals/default.nix @@ -15,6 +15,7 @@ in { ./nvim-cursorline ./nvim-scrollbar ./nvim-web-devicons + ./rainbow-delimiters ./tiny-devicons-auto-colors ]; } diff --git a/modules/plugins/visuals/rainbow-delimiters/config.nix b/modules/plugins/visuals/rainbow-delimiters/config.nix new file mode 100644 index 00000000..361a0426 --- /dev/null +++ b/modules/plugins/visuals/rainbow-delimiters/config.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + cfg = config.vim.visuals.rainbow-delimiters; +in { + vim = mkIf cfg.enable { + startPlugins = ["rainbow-delimiters"]; + + pluginRC.rainbow-delimiters = entryAnywhere '' + vim.g.rainbow_delimiters = ${toLuaObject cfg.setupOpts} + ''; + }; +} diff --git a/modules/plugins/visuals/rainbow-delimiters/default.nix b/modules/plugins/visuals/rainbow-delimiters/default.nix new file mode 100644 index 00000000..50aaad0e --- /dev/null +++ b/modules/plugins/visuals/rainbow-delimiters/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./rainbow-delimiters.nix + ./config.nix + ]; +} diff --git a/modules/plugins/visuals/rainbow-delimiters/rainbow-delimiters.nix b/modules/plugins/visuals/rainbow-delimiters/rainbow-delimiters.nix new file mode 100644 index 00000000..3fed4a64 --- /dev/null +++ b/modules/plugins/visuals/rainbow-delimiters/rainbow-delimiters.nix @@ -0,0 +1,13 @@ +{ + config, + lib, + ... +}: let + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; +in { + options.vim.visuals.rainbow-delimiters = { + enable = mkEnableOption "rainbow-delimiters"; + setupOpts = mkPluginSetupOption "rainbow-delimiters" {}; + }; +} From fcb6f82892ad1c5831cb369a0328f2abb677f47f Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 19 Jan 2025 18:01:43 +0100 Subject: [PATCH 02/28] highlight: init --- docs/release-notes/rl-0.8.md | 1 + modules/neovim/init/default.nix | 1 + modules/neovim/init/highlight.nix | 106 ++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 modules/neovim/init/highlight.nix diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 42927baf..f835abf1 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -102,6 +102,7 @@ - `mini.trailspace` - `mini.visits` - Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua` +- Add options to define highlights under `vim.highlight` [kaktu5](https://github.com/kaktu5): diff --git a/modules/neovim/init/default.nix b/modules/neovim/init/default.nix index 11d9cf59..b0c7e0ce 100644 --- a/modules/neovim/init/default.nix +++ b/modules/neovim/init/default.nix @@ -2,6 +2,7 @@ imports = [ ./basic.nix ./debug.nix + ./highlight.nix ./spellcheck.nix ]; } diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix new file mode 100644 index 00000000..d00fe74a --- /dev/null +++ b/modules/neovim/init/highlight.nix @@ -0,0 +1,106 @@ +{ + config, + lib, + ... +}: let + inherit (lib.options) mkOption literalExpression; + inherit (lib.types) nullOr attrsOf listOf submodule bool ints str; + inherit (lib.strings) hasPrefix concatStringsSep; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.types) hexColor; + + mkColorOption = target: + mkOption { + type = nullOr hexColor; + default = null; + description = '' + The ${target} color to use. Written as color name or hex "#RRGGBB". + ''; + example = "#ebdbb2"; + }; + + mkBoolOption = name: + mkOption { + type = nullOr bool; + default = null; + description = ''Whether to enable ${name}''; + example = false; + }; + + cfg = config.vim.highlight; +in { + options.vim.highlight = mkOption { + type = attrsOf (submodule { + # See :h nvim_set_hl + options = { + bg = mkColorOption "background"; + fg = mkColorOption "foreground"; + sp = mkColorOption "special"; + blend = mkOption { + type = nullOr (ints.between 0 100); + default = null; + description = "Blend as an integer between 0 and 100"; + }; + bold = mkBoolOption "bold"; + standout = mkBoolOption "standout"; + underline = mkBoolOption "underline"; + undercurl = mkBoolOption "undercurl"; + underdouble = mkBoolOption "underdouble"; + underdotted = mkBoolOption "underdotted"; + underdashed = mkBoolOption "underdashed"; + strikethrough = mkBoolOption "strikethrough"; + italic = mkBoolOption "italic"; + reverse = mkBoolOption "reverse"; + nocombine = mkBoolOption "nocombine"; + link = mkOption { + type = nullOr str; + default = null; + description = "The name of another highlight group to link to"; + }; + default = mkOption { + type = nullOr bool; + default = null; + description = "Don't override existing definition"; + }; + ctermfg = mkOption { + type = nullOr str; + default = null; + description = "The cterm foreground color to use"; + }; + ctermbg = mkOption { + type = nullOr str; + default = null; + description = "The cterm background color to use"; + }; + cterm = mkOption { + type = nullOr (listOf str); + default = null; + description = "The cterm arguments to use. See :h highlight-args"; + }; + force = mkBoolOption "force update"; + }; + }); + default = {}; + description = "Custom highlight to apply"; + example = literalExpression '' + { + SignColumn = { + bg = "#282828"; + }; + } + ''; + }; + + config = { + vim.luaConfigRC.highlight = let + highlights = + mapAttrsToList ( + name: value: ''vim.api.nvim_set_hl(0, ${toLuaObject name}, ${toLuaObject value})'' + ) + cfg; + in + entryAnywhere (concatStringsSep "\n" highlights); + }; +} From 5e3a0dcdc32259e50a78d763a6f5720b73b1de5e Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 19 Jan 2025 18:11:12 +0100 Subject: [PATCH 03/28] highlight: cterm as enum --- modules/neovim/init/highlight.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix index d00fe74a..8c110cac 100644 --- a/modules/neovim/init/highlight.nix +++ b/modules/neovim/init/highlight.nix @@ -4,7 +4,7 @@ ... }: let inherit (lib.options) mkOption literalExpression; - inherit (lib.types) nullOr attrsOf listOf submodule bool ints str; + inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum; inherit (lib.strings) hasPrefix concatStringsSep; inherit (lib.attrsets) mapAttrsToList; inherit (lib.nvim.dag) entryAnywhere; @@ -75,7 +75,22 @@ in { description = "The cterm background color to use"; }; cterm = mkOption { - type = nullOr (listOf str); + type = nullOr (listOf (enum [ + "bold" + "underline" + "undercurl" + "underdouble" + "underdotted" + "underdashed" + "strikethrough" + "reverse" + "inverse" + "italic" + "standout" + "altfont" + "nocombine" + "NONE" + ])); default = null; description = "The cterm arguments to use. See :h highlight-args"; }; From 653e5d6a176378386e803c767aa8da4dbdd96f11 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Sun, 19 Jan 2025 19:36:32 +0100 Subject: [PATCH 04/28] highlight: implement suggestions --- docs/release-notes/rl-0.8.md | 2 +- modules/neovim/init/highlight.nix | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index f835abf1..7fe3d2e5 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -102,7 +102,7 @@ - `mini.trailspace` - `mini.visits` - Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua` -- Add options to define highlights under `vim.highlight` +- Add options to define highlights under [](#opt-vim.highlight) [kaktu5](https://github.com/kaktu5): diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix index 8c110cac..606f1c05 100644 --- a/modules/neovim/init/highlight.nix +++ b/modules/neovim/init/highlight.nix @@ -3,11 +3,11 @@ lib, ... }: let - inherit (lib.options) mkOption literalExpression; + inherit (lib.options) mkOption; inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum; - inherit (lib.strings) hasPrefix concatStringsSep; + inherit (lib.strings) hasPrefix concatLines; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.dag) entryBetween; inherit (lib.nvim.lua) toLuaObject; inherit (lib.nvim.types) hexColor; @@ -15,18 +15,18 @@ mkOption { type = nullOr hexColor; default = null; + example = "#ebdbb2"; description = '' The ${target} color to use. Written as color name or hex "#RRGGBB". ''; - example = "#ebdbb2"; }; mkBoolOption = name: mkOption { type = nullOr bool; default = null; - description = ''Whether to enable ${name}''; example = false; + description = "Whether to enable ${name}"; }; cfg = config.vim.highlight; @@ -98,14 +98,14 @@ in { }; }); default = {}; - description = "Custom highlight to apply"; - example = literalExpression '' + example = '' { SignColumn = { bg = "#282828"; }; } ''; + description = "Custom highlights to apply"; }; config = { @@ -116,6 +116,6 @@ in { ) cfg; in - entryAnywhere (concatStringsSep "\n" highlights); + entryBetween ["lazyConfigs" "pluginConfigs" "extraPluginConfigs"] ["theme"] (concatLines highlights); }; } From 28bbe89fbc92ff6a1b6c180d9812ee6ddf706207 Mon Sep 17 00:00:00 2001 From: LilleAila Date: Mon, 20 Jan 2025 14:16:45 +0100 Subject: [PATCH 05/28] highlight: example without '' --- modules/neovim/init/highlight.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix index 606f1c05..8c7eca82 100644 --- a/modules/neovim/init/highlight.nix +++ b/modules/neovim/init/highlight.nix @@ -98,13 +98,11 @@ in { }; }); default = {}; - example = '' - { - SignColumn = { - bg = "#282828"; - }; - } - ''; + example = { + SignColumn = { + bg = "#282828"; + }; + }; description = "Custom highlights to apply"; }; From f58f41629f82ea7c88a84333ba261369194fe7de Mon Sep 17 00:00:00 2001 From: LilleAila Date: Mon, 20 Jan 2025 14:28:36 +0100 Subject: [PATCH 06/28] highlight: :h reference in single quotes --- modules/neovim/init/highlight.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix index 8c7eca82..7e992fd1 100644 --- a/modules/neovim/init/highlight.nix +++ b/modules/neovim/init/highlight.nix @@ -92,7 +92,7 @@ in { "NONE" ])); default = null; - description = "The cterm arguments to use. See :h highlight-args"; + description = "The cterm arguments to use. See ':h highlight-args'"; }; force = mkBoolOption "force update"; }; From 4b6021073cd9aa09f75c4c2e89fa18cd3224793a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 22 Jan 2025 12:16:03 +0300 Subject: [PATCH 07/28] flake: bump nixpkgs --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index c328bda1..ee19b7c8 100644 --- a/flake.lock +++ b/flake.lock @@ -77,11 +77,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735523292, - "narHash": "sha256-opBsbR/nrGxiiF6XzlVluiHYb6yN/hEwv+lBWTy9xoM=", + "lastModified": 1737370608, + "narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6d97d419e5a9b36e6293887a89a078cf85f5a61b", + "rev": "300081d0cc72df578b02d914df941b8ec62240e6", "type": "github" }, "original": { From 547cbd28b61b605fa7e308f0575d1f4acb7f3aac Mon Sep 17 00:00:00 2001 From: ARCIII <88923299+ArmandoCIII@users.noreply.github.com> Date: Sat, 25 Jan 2025 08:17:48 -0500 Subject: [PATCH 08/28] languages/zig: add dap support (#581) * languages/zig: Added dap support Implemented DAP support for zig. Included comment regarding redundant `dap.adapters.lldb` code when both clang and zig dap modules are enabled. * languages/zig: Added dap support cleanup Cleaned up code from the zig dap implementation for consistency. --- docs/release-notes/rl-0.8.md | 5 +++ modules/plugins/languages/zig.nix | 61 ++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 95bb6661..b06a071f 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -122,3 +122,8 @@ [ruff]: (https://github.com/astral-sh/ruff) - Add [ruff] as a formatter option in `vim.languages.python.format.type`. + +[ARCIII](https://github.com/ArmandoCIII): + +- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. + Code Inspiration from `vim.languages.clang.dap` implementation. diff --git a/modules/plugins/languages/zig.nix b/modules/plugins/languages/zig.nix index 1b9a588b..2aa0e2b6 100644 --- a/modules/plugins/languages/zig.nix +++ b/modules/plugins/languages/zig.nix @@ -8,10 +8,12 @@ inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.lists) isList; - inherit (lib.types) either listOf package str enum; + inherit (lib.types) bool either listOf package str enum; inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.types) mkGrammarOption; + cfg = config.vim.languages.zig; + defaultServer = "zls"; servers = { zls = { @@ -31,7 +33,35 @@ }; }; - cfg = config.vim.languages.zig; + # TODO: dap.adapter.lldb is duplicated when enabling the + # vim.languages.clang.dap module. This does not cause + # breakage... but could be cleaner. + defaultDebugger = "lldb-vscode"; + debuggers = { + lldb-vscode = { + package = pkgs.lldb; + dapConfig = '' + dap.adapters.lldb = { + type = 'executable', + command = '${cfg.dap.package}/bin/lldb-dap', + name = 'lldb' + } + dap.configurations.zig = { + { + name = 'Launch', + type = 'lldb', + request = 'launch', + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = "''${workspaceFolder}", + stopOnEntry = false, + args = {}, + }, + } + ''; + }; + }; in { options.vim.languages.zig = { enable = mkEnableOption "Zig language support"; @@ -56,6 +86,26 @@ in { default = pkgs.zls; }; }; + + dap = { + enable = mkOption { + type = bool; + default = config.vim.languages.enableDAP; + description = "Enable Zig Debug Adapter"; + }; + + debugger = mkOption { + type = enum (attrNames debuggers); + default = defaultDebugger; + description = "Zig debugger to use"; + }; + + package = mkOption { + type = package; + default = debuggers.${cfg.dap.debugger}.package; + description = "Zig debugger package."; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -77,5 +127,12 @@ in { globals.zig_fmt_autosave = mkDefault 0; }; }) + + (mkIf cfg.dap.enable { + vim = { + debugger.nvim-dap.enable = true; + debugger.nvim-dap.sources.zig-debugger = debuggers.${cfg.dap.debugger}.dapConfig; + }; + }) ]); } From 9a9340960609a25762379113f6634c317decffc6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 19 Jan 2025 20:26:52 +0300 Subject: [PATCH 09/28] lsp/lightbulb: cleanup; modularize autocommand behaviour --- docs/release-notes/rl-0.8.md | 16 +++++++++--- modules/plugins/lsp/lightbulb/config.nix | 27 +++++++++++++++++---- modules/plugins/lsp/lightbulb/lightbulb.nix | 22 +++++++++++++++-- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index b06a071f..f5e9d0a0 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -31,6 +31,12 @@ your Editorconfig configuration, or use an autocommand to set indentation values for buffers with the Nix filetype. +- Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the + previously managed lightbulb autocommand. + - A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and + `vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time. + Pick only one. + [amadaluzia](https://github.com/amadaluzia): [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim @@ -59,7 +65,8 @@ - Add `vim.snippets.luasnip.setupOpts`, which was previously missing. - Add `"prettierd"` as a formatter option in `vim.languages.markdown.format.type`. -- Add the following plugins from [mini.nvim](https://github.com/echasnovski/mini.nvim) +- Add the following plugins from + [mini.nvim](https://github.com/echasnovski/mini.nvim) - `mini.ai` - `mini.align` - `mini.animate` @@ -102,7 +109,8 @@ - `mini.trailspace` - `mini.visits` - Add [fzf-lua](https://github.com/ibhagwan/fzf-lua) in `vim.fzf-lua` -- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim) in `vim.visuals.rainbow-delimiters` +- Add [rainbow-delimiters](https://github.com/HiPhish/rainbow-delimiters.nvim) + in `vim.visuals.rainbow-delimiters` - Add options to define highlights under [](#opt-vim.highlight) [kaktu5](https://github.com/kaktu5): @@ -125,5 +133,5 @@ [ARCIII](https://github.com/ArmandoCIII): -- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. - Code Inspiration from `vim.languages.clang.dap` implementation. +- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code + Inspiration from `vim.languages.clang.dap` implementation. diff --git a/modules/plugins/lsp/lightbulb/config.nix b/modules/plugins/lsp/lightbulb/config.nix index f17b8ad9..17e740ad 100644 --- a/modules/plugins/lsp/lightbulb/config.nix +++ b/modules/plugins/lsp/lightbulb/config.nix @@ -4,6 +4,7 @@ ... }: let inherit (lib.modules) mkIf; + inherit (lib.strings) optionalString; inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.lua) toLuaObject; @@ -12,13 +13,29 @@ in { config = mkIf (cfg.enable && cfg.lightbulb.enable) { vim = { startPlugins = ["nvim-lightbulb"]; - pluginRC.lightbulb = entryAnywhere '' - vim.api.nvim_command('autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()') - - -- Enable trouble diagnostics viewer - require'nvim-lightbulb'.setup(${toLuaObject cfg.lightbulb.setupOpts}) + local nvim_lightbulb = require("nvim-lightbulb") + nvim_lightbulb.setup(${toLuaObject cfg.lightbulb.setupOpts}) + ${optionalString cfg.lightbulb.autocmd.enable '' + vim.api.nvim_create_autocmd(${toLuaObject cfg.lightbulb.autocmd.events}, { + pattern = ${toLuaObject cfg.lightbulb.autocmd.pattern}, + callback = function() + nvim_lightbulb.update_lightbulb() + end, + }) + ''} ''; }; + + warnings = [ + # This could have been an assertion, but the chances of collision is very low and asserting here + # might be too dramatic. Let's only warn the user, *in case* this occurs and is not intended. No + # error will be thrown if 'lightbulb.setupOpts.autocmd.enable' has not been set by the user. + (mkIf (cfg.lightbulb.autocmd.enable -> (cfg.lightbulb.setupOpts.autocmd.enabled or false)) '' + Both 'vim.lsp.lightbulb.autocmd.enable' and 'vim.lsp.lightbulb.setupOpts.autocmd.enable' are set + simultaneously. This might have performance implications due to frequent updates. Please set only + one option to handle nvim-lightbulb autocmd. + '') + ]; }; } diff --git a/modules/plugins/lsp/lightbulb/lightbulb.nix b/modules/plugins/lsp/lightbulb/lightbulb.nix index 4341cac6..012d54aa 100644 --- a/modules/plugins/lsp/lightbulb/lightbulb.nix +++ b/modules/plugins/lsp/lightbulb/lightbulb.nix @@ -1,11 +1,29 @@ {lib, ...}: let - inherit (lib.options) mkEnableOption; - inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) listOf str either; + inherit (lib.nvim.types) mkPluginSetupOption luaInline; in { options.vim.lsp = { lightbulb = { enable = mkEnableOption "Lightbulb for code actions. Requires an emoji font"; setupOpts = mkPluginSetupOption "nvim-lightbulb" {}; + autocmd = { + enable = mkEnableOption "updating lightbulb glyph automatically" // {default = true;}; + events = mkOption { + type = listOf str; + default = ["CursorHold" "CursorHoldI"]; + description = "Events on which to update nvim-lightbulb glyphs"; + }; + + pattern = mkOption { + type = either str luaInline; + default = "*"; + description = '' + File patterns or buffer names to match, determining which files or buffers trigger + glyph updates. + ''; + }; + }; }; }; } From a5b7b17947e42d3a990d2db8361d794987b1d963 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 25 Jan 2025 17:21:08 +0300 Subject: [PATCH 10/28] docs: improve manpages; mention helpful utilities --- docs/man/header.5 | 15 +++++++++------ docs/man/nvf.1 | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/docs/man/header.5 b/docs/man/header.5 index a28fc3dd..556a113a 100644 --- a/docs/man/header.5 +++ b/docs/man/header.5 @@ -1,13 +1,16 @@ -.TH "nvf" "5" "01/01/1980" "nvf" +.TH "nvf" "5" "January 1, 1980" "nvf" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" enable line breaks after slashes .cflags 4 / + .SH "NAME" -nvf configuration specification -.SH "OPTIONS" -.PP -You can use the following options to configure nvf: -.PP +nvf \- Configuration specification for the nvf. + +.SH "DESCRIPTION" +The nvf configuration specification provides a declarative structure for configuring Neovim using Nix with few +lines of Nix. This document outlines the available options and their usage to create modular, reusable, and +reproducible configurations using nvf's module system options. For tips, tricks and possible quirks with available +plugins please visit https://notashelf.github.io/nvf/ diff --git a/docs/man/nvf.1 b/docs/man/nvf.1 index 0f1e36dc..d7519651 100644 --- a/docs/man/nvf.1 +++ b/docs/man/nvf.1 @@ -1,5 +1,5 @@ .Dd January 1, 1980 -.Dt nvf 1 +.Dt NVF 1 .Os nvf .\" disable hyphenation .nh @@ -7,27 +7,46 @@ .ad l .\" enable line breaks after slashes .cflags 4 / + .Sh NAME .Nm nvf -.Nd A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS. -. +.Nd A modular, extensible, and distro-agnostic Neovim configuration framework for Nix/NixOS. + +.Sh DESCRIPTION +.Nm nvf +is a highly modular, configurable, extensible, and easy-to-use Neovim configuration in Nix. +Designed for flexibility and ease of use, nvf allows you to easily configure your fully featured +Neovim instance with a few lines of Nix. + +.Sh COMMANDS +The following commands are bundled with nvf to allow easier debugging of your configuration. + +.Bl -tag -width Ds +.It Nm nvf-print-config +Outputs the full configuration of the current `nvf` setup. This command is useful for debugging +or inspecting the applied configuration. +.Pp +.It Nm nvf-print-config-path +Prints the file path to the configuration file currently in use. This command is helpful for locating +the source configuration file for troubleshooting or easily sharing it via online paste utilities. +.El + .Sh BUGS .Pp -Please report any bugs that you might encounter on the -\m[blue]\fBproject issue tracker\fR\m[]\&. +Please report any bugs on the project issue tracker: +.Lk https://github.com/notashelf/nvf/issues .Sh SEE ALSO .Pp -\fBnvf\fR(5) +.Fn nvf 5 .Sh AUTHOR .Pp -\fBnvf contributors\fR +.Fn nvf contributors .RS 4 -Author. +Primary contributors and maintainers of the project. .RE .Sh COPYRIGHT -.br -Copyright \(co 2023\(en2024 nvf contributors -.br +.Pp +Copyright (c) 2023–2025 nvf contributors. From 0fbcf1ca6f6bb6eb7b2aa779559c294d8b0b9951 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 26 Jan 2025 13:45:58 +0300 Subject: [PATCH 11/28] utility/yanky-nvim: init --- configuration.nix | 1 + docs/release-notes/rl-0.8.md | 4 +++ flake.lock | 17 ++++++++++ flake.nix | 5 +++ modules/plugins/utility/default.nix | 18 +++++------ modules/plugins/utility/yanky-nvim/config.nix | 32 +++++++++++++++++++ .../plugins/utility/yanky-nvim/default.nix | 6 ++++ .../plugins/utility/yanky-nvim/yanky-nvim.nix | 28 ++++++++++++++++ 8 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 modules/plugins/utility/yanky-nvim/config.nix create mode 100644 modules/plugins/utility/yanky-nvim/default.nix create mode 100644 modules/plugins/utility/yanky-nvim/yanky-nvim.nix diff --git a/configuration.nix b/configuration.nix index 2159edc8..594e292f 100644 --- a/configuration.nix +++ b/configuration.nix @@ -175,6 +175,7 @@ isMaximal: { icon-picker.enable = isMaximal; surround.enable = isMaximal; diffview-nvim.enable = true; + yanky-nvim.enable = false; motion = { hop.enable = true; leap.enable = true; diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index f5e9d0a0..661aee1d 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -4,6 +4,7 @@ [typst-preview.nvim]: https://github.com/chomosuke/typst-preview.nvim [render-markdown.nvim]: https://github.com/MeanderingProgrammer/render-markdown.nvim +[yanky.nvim]: https://github.com/gbprod/yanky.nvim - Add [typst-preview.nvim] under `languages.typst.extensions.typst-preview-nvim`. @@ -33,10 +34,13 @@ - Add [](#opt-vim.lsp.lightbulb.autocmd.enable) for manually managing the previously managed lightbulb autocommand. + - A warning will occur if [](#opt-vim.lsp.lightbulb.autocmd.enable) and `vim.lsp.lightbulb.setupOpts.autocmd.enabled` are both set at the same time. Pick only one. +- Add [yanky.nvim] to available plugins, under `vim.utility.yanky-nvim`. + [amadaluzia](https://github.com/amadaluzia): [haskell-tools.nvim]: https://github.com/MrcJkb/haskell-tools.nvim diff --git a/flake.lock b/flake.lock index ee19b7c8..2b0136fd 100644 --- a/flake.lock +++ b/flake.lock @@ -2761,6 +2761,22 @@ "type": "github" } }, + "plugin-yanky-nvim": { + "flake": false, + "locked": { + "lastModified": 1737126873, + "narHash": "sha256-Gt8kb6sZoNIM2SDWUPyAF5Tw99qMZl+ltUCfyMXgJsU=", + "owner": "gbprod", + "repo": "yanky.nvim", + "rev": "d2696b30e389dced94d5acab728f524a25f308d2", + "type": "github" + }, + "original": { + "owner": "gbprod", + "repo": "yanky.nvim", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", @@ -2934,6 +2950,7 @@ "plugin-vim-repeat": "plugin-vim-repeat", "plugin-vim-startify": "plugin-vim-startify", "plugin-which-key": "plugin-which-key", + "plugin-yanky-nvim": "plugin-yanky-nvim", "systems": "systems_2" } }, diff --git a/flake.nix b/flake.nix index 5d4728f6..52635132 100644 --- a/flake.nix +++ b/flake.nix @@ -590,6 +590,11 @@ flake = false; }; + plugin-yanky-nvim = { + url = "github:gbprod/yanky.nvim"; + flake = false; + }; + # Note-taking plugin-obsidian-nvim = { url = "github:epwalsh/obsidian.nvim"; diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 8b25ea8f..65ef8680 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -1,19 +1,19 @@ { imports = [ - ./outline ./binds ./ccc + ./diffview + ./fzf-lua ./gestures - ./motion - ./new-file-template - ./telescope ./icon-picker ./images - ./telescope - ./diffview - ./wakatime - ./surround + ./motion + ./new-file-template + ./outline ./preview - ./fzf-lua + ./surround + ./telescope + ./wakatime + ./yanky-nvim ]; } diff --git a/modules/plugins/utility/yanky-nvim/config.nix b/modules/plugins/utility/yanky-nvim/config.nix new file mode 100644 index 00000000..138fd07d --- /dev/null +++ b/modules/plugins/utility/yanky-nvim/config.nix @@ -0,0 +1,32 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (lib.modules) mkIf; + inherit (lib.lists) optionals concatLists; + inherit (lib.nvim.lua) toLuaObject; + inherit (lib.nvim.dag) entryAnywhere; + + cfg = config.vim.utility.yanky-nvim; + usingSqlite = cfg.setupOpts.ring.storage == "sqlite"; +in { + config = mkIf cfg.enable { + vim = { + # TODO: this could probably be lazyloaded. I'm not yet sure which event is + # ideal, so it's loaded normally for now. + startPlugins = concatLists [ + ["yanky-nvim"] + + # If using the sqlite backend, sqlite-lua must be loaded + # alongside yanky. + (optionals usingSqlite [pkgs.vimPlugins.sqlite-lua]) + ]; + + pluginRC.yanky-nvim = entryAnywhere '' + require("yanky").setup(${toLuaObject cfg.setupOpts}); + ''; + }; + }; +} diff --git a/modules/plugins/utility/yanky-nvim/default.nix b/modules/plugins/utility/yanky-nvim/default.nix new file mode 100644 index 00000000..05cb2bea --- /dev/null +++ b/modules/plugins/utility/yanky-nvim/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./yanky-nvim.nix + ]; +} diff --git a/modules/plugins/utility/yanky-nvim/yanky-nvim.nix b/modules/plugins/utility/yanky-nvim/yanky-nvim.nix new file mode 100644 index 00000000..95d6a211 --- /dev/null +++ b/modules/plugins/utility/yanky-nvim/yanky-nvim.nix @@ -0,0 +1,28 @@ +{lib, ...}: let + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) enum; +in { + options.vim.utility.yanky-nvim = { + enable = mkEnableOption '' + improved Yank and Put functionalities for Neovim [yanky-nvim] + ''; + + setupOpts = { + ring.storage = mkOption { + type = enum ["shada" "sqlite" "memory"]; + default = "shada"; + example = "sqlite"; + description = '' + storage mode for ring values. + + - shada: this will save pesistantly using Neovim ShaDa feature. + This means that history will be persisted between each session of Neovim. + - memory: each Neovim instance will have his own history and it will be + lost between sessions. + - sqlite: more reliable than `shada`, requires `sqlite.lua` as a dependency. + nvf will add this dependency to `PATH` automatically. + ''; + }; + }; + }; +} From ee89d9d5bc441dcb5de6068450d53275b852d9e5 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 30 Jan 2025 14:12:58 +0300 Subject: [PATCH 12/28] flake: bump rustaceanvim --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 2b0136fd..81738ba6 100644 --- a/flake.lock +++ b/flake.lock @@ -2460,11 +2460,11 @@ "plugin-rustaceanvim": { "flake": false, "locked": { - "lastModified": 1735431742, - "narHash": "sha256-ucZXGbxHtbSKf5n11lL3vb6rD2BxJacIDOgcx32PLzA=", + "lastModified": 1738187731, + "narHash": "sha256-Z4aCPO4MR0Q2ZojT6YBGSa8fb7u5Nd+4Z/rekqhXqDY=", "owner": "mrcjkb", "repo": "rustaceanvim", - "rev": "51c097ebfb65d83baa71f48000b1e5c0a8dcc4fb", + "rev": "4a2f2d2cc04f5b0aa0981f98bb7d002c898318ad", "type": "github" }, "original": { From e5f6aa23ea63dcbf6c918157cf5b9c818286e958 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 31 Jan 2025 01:19:48 +0300 Subject: [PATCH 13/28] flake: change nvim-colorizer URL to the new repo --- flake.lock | 10 +++++----- flake.nix | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 81738ba6..8e5a40d7 100644 --- a/flake.lock +++ b/flake.lock @@ -1836,15 +1836,15 @@ "plugin-nvim-colorizer-lua": { "flake": false, "locked": { - "lastModified": 1735384185, - "narHash": "sha256-quqs3666vQc/4ticc/Z5BHzGxV6UUVE9jVGT07MEMQQ=", - "owner": "NvChad", + "lastModified": 1738229011, + "narHash": "sha256-IEgZnIUeNXRKZ4eV1+KknluyKZj68HBWe1EW+LueuGA=", + "owner": "catgoose", "repo": "nvim-colorizer.lua", - "rev": "8a65c448122fc8fac9c67b2e857b6e830a4afd0b", + "rev": "9b5fe0450bfb2521c6cea29391e5ec571f129136", "type": "github" }, "original": { - "owner": "NvChad", + "owner": "catgoose", "repo": "nvim-colorizer.lua", "type": "github" } diff --git a/flake.nix b/flake.nix index 52635132..eb7f5904 100644 --- a/flake.nix +++ b/flake.nix @@ -645,7 +645,7 @@ }; plugin-nvim-colorizer-lua = { - url = "github:NvChad/nvim-colorizer.lua"; + url = "github:catgoose/nvim-colorizer.lua"; flake = false; }; From 944327329712eda9eec8a86a972e0abd7ea368e6 Mon Sep 17 00:00:00 2001 From: Etherbloom Date: Sun, 2 Feb 2025 15:02:26 +0100 Subject: [PATCH 14/28] languages/ts: register javascript with prettier formatter (#595) --- modules/plugins/languages/ts.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/languages/ts.nix b/modules/plugins/languages/ts.nix index 2530d352..50e6d91c 100644 --- a/modules/plugins/languages/ts.nix +++ b/modules/plugins/languages/ts.nix @@ -82,7 +82,7 @@ ls_sources, null_ls.builtins.formatting.prettier.with({ command = "${cfg.format.package}/bin/prettier", - filetypes = { "typescript" }, + filetypes = { "typescript", "javascript" }, }) ) ''; From 90abd270a68f8de59363ff8c63dcc7e7d561f92c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 28 Jan 2025 16:17:02 +0300 Subject: [PATCH 15/28] meta: include hacking guidelines in PR template --- .../pull_request_template.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index b2a26919..66fe9c0f 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -7,14 +7,17 @@ or dependency in this section. If your pull request aims to fix an open issue or a please bug, please also link the relevant issue below this line. You may attach an issue to your pull request with `Fixes #` outside this comment, and it will be closed when your pull request is merged. + +A developer package template is provided in flake/develop.nix. If working on a module, you may use +it to test your changes with minimal dependency changes. --> ## Sanity Checking --- From 7b886c98795147464ab69e55d0d19ce4653c773f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 28 Jan 2025 16:17:52 +0300 Subject: [PATCH 16/28] docs/options: mention manpages for offline viewing --- docs/manual/options.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/manual/options.md b/docs/manual/options.md index 3b70484f..b386347d 100644 --- a/docs/manual/options.md +++ b/docs/manual/options.md @@ -4,6 +4,10 @@ Below are the module options provided by nvf, in no particular order. Most options will include useful comments, warnings or setup tips on how a module option is meant to be used as well as examples in complex cases. +An offline version of this page is bundled with nvf as a part of the manpages +which you can access with `man 5 nvf`. Please us know if you believe any of the +options below are missing useful examples. +