mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-25 10:18:36 +02:00
plugins/nvim-cmp: Correctly handle multi mode mappings (#537)
Fixes #536
This commit is contained in:
parent
02a0093468
commit
2e7137058d
2 changed files with 29 additions and 1 deletions
|
@ -505,7 +505,7 @@ in {
|
||||||
&& ((length modes) >= 1)
|
&& ((length modes) >= 1)
|
||||||
)
|
)
|
||||||
("," + (helpers.toLuaObject modes));
|
("," + (helpers.toLuaObject modes));
|
||||||
in "cmp.mapping(${mapping.action}${modesString})"
|
in "cmp.mapping(${action.action}${modesString})"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
mapping);
|
mapping);
|
||||||
|
|
|
@ -11,6 +11,34 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Issue #536
|
||||||
|
mappings = {
|
||||||
|
plugins.nvim-cmp = {
|
||||||
|
enable = true;
|
||||||
|
mapping = {
|
||||||
|
"<CR>" = "cmp.mapping.confirm({ select = false })";
|
||||||
|
"<Tab>" = {
|
||||||
|
modes = ["i" "s"];
|
||||||
|
action = ''
|
||||||
|
function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif check_backspace() then
|
||||||
|
fallback()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# All the upstream default options of nvim-cmp
|
# All the upstream default options of nvim-cmp
|
||||||
defaults = {
|
defaults = {
|
||||||
plugins.nvim-cmp = {
|
plugins.nvim-cmp = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue