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"; + }; }; }; }