mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-25 10:18:36 +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 {
|
mkIf cfg.enable {
|
||||||
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
||||||
|
|
||||||
keymapsOnEvents = {
|
keymapsOnEvents.LspAttach = let
|
||||||
"LspAttach" = let
|
mkMaps = prefix:
|
||||||
mkMaps = prefix:
|
mapAttrsToList
|
||||||
mapAttrsToList
|
(
|
||||||
(
|
key: action: let
|
||||||
key: action: let
|
actionStr =
|
||||||
actionStr =
|
if isString action
|
||||||
if isString action
|
then action
|
||||||
then action
|
else action.action;
|
||||||
else action.action;
|
actionProps =
|
||||||
actionProps =
|
if isString action
|
||||||
if isString action
|
then {}
|
||||||
then {}
|
else filterAttrs (n: v: n != "action") action;
|
||||||
else filterAttrs (n: v: n != "action") action;
|
in {
|
||||||
in {
|
mode = "n";
|
||||||
mode = "n";
|
inherit key;
|
||||||
inherit key;
|
action = helpers.mkRaw (prefix + actionStr);
|
||||||
action.__raw = prefix + actionStr;
|
|
||||||
|
|
||||||
options =
|
options =
|
||||||
{
|
{
|
||||||
inherit (cfg.keymaps) silent;
|
inherit (cfg.keymaps) silent;
|
||||||
}
|
}
|
||||||
// actionProps;
|
// actionProps;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
(mkMaps "vim.diagnostic." cfg.keymaps.diagnostic)
|
(mkMaps "vim.diagnostic." cfg.keymaps.diagnostic)
|
||||||
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||||
++ cfg.keymaps.extra;
|
++ cfg.keymaps.extra;
|
||||||
};
|
|
||||||
|
|
||||||
# Enable all LSP servers
|
# Enable all LSP servers
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue