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
|
{name = "path";} # Filesystem paths
|
||||||
];
|
];
|
||||||
# The snippet expansion function.
|
# The snippet expansion function.
|
||||||
snippet.expand = ''
|
snippet.expand =
|
||||||
|
#Lua
|
||||||
|
''
|
||||||
function(args)
|
function(args)
|
||||||
require('luasnip').lsp_expand(args.body)
|
require('luasnip').lsp_expand(args.body)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
# cmp mappings declaration
|
# cmp mappings declaration
|
||||||
mapping = {
|
mapping = {
|
||||||
"<C-down>" = "cmp.mapping.select_next_item()";
|
"<C-s>" =
|
||||||
"<C-up>" = "cmp.mapping.select_prev_item()";
|
# Lua
|
||||||
"<C-esc>" = "cmp.mapping.abort()";
|
"cmp.mapping.scroll_docs(-4)";
|
||||||
"<C-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
|
"<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.
|
# Scans the sources array and enable the corresponding plugins if they are known to nixvim.
|
||||||
|
|
Loading…
Reference in a new issue