Configure nvim-cmp for s and c mode
This commit is contained in:
parent
e142a3ec5b
commit
f4631cbaa2
@ -34,15 +34,16 @@ cmp.setup {
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<Up>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's'}),
|
||||
['<Down>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }),
|
||||
['<C-e>'] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }),
|
||||
['<CR>'] = cmp.mapping({
|
||||
i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }),
|
||||
c = cmp.mapping.confirm({ select = false }),
|
||||
s = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.expand_or_jumpable() then
|
||||
@ -76,9 +77,26 @@ cmp.setup {
|
||||
{name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"},
|
||||
{name = "emoji"}
|
||||
},
|
||||
completion = {completeopt = 'menu,menuone,noinsert'}
|
||||
completion = {completeopt = 'menu,menuone,noinsert, noselect'},
|
||||
-- experimental = { native_menu = true }
|
||||
}
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
}),
|
||||
})
|
||||
|
||||
-- Autopairs
|
||||
--require("nvim-autopairs.completion.cmp").setup({
|
||||
-- map_cr = true,
|
||||
|
@ -84,11 +84,6 @@ utils.map('n', '<C-y>', '<cmd>Telescope neoclip<cr>')
|
||||
utils.map('n', '<leader>j', '<cmd>Telescope jumplist<cr>')
|
||||
|
||||
-- wildmode
|
||||
utils.map('c', '<up>', 'wildmenumode() ? "\\<left>" : "\\<up>"', {expr = true})
|
||||
utils.map('c', '<down>', 'wildmenumode() ? "\\<right>" : "\\<down>"', {expr = true})
|
||||
utils.map('c', '<left>', 'wildmenumode() ? "\\<up>" : "\\<left>"', {expr = true})
|
||||
utils.map('c', '<right>', 'wildmenumode() ? "\\<bs>\\<C-Z>" : "\\<right>"', {expr = true})
|
||||
utils.map('c', '<CR>', 'wildmenumode() ? "\\<bs>\\<C-Z>" : "\\<CR>"', {expr = true})
|
||||
|
||||
-- Symbols Outline
|
||||
utils.map('n', '<leader>s', '<cmd>SymbolsOutline<cr>')
|
||||
|
@ -24,7 +24,7 @@ return require('packer').startup(function()
|
||||
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lua',
|
||||
'octaltree/cmp-look', 'hrsh7th/cmp-path', 'hrsh7th/cmp-calc',
|
||||
'f3fora/cmp-spell', 'hrsh7th/cmp-emoji'
|
||||
'f3fora/cmp-spell', 'hrsh7th/cmp-emoji', 'hrsh7th/cmp-cmdline'
|
||||
}
|
||||
}
|
||||
use {'rafamadriz/friendly-snippets'}
|
||||
|
Loading…
x
Reference in New Issue
Block a user