1
0
Fork 0

module(neovim): update keymaps

This commit is contained in:
Antoine Langlois 2024-03-31 15:17:27 +02:00
parent ac08547f59
commit 345640a7e3
Signed by: DataHearth
GPG Key ID: 946E2D0C410C7B3D
4 changed files with 25 additions and 15 deletions

View File

@ -46,6 +46,7 @@ in
};
keymaps = import ./keymaps;
plugins = {
barbecue.enable = true;
chadtree.enable = true;
cmp = import ./plugins/cmp.nix { lib = lib; };
cmp-buffer.enable = true;

View File

@ -7,16 +7,4 @@
action = "<cmd>TroubleToggle<cr>";
key = "<C-S-t>";
}
{
action = "<cmd>lua vim.lsp.buf.hover()<cr>";
key = "<S-k>";
}
{
action = "<cmd>lua vim.lsp.buf.format()<cr>";
key = "<leader>f";
}
{
action = "<cmd>lua vim.lsp.buf.code_action()<cr>";
key = "<leader>a";
}
]

View File

@ -18,7 +18,7 @@
}):find()
end
'';
key = "<C-e>";
key = "<leader>e";
lua = true;
}
{

View File

@ -5,9 +5,29 @@
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<CR>" = "cmp.mapping.confirm({ select = false })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Down>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Up>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<C-e>" = "cmp.mapping(cmp.mapping.abort(), {'i', 's'})";
"<Tab>" = ''
cmp.mapping(function(fallback)
local luasnip = require("luasnip")
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, {'i', 's'})
'';
"<S-Tab>" = ''
cmp.mapping(function(fallback)
local luasnip = require("luasnip")
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, {'i', 's'})
'';
};
sources = [
{ name = "nvim_lsp"; }
@ -44,6 +64,7 @@
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None";
col_offset = -3;
side_padding = 0;
border = "rounded";
};
};
};