Disable auto-select the first item on suggestion #1411
Answered
by
fitrh
tranmanhlt7a4
asked this question in
Q&A
|
How can I disable auto-select the first item on suggestion until I press a key like |
Answered by
fitrh
Jan 23, 2023
Replies: 4 comments 16 replies
|
Set |
9 replies
Answer selected by
tranmanhlt7a4
|
Good Solution! |
0 replies
|
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
}
--]]
EOFbut I still get the 1st option auto selected? NVIM v0.10.1 |
6 replies
|
Use Supertab config in https://www.lazyvim.org/configuration/recipes, add blow: |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Set
preselecttocmp.PreselectMode.None, see:h cmp-config.preselect