Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp/nvim-docs-view: add keybinds #175

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion modules/lsp/nvim-docs-view/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
lib,
...
}: let
inherit (lib) mkIf nvim;
inherit (lib) mkIf nvim addDescriptionsToMappings mkSetBinding mkMerge;
inherit (builtins) toString;

cfg = config.vim.lsp.nvim-docs-view;
self = import ./nvim-docs-view.nix {inherit lib;};

mappingDefinitions = self.options.vim.lsp.nvim-docs-view.mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
config = mkIf cfg.enable {
vim = {
Expand All @@ -21,6 +25,11 @@ in {
update_mode = "${cfg.updateMode}",
}
'';

maps.normal = mkMerge [
(mkSetBinding mappings.viewToggle "<cmd>DocsViewToggle<CR>")
(mkSetBinding mappings.viewUpdate "<cmd>DocsViewUpdate<CR>")
];
};
};
}
7 changes: 6 additions & 1 deletion modules/lsp/nvim-docs-view/nvim-docs-view.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types;
inherit (lib) mkEnableOption mkOption types mkMappingOption;
in {
options.vim.lsp.nvim-docs-view = {
enable = mkEnableOption "nvim-docs-view, for displaying lsp hover documentation in a side panel.";
Expand Down Expand Up @@ -37,5 +37,10 @@ in {
- If manual, the content will only update once :DocsViewUpdate is called
'';
};

mappings = {
viewToggle = mkMappingOption "Open or close the docs view panel" "lvt";
viewUpdate = mkMappingOption "Manually update the docs view panel" "lvu";
};
};
}
Loading