nvf/modules/plugins/lsp/nvim-docs-view/nvim-docs-view.nix
alfarel 1cda8228e9
plugins: use new config-aware mkMappingOption
Generated using:

- `sd -F "inherit (lib.nvim.binds) mkMappingOption;" "inherit (config.vim.lib) mkMappingOption;" $(find . -type f)`
- `sd -F "{lib, ...}: let" "{config, lib, ...}: let" $(find . -type f)`

Tweaked manually (placement in inherit list, fixing todo-comments and toggleterm).

Ran `nix run nixpkgs#deadnix -- -e` to clean up.
Next commit includes unrelated dead code.
2026-04-06 08:51:34 -04:00

68 lines
2 KiB
Nix

{
config,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (lib.types) enum int;
inherit (lib.modules) mkRenamedOptionModule;
inherit (config.vim.lib) mkMappingOption;
in {
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.";
setupOpts = mkPluginSetupOption "nvim-docs-view" {
position = mkOption {
type = enum ["left" "right" "top" "bottom"];
default = "right";
description = ''
Where to open the docs view panel
'';
};
height = mkOption {
type = int;
default = 10;
description = ''
Height of the docs view panel if the position is set to either top or bottom
'';
};
width = mkOption {
type = int;
default = 60;
description = ''
Width of the docs view panel if the position is set to either left or right
'';
};
update_mode = mkOption {
type = enum ["auto" "manual"];
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
'';
};
};
mappings = {
viewToggle = mkMappingOption "Open or close the docs view panel" "<leader>lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "<leader>lvu";
};
};
}