From d867aaea43a7efcfc2cd19a6e0fc89783e15838e Mon Sep 17 00:00:00 2001 From: Yury Shvedov Date: Sun, 1 Dec 2024 14:15:58 +0300 Subject: [PATCH] plugin/lsp: automatic keymap description Add keymaps default descriptions for lsp buf and diagnostics Change-Id: I7a48ef3760e530a738efd7036b7ae5722c054256 --- plugins/lsp/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/lsp/default.nix b/plugins/lsp/default.nix index 5d210ef9..9729d981 100644 --- a/plugins/lsp/default.nix +++ b/plugins/lsp/default.nix @@ -198,6 +198,14 @@ in let actionStr = action.action or action; actionProps = optionalAttrs (isAttrs action) (removeAttrs action [ "action" ]); + desc = + let + split = splitString "." prefix; + splitlen = length split; + prefixFinal = (elemAt split (splitlen - 2)) + " "; + optPrefix = optionalString (splitlen > 2) prefixFinal; + in + "Lsp " + optPrefix + actionStr; in { mode = "n"; @@ -206,6 +214,7 @@ in options = { inherit (cfg.keymaps) silent; + inherit desc; } // actionProps; } );