You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have various Insert Mode shortcuts that can trigger TextChangedI, eg CTRL+/ toggles a comment line. It seems that the plugin considers this to be typing and so renders the autocompletion popup, even though I wasn't typing. I know there is a note in the Wiki about disabling the plugin on comment lines, but that doesn't help because the completion popup renders even when I toggle the comment off.
Does nobody else have this problem? I feel like my config is fairly standard:
localhas_words_before=function()
localline, col=table.unpack(vim.api.nvim_win_get_cursor(0))
returncol~=0andvim.api.nvim_buf_get_lines(0, line-1, line, true)[1]:sub(col, col):match("%s") ==nilendlocallspkind=require("lspkind")
localsnippy=require("snippy")
localcmp=require("cmp")
-- vim.o.completeopt = "menuone,noselect"localclose=cmp.mapping({
i=cmp.mapping.abort(),
c=cmp.mapping.close(),
})
cmp.setup({
snippet= {
expand=function(args)
require("snippy").expand_snippet(args.body)
end,
},
mapping= {
["<Tab>"] =cmp.mapping(function(fallback)
ifcmp.visible() thencmp.select_next_item()
elseifsnippy.can_expand_or_advance() thensnippy.expand_or_advance()
elseifhas_words_before() thencmp.complete()
elsefallback()
endend, { "i", "s" }),
["<S-Tab>"] =cmp.mapping(function(fallback)
ifcmp.visible() thencmp.select_prev_item()
elseifsnippy.can_jump(-1) thensnippy.previous()
elsefallback()
endend, { "i", "s" }),
["<C-y>"] =cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<Esc>"] =close,
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] =cmp.mapping.confirm({ select=false }),
},
sources=cmp.config.sources({
{ name="nvim_lsp" },
{ name="snippy" },
}, {
{ name="buffer" },
{ name="path" },
}),
formatting= {
format=lspkind.cmp_format({
with_text=false, -- do not show text alongside icons-- prevent the popup from showing more than provided characters-- (e.g 50 will not show more than 50 characters)maxwidth=50,
-- The function below will be called before any actual modifications from lspkind-- so that you can provide more controls on popup customization.-- (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))before=function(_, vim_item)
returnvim_itemend,
}),
},
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).cmp.setup.cmdline("/", {
mapping=cmp.mapping.preset.cmdline(),
sources= {
{ name="buffer" },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).cmp.setup.cmdline(":", {
mapping=cmp.mapping.preset.cmdline(),
sources=cmp.config.sources({
{ name="path" },
}, {
{ name="cmdline" },
}),
})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have various Insert Mode shortcuts that can trigger
TextChangedI
, egCTRL+/
toggles a comment line. It seems that the plugin considers this to be typing and so renders the autocompletion popup, even though I wasn't typing. I know there is a note in the Wiki about disabling the plugin on comment lines, but that doesn't help because the completion popup renders even when I toggle the comment off.Does nobody else have this problem? I feel like my config is fairly standard:
Beta Was this translation helpful? Give feedback.
All reactions