Merge branch 'main' into mnw-update

This commit is contained in:
raf 2025-05-04 15:27:14 +00:00 committed by GitHub
commit 3d3b734e66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 164 additions and 120 deletions

View file

@ -5,7 +5,7 @@
}: let
inherit (builtins) filter;
inherit (lib.modules) mkIf mkMerge mkDefault;
inherit (lib.options) mkOption;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) attrsOf;
inherit (lib.strings) concatLines;
inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs;
@ -27,37 +27,48 @@
enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
in {
options = {
vim.lsp.servers = mkOption {
type = attrsOf lspOptions;
default = {};
example = ''
{
"*" = {
root_markers = [".git"];
capabilities = {
textDocument = {
semanticTokens = {
multilineTokenSupport = true;
vim.lsp = {
enable = mkEnableOption ''
global LSP functionality for Neovim.
This option controls whether to enable LSP functionality within modules under
{option}`vim.languages`. You do not need to set this to `true` for language
servers defined in {option}`vim.lsp.servers` to take effect, since they are
enabled automatically.
'';
servers = mkOption {
type = attrsOf lspOptions;
default = {};
example = ''
{
"*" = {
root_markers = [".git"];
capabilities = {
textDocument = {
semanticTokens = {
multilineTokenSupport = true;
};
};
};
};
};
"clangd" = {
filetypes = ["c"];
};
}
'';
description = ''
LSP configurations that will be managed using `vim.lsp.config()` and
related utilities added in Neovim 0.11. LSPs defined here will be
added to the resulting {file}`init.lua` using `vim.lsp.config` and
enabled through `vim.lsp.enable` below the configuration table.
"clangd" = {
filetypes = ["c"];
};
}
'';
description = ''
LSP configurations that will be managed using `vim.lsp.config()` and related
utilities added in Neovim 0.11. LSPs defined here will be added to the
resulting {file}`init.lua` using `vim.lsp.config` and enabled through
`vim.lsp.enable()` API from Neovim below the configuration table.
You may review the generated configuration by running {command}`nvf-print-config`
in a shell. Please see {command}`:help lsp-config` for more details
on the underlying API.
'';
You may review the generated configuration by running {command}`nvf-print-config`
in a shell. Please see {command}`:help lsp-config` for more details
on the underlying API.
'';
};
};
};

View file

@ -20,7 +20,7 @@ in {
};
lsp = {
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.lsp.enable;};
package = mkOption {
type = package;

View file

@ -81,7 +81,7 @@ in {
};
lsp = {
enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Astro LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -56,7 +56,7 @@ in {
};
lsp = {
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Bash LSP server to use";

View file

@ -98,7 +98,7 @@ in {
};
lsp = {
enable = mkEnableOption "clang LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "clang LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "The clang LSP server to use";

View file

@ -91,7 +91,7 @@ in {
};
lsp = {
enable = mkEnableOption "C# LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "C# LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "C# LSP server to use";
type = enum (attrNames servers);

View file

@ -80,7 +80,7 @@ in {
};
lsp = {
enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "CSS LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "CSS LSP server to use";

View file

@ -21,7 +21,7 @@ in {
};
lsp = {
enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "CUE LSP support" // {default = config.vim.lsp.enable;};
package = mkOption {
type = package;

View file

@ -77,7 +77,7 @@ in {
flutter-tools = {
enable = mkOption {
type = bool;
default = config.vim.languages.enableLSP;
default = config.vim.lsp.enable;
description = "Enable flutter-tools for flutter support";
};

View file

@ -1,8 +1,5 @@
{
config,
lib,
...
}: let
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.languages) mkEnable;
in {
imports = [
@ -48,13 +45,12 @@ in {
./wgsl.nix
./yaml.nix
./ruby.nix
# This is now a hard deprecation.
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
];
options.vim.languages = {
# LSPs are now built into Neovim, and we should enable them by default
# if `vim.lsp.enable` is true.
enableLSP = mkEnable "LSP" // {default = config.vim.lsp.enable;};
# Those are still managed by plugins, and should be enabled here.
enableDAP = mkEnable "Debug Adapter";
enableTreesitter = mkEnable "Treesitter";

View file

@ -53,7 +53,7 @@ in {
};
lsp = {
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Elixir LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Elixir LSP server to use";

View file

@ -51,7 +51,7 @@ in {
};
lsp = {
enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "F# LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);
default = defaultServer;

View file

@ -41,7 +41,7 @@ in {
};
lsp = {
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Gleam LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -67,7 +67,7 @@ in {
};
lsp = {
enable = mkEnableOption "Go LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Go LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Go LSP server to use";

View file

@ -25,7 +25,7 @@ in {
};
lsp = {
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "Haskell LSP package or command to run the Haskell LSP";
example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';

View file

@ -43,7 +43,7 @@ in {
};
lsp = {
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.lsp.enable;};
# TODO: (maybe, is it better?) it would be cooler to use vscode-extensions.hashicorp.hcl probably, shouldn't be too hard
package = mkOption {
type = package;

View file

@ -54,7 +54,7 @@ in {
};
lsp = {
enable = mkEnableOption "Helm LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Helm LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Helm LSP server to use";

View file

@ -23,7 +23,7 @@ in {
};
lsp = {
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "java language server package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';

View file

@ -78,7 +78,7 @@ in {
lsp = {
enable = mkOption {
type = bool;
default = config.vim.languages.enableLSP;
default = config.vim.lsp.enable;
description = ''
Whether to enable Julia LSP support.

View file

@ -30,7 +30,7 @@ in {
};
lsp = {
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "kotlin_language_server package with Kotlin runtime";

View file

@ -43,7 +43,7 @@ in {
};
lsp = {
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "LuaLS package, or the command to run as a list of strings";

View file

@ -67,7 +67,7 @@ in {
};
lsp = {
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -54,7 +54,7 @@ in {
};
lsp = {
enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Nim LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Nim LSP server to use";
type = str;

View file

@ -143,7 +143,7 @@ in {
};
lsp = {
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Nix LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Nix LSP server to use";
type = enum (attrNames servers);

View file

@ -40,7 +40,7 @@ in {
};
lsp = {
enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Nu LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = str;
default = defaultServer;

View file

@ -49,7 +49,7 @@ in {
};
lsp = {
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "OCaml LSP server to user";
type = enum (attrNames servers);

View file

@ -41,7 +41,7 @@ in {
};
lsp = {
enable = mkEnableOption "Odin LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Odin LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -95,7 +95,7 @@ in {
};
lsp = {
enable = mkEnableOption "PHP LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "PHP LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "PHP LSP server to use";

View file

@ -169,7 +169,7 @@ in {
};
lsp = {
enable = mkEnableOption "Python LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Python LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Python LSP server to use";

View file

@ -79,7 +79,7 @@ in {
};
lsp = {
enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "R LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "R LSP server to use";

View file

@ -57,7 +57,7 @@ in {
};
lsp = {
enable = mkEnableOption "Ruby LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Ruby LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -43,7 +43,7 @@ in {
};
lsp = {
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "rust-analyzer package, or the command to run as a list of strings";
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';

View file

@ -33,7 +33,7 @@ in {
};
lsp = {
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.lsp.enable;};
package = mkPackageOption pkgs "metals" {
default = ["metals"];
};

View file

@ -79,7 +79,7 @@ in {
};
lsp = {
enable = mkEnableOption "SQL LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "SQL LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "SQL LSP server to use";

View file

@ -77,7 +77,7 @@ in {
};
lsp = {
enable = mkEnableOption "Svelte LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Svelte LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Svelte LSP server to use";

View file

@ -35,7 +35,7 @@ in {
enable = mkEnableOption "Tailwindcss language support";
lsp = {
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Tailwindcss LSP server to use";

View file

@ -20,7 +20,7 @@ in {
};
lsp = {
enable = mkEnableOption "Terraform LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Terraform LSP support (terraform-ls)" // {default = config.vim.lsp.enable;};
package = mkOption {
description = "terraform-ls package";

View file

@ -120,7 +120,7 @@ in {
};
lsp = {
enable = mkEnableOption "Typescript/Javascript LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Typescript/Javascript LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Typescript/Javascript LSP server to use";

View file

@ -76,7 +76,7 @@ in {
};
lsp = {
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Typst LSP server to use";

View file

@ -50,7 +50,7 @@ in {
};
lsp = {
enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Vala LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
description = "Vala LSP server to use";
type = enum (attrNames servers);

View file

@ -42,7 +42,7 @@ in {
};
lsp = {
enable = mkEnableOption "WGSL LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "WGSL LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -55,7 +55,7 @@ in {
};
lsp = {
enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "YAML LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -72,7 +72,7 @@ in {
};
lsp = {
enable = mkEnableOption "Zig LSP support" // {default = config.vim.languages.enableLSP;};
enable = mkEnableOption "Zig LSP support" // {default = config.vim.lsp.enable;};
server = mkOption {
type = enum (attrNames servers);

View file

@ -3,11 +3,12 @@
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.lsp = {
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options";
formatOnSave = mkEnableOption "format on save";
inlayHints = {
enable = mkEnableOption "inlay hints";
};
mappings = {
goToDefinition =
mkMappingOption "Go to definition"

View file

@ -4,7 +4,7 @@
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) nullOr listOf enum bool str int either;
inherit (lib.types) nullOr listOf enum bool str int;
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.nvim.types) mkPluginSetupOption borderType;
mkSimpleIconOption = default:
@ -74,7 +74,7 @@ in {
::: {.note}
This will pass `draw_empty` to the `nvim_navic` winbar
component, which causes the component to be drawn even
if it's empty
if it's empty.
:::
'';
};
@ -86,145 +86,163 @@ in {
close = mkOption {
type = str;
default = "<esc>";
description = "keybinding to close Navbuddy UI";
description = "Close and return the cursor to its original location.";
};
nextSibling = mkOption {
type = str;
default = "j";
description = "keybinding to navigate to the next sibling node";
description = "Navigate to the next sibling node.";
};
previousSibling = mkOption {
type = str;
default = "k";
description = "keybinding to navigate to the previous sibling node";
description = "Navigate to the previous sibling node.";
};
parent = mkOption {
type = str;
default = "h";
description = "keybinding to navigate to the parent node";
description = "Navigate to the parent node.";
};
children = mkOption {
type = str;
default = "l";
description = "keybinding to navigate to the child node";
description = "Navigate to the child node.";
};
root = mkOption {
type = str;
default = "0";
description = "keybinding to navigate to the root node";
description = "Navigate to the root node.";
};
visualName = mkOption {
type = str;
default = "v";
description = "visual selection of name";
description = "Select the name visually.";
};
visualScope = mkOption {
type = str;
default = "V";
description = "visual selection of scope";
description = "Select the scope visually.";
};
yankName = mkOption {
type = str;
default = "y";
description = "yank the name to system clipboard";
description = "Yank the name to system clipboard.";
};
yankScope = mkOption {
type = str;
default = "Y";
description = "yank the scope to system clipboard";
description = "Yank the scope to system clipboard.";
};
insertName = mkOption {
type = str;
default = "i";
description = "insert at start of name";
description = "Insert at the start of name.";
};
insertScope = mkOption {
type = str;
default = "I";
description = "insert at start of scope";
description = "Insert at the start of scope.";
};
appendName = mkOption {
type = str;
default = "a";
description = "insert at end of name";
description = "Insert at the end of name.";
};
appendScope = mkOption {
type = str;
default = "A";
description = "insert at end of scope";
description = "Insert at the end of scope.";
};
rename = mkOption {
type = str;
default = "r";
description = "rename the node";
description = "Rename the node.";
};
delete = mkOption {
type = str;
default = "d";
description = "delete the node";
description = "Delete the node.";
};
foldCreate = mkOption {
type = str;
default = "f";
description = "create a new fold";
description = "Create a new fold of the node.";
};
foldDelete = mkOption {
type = str;
default = "F";
description = "delete the current fold";
description = "Delete the current fold of the node.";
};
comment = mkOption {
type = str;
default = "c";
description = "comment the node";
description = "Comment the node.";
};
select = mkOption {
type = str;
default = "<enter>";
description = "goto selected symbol";
description = "Goto the node.";
};
moveDown = mkOption {
type = str;
default = "J";
description = "move focused node down";
description = "Move the node down.";
};
moveUp = mkOption {
type = str;
default = "K";
description = "move focused node up";
description = "Move the node up.";
};
togglePreview = mkOption {
type = str;
default = "s";
description = "Toggle the preview.";
};
vsplit = mkOption {
type = str;
default = "<C-v>";
description = "Open the node in a vertical split.";
};
hsplit = mkOption {
type = str;
default = "<C-s>";
description = "Open the node in a horizontal split.";
};
telescope = mkOption {
type = str;
default = "t";
description = "fuzzy finder at current level";
description = "Start fuzzy finder at the current level.";
};
help = mkOption {
type = str;
default = "g?";
description = "open mapping help window";
description = "Open the mappings help window.";
};
};
@ -232,7 +250,7 @@ in {
useDefaultMappings = mkOption {
type = bool;
default = true;
description = "use default Navbuddy keybindings (disables user-specified keybinds)";
description = "Add the default Navbuddy keybindings in addition to the keybinding added by this module.";
};
window = {
@ -242,13 +260,13 @@ in {
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use";
description = "The border style to use.";
};
scrolloff = mkOption {
type = nullOr int;
default = null;
description = "Scrolloff value within navbuddy window";
description = "The scrolloff value within a navbuddy window.";
};
sections = {
@ -265,7 +283,7 @@ in {
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use for the left section of Navbuddy UI";
description = "The border style to use for the left section of the Navbuddy UI.";
};
};
@ -282,7 +300,7 @@ in {
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use for the middle section of Navbuddy UI";
description = "The border style to use for the middle section of the Navbuddy UI.";
};
};
@ -292,13 +310,13 @@ in {
border = mkOption {
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use for the right section of Navbuddy UI";
description = "The border style to use for the right section of the Navbuddy UI.";
};
preview = mkOption {
type = enum ["leaf" "always" "never"];
default = "leaf";
description = "display mode of the preview on the right section";
description = "The display mode of the preview on the right section.";
};
};
};
@ -317,13 +335,13 @@ in {
auto_attach = mkOption {
type = bool;
default = true;
description = "Whether to attach to LSP server manually";
description = "Whether to attach to LSP server manually.";
};
preference = mkOption {
type = nullOr (listOf str);
default = null;
description = "list of lsp server names in order of preference";
description = "The preference list ranking LSP servers.";
};
};
@ -331,25 +349,25 @@ in {
followNode = mkOption {
type = bool;
default = true;
description = "keep the current node in focus on the source buffer";
description = "Whether to keep the current node in focus in the source buffer.";
};
highlight = mkOption {
type = bool;
default = true;
description = "highlight the currently focused node";
description = "Whether to highlight the currently focused node in the source buffer.";
};
reorient = mkOption {
type = enum ["smart" "top" "mid" "none"];
default = "smart";
description = "reorient buffer after changing nodes";
description = "The mode for reorienting the source buffer after moving nodes.";
};
scrolloff = mkOption {
type = nullOr int;
default = null;
description = "scrolloff value when navbuddy is open";
description = "The scrolloff value in the source buffer when Navbuddy is open.";
};
};

View file

@ -64,6 +64,11 @@ in {
${cfg.navbuddy.mappings.moveDown} = mkLuaInline "actions.move_down()";
${cfg.navbuddy.mappings.moveUp} = mkLuaInline "actions.move_up()";
${cfg.navbuddy.mappings.togglePreview} = mkLuaInline "actions.toggle_preview()";
${cfg.navbuddy.mappings.vsplit} = mkLuaInline "actions.vsplit()";
${cfg.navbuddy.mappings.hsplit} = mkLuaInline "actions.hsplit()";
${cfg.navbuddy.mappings.telescope} = mkLuaInline ''
actions.telescope({
layout_strategy = "horizontal",