mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-24 17:58:38 +02:00
plugins/lsp: Reduce indent on attr set and use helpers.mkRaw
This commit is contained in:
parent
03009d0b99
commit
e229e3ad44
1 changed files with 28 additions and 30 deletions
|
@ -260,37 +260,35 @@ in {
|
|||
mkIf cfg.enable {
|
||||
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
||||
|
||||
keymapsOnEvents = {
|
||||
"LspAttach" = let
|
||||
mkMaps = prefix:
|
||||
mapAttrsToList
|
||||
(
|
||||
key: action: let
|
||||
actionStr =
|
||||
if isString action
|
||||
then action
|
||||
else action.action;
|
||||
actionProps =
|
||||
if isString action
|
||||
then {}
|
||||
else filterAttrs (n: v: n != "action") action;
|
||||
in {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action.__raw = prefix + actionStr;
|
||||
keymapsOnEvents.LspAttach = let
|
||||
mkMaps = prefix:
|
||||
mapAttrsToList
|
||||
(
|
||||
key: action: let
|
||||
actionStr =
|
||||
if isString action
|
||||
then action
|
||||
else action.action;
|
||||
actionProps =
|
||||
if isString action
|
||||
then {}
|
||||
else filterAttrs (n: v: n != "action") action;
|
||||
in {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = helpers.mkRaw (prefix + actionStr);
|
||||
|
||||
options =
|
||||
{
|
||||
inherit (cfg.keymaps) silent;
|
||||
}
|
||||
// actionProps;
|
||||
}
|
||||
);
|
||||
in
|
||||
(mkMaps "vim.diagnostic." cfg.keymaps.diagnostic)
|
||||
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||
++ cfg.keymaps.extra;
|
||||
};
|
||||
options =
|
||||
{
|
||||
inherit (cfg.keymaps) silent;
|
||||
}
|
||||
// actionProps;
|
||||
}
|
||||
);
|
||||
in
|
||||
(mkMaps "vim.diagnostic." cfg.keymaps.diagnostic)
|
||||
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||
++ cfg.keymaps.extra;
|
||||
|
||||
# Enable all LSP servers
|
||||
extraConfigLua = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue