From 46c602f74dca9419f6070e323390e5d392eac0d7 Mon Sep 17 00:00:00 2001 From: n3oney Date: Tue, 2 May 2023 23:22:35 +0200 Subject: [PATCH] feat: add nvim-code-action-menu keybindings --- modules/lsp/nvim-code-action-menu/config.nix | 9 ++++++--- .../nvim-code-action-menu/nvim-code-action-menu.nix | 13 ++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/lsp/nvim-code-action-menu/config.nix b/modules/lsp/nvim-code-action-menu/config.nix index dd7a1a5..20c402b 100644 --- a/modules/lsp/nvim-code-action-menu/config.nix +++ b/modules/lsp/nvim-code-action-menu/config.nix @@ -6,12 +6,15 @@ with lib; with builtins; let cfg = config.vim.lsp; + + self = import ./nvim-code-action-menu.nix {inherit lib;}; + + mappingDefinitions = self.options.vim.lsp.nvimCodeActionMenu.mappings; + mappings = addDescriptionsToMappings cfg.nvimCodeActionMenu.mappings mappingDefinitions; in { config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { vim.startPlugins = ["nvim-code-action-menu"]; - vim.maps.normal = { - "ca" = {action = ":CodeActionMenu";}; - }; + vim.maps.normal = mkSetBinding mappings.open ":CodeActionMenu"; }; } diff --git a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix index 95058e6..83885e2 100644 --- a/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix +++ b/modules/lsp/nvim-code-action-menu/nvim-code-action-menu.nix @@ -1,13 +1,12 @@ -{ - config, - lib, - ... -}: -with lib; -with builtins; { +{lib, ...}: +with lib; { options.vim.lsp = { nvimCodeActionMenu = { enable = mkEnableOption "Enable nvim code action menu"; + + mappings = { + open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "ca"; + }; }; }; }