Replies: 1 comment
-
Does C-space display candidates for you?
It should trigger automatically if you did not set autocomplete to false. Otherwise your C-space mapping should trigger completion.
The tab bindings look correct but it will only work if there's already a menu If you want to have TAB for selecting next candidate and also open the menu if it's not already opened, you have to use a custom function, see this wiki page. You can remove the snippet checks if you're not using a snippet engine: local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
-- ... mappings table ...
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i" }),
-- ... mappings table ... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have this block in setup():
that expect to trigger cmp to display candidates while typing or press
tab
to pop-up candiates but does not happens in my case.Is there smth wrong with above setup with recent update from cmp?
Beta Was this translation helpful? Give feedback.
All reactions