Skip to content

Commit

Permalink
Merge pull request #175 from NotAShelf/nvim-docs-view
Browse files Browse the repository at this point in the history
lsp/nvim-docs-view: add keybinds
  • Loading branch information
NotAShelf authored Oct 27, 2023
2 parents 197de16 + 83802bb commit a338e4b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
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";
};
};
}

0 comments on commit a338e4b

Please sign in to comment.