Disable auto-select the first item on suggestion #1411
-
How can I disable auto-select the first item on suggestion until I press a key like |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 13 replies
-
Set |
Beta Was this translation helpful? Give feedback.
-
Good Solution! |
Beta Was this translation helpful? Give feedback.
-
I don't know why but I cannot get it working. In my lua <<EOF
local cmp = require'cmp'
cmp.setup({
preselect = cmp.PreselectMode.None,
completion = {
completeopt = "menu,menuone,noneselect"
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({select = false}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
}, {
{ name = 'buffer' },
})
})
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' },
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
--[[
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
require('lspconfig')['pyright'].setup {
capabilities = capabilities
}
require('lspconfig')['tsserver'].setup {
capabilities = capabilities
}
--]]
EOF but I still get the 1st option auto selected? NVIM v0.10.1 |
Beta Was this translation helpful? Give feedback.
-
Use Supertab config in https://www.lazyvim.org/configuration/recipes, add blow: |
Beta Was this translation helpful? Give feedback.
Set
preselect
tocmp.PreselectMode.None
, see:h cmp-config.preselect