diff --git a/docs/man/header.5 b/docs/man/header.5 index 556a113a..a28fc3dd 100644 --- a/docs/man/header.5 +++ b/docs/man/header.5 @@ -1,16 +1,13 @@ -.TH "nvf" "5" "January 1, 1980" "nvf" +.TH "nvf" "5" "01/01/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 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/ +nvf configuration specification +.SH "OPTIONS" +.PP +You can use the following options to configure nvf: +.PP diff --git a/docs/man/nvf.1 b/docs/man/nvf.1 index d7519651..0f1e36dc 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,46 +7,27 @@ .ad l .\" enable line breaks after slashes .cflags 4 / - .Sh NAME .Nm nvf -.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 - +.Nd A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS. +. .Sh BUGS .Pp -Please report any bugs on the project issue tracker: -.Lk https://github.com/notashelf/nvf/issues +Please report any bugs that you might encounter on the +\m[blue]\fBproject issue tracker\fR\m[]\&. .Sh SEE ALSO .Pp -.Fn nvf 5 +\fBnvf\fR(5) .Sh AUTHOR .Pp -.Fn nvf contributors +\fBnvf contributors\fR .RS 4 -Primary contributors and maintainers of the project. +Author. .RE .Sh COPYRIGHT -.Pp -Copyright (c) 2023–2025 nvf contributors. +.br +Copyright \(co 2023\(en2024 nvf contributors +.br diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 5b8dac85..657bc3c9 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -31,12 +31,6 @@ 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 @@ -111,7 +105,6 @@ - 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 options to define highlights under [](#opt-vim.highlight) [kaktu5](https://github.com/kaktu5): @@ -133,10 +126,7 @@ [QuiNzX](https://github.com/QuiNzX): +[ruff lsp]: (https://github.com/astral-sh/ruff) + - Add ruff as lsp alongside other lsp servers in a list as an option. Under `vim.languages.python.lsp.server`. - -[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/flake.lock b/flake.lock index ee19b7c8..c328bda1 100644 --- a/flake.lock +++ b/flake.lock @@ -77,11 +77,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737370608, - "narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=", + "lastModified": 1735523292, + "narHash": "sha256-opBsbR/nrGxiiF6XzlVluiHYb6yN/hEwv+lBWTy9xoM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "300081d0cc72df578b02d914df941b8ec62240e6", + "rev": "6d97d419e5a9b36e6293887a89a078cf85f5a61b", "type": "github" }, "original": { diff --git a/modules/neovim/init/default.nix b/modules/neovim/init/default.nix index b0c7e0ce..11d9cf59 100644 --- a/modules/neovim/init/default.nix +++ b/modules/neovim/init/default.nix @@ -2,7 +2,6 @@ imports = [ ./basic.nix ./debug.nix - ./highlight.nix ./spellcheck.nix ]; } diff --git a/modules/neovim/init/highlight.nix b/modules/neovim/init/highlight.nix deleted file mode 100644 index 7e992fd1..00000000 --- a/modules/neovim/init/highlight.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib.options) mkOption; - inherit (lib.types) nullOr attrsOf listOf submodule bool ints str enum; - inherit (lib.strings) hasPrefix concatLines; - inherit (lib.attrsets) mapAttrsToList; - inherit (lib.nvim.dag) entryBetween; - inherit (lib.nvim.lua) toLuaObject; - inherit (lib.nvim.types) hexColor; - - mkColorOption = target: - mkOption { - type = nullOr hexColor; - default = null; - example = "#ebdbb2"; - description = '' - The ${target} color to use. Written as color name or hex "#RRGGBB". - ''; - }; - - mkBoolOption = name: - mkOption { - type = nullOr bool; - default = null; - example = false; - description = "Whether to enable ${name}"; - }; - - 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 (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'"; - }; - force = mkBoolOption "force update"; - }; - }); - default = {}; - example = { - SignColumn = { - bg = "#282828"; - }; - }; - description = "Custom highlights to apply"; - }; - - config = { - vim.luaConfigRC.highlight = let - highlights = - mapAttrsToList ( - name: value: ''vim.api.nvim_set_hl(0, ${toLuaObject name}, ${toLuaObject value})'' - ) - cfg; - in - entryBetween ["lazyConfigs" "pluginConfigs" "extraPluginConfigs"] ["theme"] (concatLines highlights); - }; -} diff --git a/modules/plugins/languages/python.nix b/modules/plugins/languages/python.nix index 62db0a46..998cd81b 100644 --- a/modules/plugins/languages/python.nix +++ b/modules/plugins/languages/python.nix @@ -8,10 +8,9 @@ inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.meta) getExe; inherit (lib.modules) mkIf mkMerge; - inherit (lib.lists) isList toList; - inherit (lib.types) enum either listOf package str bool attrsOf; + inherit (lib.lists) isList; + inherit (lib.types) enum either listOf package str bool; inherit (lib.nvim.lua) expToLua; - inherit (lib) genAttrs; cfg = config.vim.languages.python; @@ -233,8 +232,8 @@ in { package = mkOption { description = "python LSP server package, or the command to run as a list of strings"; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]''; - type = attrsOf (either package (listOf str)); - default = genAttrs (toList cfg.lsp.server) (name: servers.${name}.package); + type = lib.types.attrsOf (either package (listOf str)); + default = lib.genAttrs (lib.toList cfg.lsp.server) (name: servers.${name}.package); }; }; @@ -288,7 +287,7 @@ in { (mkIf cfg.lsp.enable { vim.lsp.lspconfig.enable = true; - vim.lsp.lspconfig.sources = genAttrs (toList cfg.lsp.server) (name: servers.${name}.lspConfig); + vim.lsp.lspconfig.sources = lib.genAttrs (lib.toList cfg.lsp.server) (name: servers.${name}.lspConfig); }) (mkIf cfg.format.enable { diff --git a/modules/plugins/languages/zig.nix b/modules/plugins/languages/zig.nix index 2aa0e2b6..1b9a588b 100644 --- a/modules/plugins/languages/zig.nix +++ b/modules/plugins/languages/zig.nix @@ -8,12 +8,10 @@ inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.lists) isList; - inherit (lib.types) bool either listOf package str enum; + inherit (lib.types) either listOf package str enum; inherit (lib.nvim.lua) expToLua; inherit (lib.nvim.types) mkGrammarOption; - cfg = config.vim.languages.zig; - defaultServer = "zls"; servers = { zls = { @@ -33,35 +31,7 @@ }; }; - # 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 = {}, - }, - } - ''; - }; - }; + cfg = config.vim.languages.zig; in { options.vim.languages.zig = { enable = mkEnableOption "Zig language support"; @@ -86,26 +56,6 @@ 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 [ @@ -127,12 +77,5 @@ 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; - }; - }) ]); } diff --git a/modules/plugins/lsp/lightbulb/config.nix b/modules/plugins/lsp/lightbulb/config.nix index 17e740ad..f17b8ad9 100644 --- a/modules/plugins/lsp/lightbulb/config.nix +++ b/modules/plugins/lsp/lightbulb/config.nix @@ -4,7 +4,6 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.strings) optionalString; inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.lua) toLuaObject; @@ -13,29 +12,13 @@ in { config = mkIf (cfg.enable && cfg.lightbulb.enable) { vim = { startPlugins = ["nvim-lightbulb"]; + pluginRC.lightbulb = entryAnywhere '' - 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, - }) - ''} + 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}) ''; }; - - 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 012d54aa..4341cac6 100644 --- a/modules/plugins/lsp/lightbulb/lightbulb.nix +++ b/modules/plugins/lsp/lightbulb/lightbulb.nix @@ -1,29 +1,11 @@ {lib, ...}: let - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) listOf str either; - inherit (lib.nvim.types) mkPluginSetupOption luaInline; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.types) mkPluginSetupOption; 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. - ''; - }; - }; }; }; }