Compare commits

..

No commits in common. "b44b76a1a74c445c8c8ed93a65678f46e40e3d0b" and "c5b72f124fdba697603f39e5c8168eac5780fc93" have entirely different histories.

50 changed files with 125 additions and 166 deletions

View file

@ -18,10 +18,6 @@ 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;
@ -42,7 +38,8 @@ 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 = {
enableFormat = true; # enableLSP = true;
enableFormat = true;
enableTreesitter = true; enableTreesitter = true;
enableExtraDiagnostics = true; enableExtraDiagnostics = true;

View file

@ -50,8 +50,9 @@ soon.
- A new section has been added for language support: `vim.languages.<language>`. - A new section has been added for language support: `vim.languages.<language>`.
- The options `enableLSP` [](#opt-vim.languages.enableTreesitter), etc. will - The options [](#opt-vim.languages.enableLSP),
enable the respective section for all languages that have been enabled. [](#opt-vim.languages.enableTreesitter), etc. will enable the respective
section for all languages that have been enabled.
- All LSP languages have been moved here - All LSP languages have been moved here
- `plantuml` and `markdown` have been moved here - `plantuml` and `markdown` have been moved here
- A new section has been added for `html`. The old - A new section has been added for `html`. The old

View file

@ -26,22 +26,12 @@
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 mkEnableOption; inherit (lib.options) mkOption;
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,48 +27,37 @@
enabledServers = filterAttrs (_: u: u.enable) cfg.servers; enabledServers = filterAttrs (_: u: u.enable) cfg.servers;
in { in {
options = { options = {
vim.lsp = { vim.lsp.servers = mkOption {
enable = mkEnableOption '' type = attrsOf lspOptions;
global LSP functionality for Neovim. default = {};
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 "*" = {
servers defined in {option}`vim.lsp.servers` to take effect, since they are root_markers = [".git"];
enabled automatically. capabilities = {
''; textDocument = {
semanticTokens = {
servers = mkOption { multilineTokenSupport = true;
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 related LSP configurations that will be managed using `vim.lsp.config()` and
utilities added in Neovim 0.11. LSPs defined here will be added to the related utilities added in Neovim 0.11. LSPs defined here will be
resulting {file}`init.lua` using `vim.lsp.config` and enabled through added to the resulting {file}`init.lua` using `vim.lsp.config` and
`vim.lsp.enable()` API from Neovim below the configuration table. enabled through `vim.lsp.enable` 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.lsp.enable;}; enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Astro LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Enable Bash LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "clang LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "C# LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "CSS LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "CUE LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable; default = config.vim.languages.enableLSP;
description = "Enable flutter-tools for flutter support"; description = "Enable flutter-tools for flutter support";
}; };

View file

@ -1,5 +1,8 @@
{lib, ...}: let {
inherit (lib.modules) mkRenamedOptionModule; config,
lib,
...
}: let
inherit (lib.nvim.languages) mkEnable; inherit (lib.nvim.languages) mkEnable;
in { in {
imports = [ imports = [
@ -45,12 +48,13 @@ 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.lsp.enable;}; enable = mkEnableOption "Elixir LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "F# LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Gleam LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Go LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "LSP support for Haskell" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "HCL LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
# 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.lsp.enable;}; enable = mkEnableOption "Helm LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable; default = config.vim.languages.enableLSP;
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.lsp.enable;}; enable = mkEnableOption "Kotlin LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Enable Markdown LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Nu LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "OCaml LSP support (ocaml-lsp)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Odin LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "PHP LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Python LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "R LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Ruby LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Scala LSP support (metals)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "SQL LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Svelte LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Tailwindcss LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Terraform LSP support (terraform-ls)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Typescript/Javascript LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Typst LSP support (typst-lsp)" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Vala LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "WGSL LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "YAML LSP support" // {default = config.vim.languages.enableLSP;};
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.lsp.enable;}; enable = mkEnableOption "Zig LSP support" // {default = config.vim.languages.enableLSP;};
server = mkOption { server = mkOption {
type = enum (attrNames servers); type = enum (attrNames servers);

View file

@ -14,6 +14,8 @@ in {
config = mkIf cfg.lspconfig.enable (mkMerge [ config = mkIf cfg.lspconfig.enable (mkMerge [
{ {
vim = { vim = {
lsp.enable = true;
startPlugins = ["nvim-lspconfig"]; startPlugins = ["nvim-lspconfig"];
pluginRC.lspconfig = entryAfter ["lsp-setup"] '' pluginRC.lspconfig = entryAfter ["lsp-setup"] ''

View file

@ -3,12 +3,11 @@
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; inherit (lib.types) nullOr listOf enum bool str int either;
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,163 +86,145 @@ in {
close = mkOption { close = mkOption {
type = str; type = str;
default = "<esc>"; default = "<esc>";
description = "Close and return the cursor to its original location."; description = "keybinding to close Navbuddy UI";
}; };
nextSibling = mkOption { nextSibling = mkOption {
type = str; type = str;
default = "j"; default = "j";
description = "Navigate to the next sibling node."; description = "keybinding to navigate to the next sibling node";
}; };
previousSibling = mkOption { previousSibling = mkOption {
type = str; type = str;
default = "k"; default = "k";
description = "Navigate to the previous sibling node."; description = "keybinding to navigate to the previous sibling node";
}; };
parent = mkOption { parent = mkOption {
type = str; type = str;
default = "h"; default = "h";
description = "Navigate to the parent node."; description = "keybinding to navigate to the parent node";
}; };
children = mkOption { children = mkOption {
type = str; type = str;
default = "l"; default = "l";
description = "Navigate to the child node."; description = "keybinding to navigate to the child node";
}; };
root = mkOption { root = mkOption {
type = str; type = str;
default = "0"; default = "0";
description = "Navigate to the root node."; description = "keybinding to navigate to the root node";
}; };
visualName = mkOption { visualName = mkOption {
type = str; type = str;
default = "v"; default = "v";
description = "Select the name visually."; description = "visual selection of name";
}; };
visualScope = mkOption { visualScope = mkOption {
type = str; type = str;
default = "V"; default = "V";
description = "Select the scope visually."; description = "visual selection of scope";
}; };
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 the start of name."; description = "insert at start of name";
}; };
insertScope = mkOption { insertScope = mkOption {
type = str; type = str;
default = "I"; default = "I";
description = "Insert at the start of scope."; description = "insert at start of scope";
}; };
appendName = mkOption { appendName = mkOption {
type = str; type = str;
default = "a"; default = "a";
description = "Insert at the end of name."; description = "insert at end of name";
}; };
appendScope = mkOption { appendScope = mkOption {
type = str; type = str;
default = "A"; default = "A";
description = "Insert at the end of scope."; description = "insert at 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 of the node."; description = "create a new fold";
}; };
foldDelete = mkOption { foldDelete = mkOption {
type = str; type = str;
default = "F"; default = "F";
description = "Delete the current fold of the node."; description = "delete the current fold";
}; };
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 the node."; description = "goto selected symbol";
}; };
moveDown = mkOption { moveDown = mkOption {
type = str; type = str;
default = "J"; default = "J";
description = "Move the node down."; description = "move focused node down";
}; };
moveUp = mkOption { moveUp = mkOption {
type = str; type = str;
default = "K"; default = "K";
description = "Move the node up."; description = "move focused 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 = "Start fuzzy finder at the current level."; description = "fuzzy finder at current level";
}; };
help = mkOption { help = mkOption {
type = str; type = str;
default = "g?"; default = "g?";
description = "Open the mappings help window."; description = "open mapping help window";
}; };
}; };
@ -250,7 +232,7 @@ in {
useDefaultMappings = mkOption { useDefaultMappings = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Add the default Navbuddy keybindings in addition to the keybinding added by this module."; description = "use default Navbuddy keybindings (disables user-specified keybinds)";
}; };
window = { window = {
@ -260,13 +242,13 @@ in {
border = mkOption { border = mkOption {
type = borderType; type = borderType;
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "The border style to use."; description = "border style to use";
}; };
scrolloff = mkOption { scrolloff = mkOption {
type = nullOr int; type = nullOr int;
default = null; default = null;
description = "The scrolloff value within a navbuddy window."; description = "Scrolloff value within navbuddy window";
}; };
sections = { sections = {
@ -283,7 +265,7 @@ in {
border = mkOption { border = mkOption {
type = borderType; type = borderType;
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the left section of the Navbuddy UI."; description = "border style to use for the left section of Navbuddy UI";
}; };
}; };
@ -300,7 +282,7 @@ in {
border = mkOption { border = mkOption {
type = borderType; type = borderType;
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the middle section of the Navbuddy UI."; description = "border style to use for the middle section of Navbuddy UI";
}; };
}; };
@ -310,13 +292,13 @@ in {
border = mkOption { border = mkOption {
type = borderType; type = borderType;
default = config.vim.ui.borders.globalStyle; default = config.vim.ui.borders.globalStyle;
description = "The border style to use for the right section of the Navbuddy UI."; description = "border style to use for the right section of Navbuddy UI";
}; };
preview = mkOption { preview = mkOption {
type = enum ["leaf" "always" "never"]; type = enum ["leaf" "always" "never"];
default = "leaf"; default = "leaf";
description = "The display mode of the preview on the right section."; description = "display mode of the preview on the right section";
}; };
}; };
}; };
@ -335,13 +317,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 = "The preference list ranking LSP servers."; description = "list of lsp server names in order of preference";
}; };
}; };
@ -349,25 +331,25 @@ in {
followNode = mkOption { followNode = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Whether to keep the current node in focus in the source buffer."; description = "keep the current node in focus on the source buffer";
}; };
highlight = mkOption { highlight = mkOption {
type = bool; type = bool;
default = true; default = true;
description = "Whether to highlight the currently focused node in the source buffer."; description = "highlight the currently focused node";
}; };
reorient = mkOption { reorient = mkOption {
type = enum ["smart" "top" "mid" "none"]; type = enum ["smart" "top" "mid" "none"];
default = "smart"; default = "smart";
description = "The mode for reorienting the source buffer after moving nodes."; description = "reorient buffer after changing nodes";
}; };
scrolloff = mkOption { scrolloff = mkOption {
type = nullOr int; type = nullOr int;
default = null; default = null;
description = "The scrolloff value in the source buffer when Navbuddy is open."; description = "scrolloff value when navbuddy is open";
}; };
}; };

View file

@ -64,11 +64,6 @@ 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",