How to make autocomplete manually triggered? #2608
-
Whenever I am writing code but most often happens with comments, there are situations where the autocomplete popup shows up with some match, and while writing the comment or code in the speed of it, NvChad totally messes up what I am trying to write, as it is either inserting a huge snippet or overwriting the word I am trying to write with something else, and all I'm doing is just simply writing. I am not looking to disable the autocomplete popup, as I find it useful to see suggestions, but I want to have to press TAB first to actually select into it an item that I want to autocomplete, and then press Enter like usual to activate the completion, but I do not want the completion to ever activate by itself. I have been looking into this but I am quite new to using nvim, just a few months. I believe it's the cmp plugin that I need to configure, and I need to disable the preselection to be None, as referenced here: hrsh7th/nvim-cmp#1411 but I am not sure how to configure cmp correctly with NvChad. Can anyone help and is there any chance that this might become the default configuration? It's practically the default with most other editors. Thanks! #2193 - completely disables autocomplete popup and you have to press Ctrl-Space to trigger it, which I do not want. Two less keys to press this way. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
I seem to have found the solution, which is what is proposed in #2193, except it does not disable the popup like it says in the ticket, but only disables cmp from automatically performing completion with the first item (which it used to automatically select) when pressing space, which is exactly what I wanted! local plugins = {
-- other plugins...
{
"hrsh7th/nvim-cmp",
opts = {
completion = {
autocomplete = false,
},
},
},
-- other plugins...
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Finally did it! {
"hrsh7th/nvim-cmp",
opts = {
mapping = {
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
-- when true, auto-selects the first item if nothing was selected,
-- making noselect below not take effect.
select = false,
},
},
-- adding noselect compared to default, to prevent autocomplete when typing,
-- and this is actually nvim-cmp defaults, but NvChad overrides this.
completion = {
completeopt = "menu,menuone,noselect",
},
-- for LSPs that (re)enable this:
preselect = cmp.PreselectMode.None,
},
}, |
Beta Was this translation helpful? Give feedback.
Finally did it!