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

@ -18,6 +18,10 @@ isMaximal: {
}; };
lsp = { lsp = {
# This must be enabled for the language modules to hook into
# the LSP API.
enable = true;
formatOnSave = true; formatOnSave = true;
lspkind.enable = false; lspkind.enable = false;
lightbulb.enable = true; lightbulb.enable = true;
@ -38,8 +42,7 @@ isMaximal: {
# This section does not include a comprehensive list of available language modules. # This section does not include a comprehensive list of available language modules.
# To list all available language module options, please visit the nvf manual. # To list all available language module options, please visit the nvf manual.
languages = { languages = {
enableLSP = true; enableFormat = true; #
enableFormat = true;
enableTreesitter = true; enableTreesitter = true;
enableExtraDiagnostics = true; enableExtraDiagnostics = true;

View file

@ -26,12 +26,22 @@
config.vim = { config.vim = {
theme.enable = true; theme.enable = true;
lsp = {
# Enable LSP functionality globally. This is required for modules found
# in `vim.languages` to enable relevant LSPs.
enable = true;
# You may define your own LSP configurations using `vim.lsp.servers` in
# nvf without ever needing lspconfig to do it. This will use the native
# API provided by Neovim > 0.11
servers = {};
};
# Language support and automatic configuration of companion plugins. # Language support and automatic configuration of companion plugins.
# Note that enabling, e.g., languages.<lang>.diagnostics will automatically # Note that enabling, e.g., languages.<lang>.diagnostics will automatically
# enable top-level options such as enableLSP or enableExtraDiagnostics as # enable top-level options such as enableLSP or enableExtraDiagnostics as
# they are needed. # they are needed.
languages = { languages = {
enableLSP = true;
enableFormat = true; enableFormat = true;
enableTreesitter = true; enableTreesitter = true;
enableExtraDiagnostics = true; enableExtraDiagnostics = true;

View file

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

View file

@ -20,7 +20,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
type = package; type = package;

View file

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

View file

@ -56,7 +56,7 @@ in {
}; };
lsp = { 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 { server = mkOption {
description = "Bash LSP server to use"; description = "Bash LSP server to use";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,5 @@
{ {lib, ...}: let
config, inherit (lib.modules) mkRenamedOptionModule;
lib,
...
}: let
inherit (lib.nvim.languages) mkEnable; inherit (lib.nvim.languages) mkEnable;
in { in {
imports = [ imports = [
@ -48,13 +45,12 @@ in {
./wgsl.nix ./wgsl.nix
./yaml.nix ./yaml.nix
./ruby.nix ./ruby.nix
# This is now a hard deprecation.
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])
]; ];
options.vim.languages = { 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. # Those are still managed by plugins, and should be enabled here.
enableDAP = mkEnable "Debug Adapter"; enableDAP = mkEnable "Debug Adapter";
enableTreesitter = mkEnable "Treesitter"; enableTreesitter = mkEnable "Treesitter";

View file

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

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
description = "Haskell LSP package or command to run the Haskell LSP"; description = "Haskell LSP package or command to run the Haskell LSP";
example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]''; example = ''[ (lib.getExe pkgs.haskellPackages.haskell-language-server) "--debug" ]'';

View file

@ -43,7 +43,7 @@ in {
}; };
lsp = { 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 # TODO: (maybe, is it better?) it would be cooler to use vscode-extensions.hashicorp.hcl probably, shouldn't be too hard
package = mkOption { package = mkOption {
type = package; type = package;

View file

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

View file

@ -23,7 +23,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
description = "java language server package, or the command to run as a list of strings"; 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"]''; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';

View file

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

View file

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

View file

@ -43,7 +43,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
description = "LuaLS package, or the command to run as a list of strings"; description = "LuaLS package, or the command to run as a list of strings";

View file

@ -67,7 +67,7 @@ in {
}; };
lsp = { 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 { server = mkOption {
type = enum (attrNames servers); type = enum (attrNames servers);

View file

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

View file

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

View file

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

View file

@ -49,7 +49,7 @@ in {
}; };
lsp = { 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 { server = mkOption {
description = "OCaml LSP server to user"; description = "OCaml LSP server to user";
type = enum (attrNames servers); type = enum (attrNames servers);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -43,7 +43,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
description = "rust-analyzer package, or the command to run as a list of strings"; 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"]''; example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';

View file

@ -33,7 +33,7 @@ in {
}; };
lsp = { 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" { package = mkPackageOption pkgs "metals" {
default = ["metals"]; default = ["metals"];
}; };

View file

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

View file

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

View file

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

View file

@ -20,7 +20,7 @@ in {
}; };
lsp = { 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 { package = mkOption {
description = "terraform-ls package"; description = "terraform-ls package";

View file

@ -120,7 +120,7 @@ in {
}; };
lsp = { 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 { server = mkOption {
description = "Typescript/Javascript LSP server to use"; description = "Typescript/Javascript LSP server to use";

View file

@ -76,7 +76,7 @@ in {
}; };
lsp = { 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 { server = mkOption {
description = "Typst LSP server to use"; description = "Typst LSP server to use";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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