1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

chore: fix neovim completion shortcuts, address nix warnings

This commit is contained in:
oddlama 2024-06-20 17:44:41 +02:00
parent 0349d7fd8b
commit a0e50ce0e9
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
6 changed files with 40 additions and 60 deletions

View file

@ -36,9 +36,7 @@
];
mapping = {
"<CR>" =
/*
lua
*/
# lua
''
cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
@ -46,24 +44,16 @@
})
'';
"<C-d>" =
/*
lua
*/
# lua
"cmp.mapping.scroll_docs(-4)";
"<C-f>" =
/*
lua
*/
# lua
"cmp.mapping.scroll_docs(4)";
"<C-e>" =
/*
lua
*/
# lua
"cmp.mapping.abort()";
"<Tab>" =
/*
lua
*/
# lua
''
cmp.mapping(function(fallback)
local has_words_before = function()
@ -77,17 +67,21 @@
require("luasnip").expand()
elseif require("luasnip").expand_or_locally_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
--elseif has_words_before() then
-- cmp.complete()
else
fallback()
end
end, {"i", "s"})
'';
"<Down>" =
# lua
''cmp.mapping(cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), {'i'})'';
"<Up>" =
# lua
''cmp.mapping(cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), {'i'})'';
"<S-Tab>" =
/*
lua
*/
# lua
''
cmp.mapping(function(fallback)
if cmp.visible() then
@ -102,9 +96,7 @@
};
formatting.fields = ["abbr" "kind" "menu"];
formatting.format =
/*
lua
*/
# lua
''
function(_, vim_item)
local icons = {
@ -154,9 +146,7 @@
end
'';
snippet.expand =
/*
lua
*/
# lua
''
function(args)
require('luasnip').lsp_expand(args.body)