feat: update cmp configuration for better Lua support and improved keybindings
- Updated snippet expansion function to use Lua syntax. - Added new mappings for scrolling, completing, closing, selecting next/previous items, and confirming with replacement behavior. - Ensured compatibility with Lua syntax in the Nix environment.
This commit is contained in:
parent
ff3656deb7
commit
547ed496e7
|
@ -11,17 +11,36 @@
|
|||
{name = "path";} # Filesystem paths
|
||||
];
|
||||
# The snippet expansion function.
|
||||
snippet.expand = ''
|
||||
snippet.expand =
|
||||
#Lua
|
||||
''
|
||||
function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
'';
|
||||
# cmp mappings declaration
|
||||
mapping = {
|
||||
"<C-down>" = "cmp.mapping.select_next_item()";
|
||||
"<C-up>" = "cmp.mapping.select_prev_item()";
|
||||
"<C-esc>" = "cmp.mapping.abort()";
|
||||
"<C-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
||||
"<C-s>" =
|
||||
# Lua
|
||||
"cmp.mapping.scroll_docs(-4)";
|
||||
"<C-t>" =
|
||||
# Lua
|
||||
"cmp.mapping.scroll_docs(4)";
|
||||
"<C-Space>" =
|
||||
# Lua
|
||||
"cmp.mapping.complete()";
|
||||
"<C-esc>" =
|
||||
# Lua
|
||||
"cmp.mapping.close()";
|
||||
"<Tab>" =
|
||||
# Lua
|
||||
"cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
||||
"<S-Tab>" =
|
||||
# Lua
|
||||
"cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
||||
"<CR>" =
|
||||
# Lua
|
||||
"cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace })";
|
||||
};
|
||||
};
|
||||
# Scans the sources array and enable the corresponding plugins if they are known to nixvim.
|
||||
|
|
Loading…
Reference in a new issue