diff --git a/plugins/completion/nvim-cmp/default.nix b/plugins/completion/nvim-cmp/default.nix index 911eaf24..ab4d95aa 100644 --- a/plugins/completion/nvim-cmp/default.nix +++ b/plugins/completion/nvim-cmp/default.nix @@ -505,7 +505,7 @@ in { && ((length modes) >= 1) ) ("," + (helpers.toLuaObject modes)); - in "cmp.mapping(${mapping.action}${modesString})" + in "cmp.mapping(${action.action}${modesString})" ) ) mapping); diff --git a/tests/test-sources/plugins/completion/nvim-cmp.nix b/tests/test-sources/plugins/completion/nvim-cmp.nix index 4488e047..1920798f 100644 --- a/tests/test-sources/plugins/completion/nvim-cmp.nix +++ b/tests/test-sources/plugins/completion/nvim-cmp.nix @@ -11,6 +11,34 @@ }; }; + # Issue #536 + mappings = { + plugins.nvim-cmp = { + enable = true; + mapping = { + "" = "cmp.mapping.confirm({ select = false })"; + "" = { + 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 defaults = { plugins.nvim-cmp = {