neovim-flake/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix

65 lines
2 KiB
Nix
Raw Permalink Normal View History

{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.nvim.binds) mkMappingOption;
2024-04-19 21:28:07 +02:00
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.types) enum int;
inherit (lib.modules) mkRenamedOptionModule;
in {
2024-02-17 16:10:45 +01:00
imports = let
renamedSetupOption = oldPath: newPath:
mkRenamedOptionModule
(["vim" "lsp" "nvim-docs-view"] ++ oldPath)
(["vim" "lsp" "nvim-docs-view" "setupOpts"] ++ newPath);
in [
(renamedSetupOption ["position"] ["position"])
(renamedSetupOption ["width"] ["width"])
(renamedSetupOption ["height"] ["height"])
(renamedSetupOption ["updateMode"] ["update_mode"])
];
options.vim.lsp.nvim-docs-view = {
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
2024-04-19 21:28:07 +02:00
setupOpts = mkPluginSetupOption "nvim-docs-view" {
2024-02-17 16:10:45 +01:00
position = mkOption {
2024-04-19 21:28:07 +02:00
type = enum ["left" "right" "top" "bottom"];
2024-02-17 16:10:45 +01:00
default = "right";
description = ''
Where to open the docs view panel
'';
};
2024-02-17 16:10:45 +01:00
height = mkOption {
2024-04-19 21:28:07 +02:00
type = int;
2024-02-17 16:10:45 +01:00
default = 10;
description = ''
Height of the docs view panel if the position is set to either top or bottom
'';
};
2024-02-17 16:10:45 +01:00
width = mkOption {
2024-04-19 21:28:07 +02:00
type = int;
2024-02-17 16:10:45 +01:00
default = 60;
description = ''
Width of the docs view panel if the position is set to either left or right
'';
};
2024-02-17 16:10:45 +01:00
update_mode = mkOption {
2024-04-19 21:28:07 +02:00
type = enum ["auto" "manual"];
2024-02-17 16:10:45 +01:00
default = "auto";
description = ''
Determines the mechanism used to update the docs view panel content.
- If auto, the content will update upon cursor move.
- If manual, the content will only update once :DocsViewUpdate is called
'';
};
};
2023-10-27 08:30:20 +02:00
mappings = {
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
};
};
}