feat: add nvim-code-action-menu keybindings

This commit is contained in:
n3oney 2023-05-02 23:22:35 +02:00
parent 25c9bb0962
commit 46c602f74d
No known key found for this signature in database
GPG key ID: C786693DE727850E
2 changed files with 12 additions and 10 deletions

View file

@ -6,12 +6,15 @@
with lib; with lib;
with builtins; let with builtins; let
cfg = config.vim.lsp; 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 { in {
config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) { config = mkIf (cfg.enable && cfg.nvimCodeActionMenu.enable) {
vim.startPlugins = ["nvim-code-action-menu"]; vim.startPlugins = ["nvim-code-action-menu"];
vim.maps.normal = { vim.maps.normal = mkSetBinding mappings.open ":CodeActionMenu<CR>";
"<silent><leader>ca" = {action = ":CodeActionMenu<CR>";};
};
}; };
} }

View file

@ -1,13 +1,12 @@
{ {lib, ...}:
config, with lib; {
lib,
...
}:
with lib;
with builtins; {
options.vim.lsp = { options.vim.lsp = {
nvimCodeActionMenu = { nvimCodeActionMenu = {
enable = mkEnableOption "Enable nvim code action menu"; enable = mkEnableOption "Enable nvim code action menu";
mappings = {
open = mkMappingOption "Open code action menu [nvim-code-action-menu]" "<leader>ca";
};
}; };
}; };
} }