mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:50:05 +08:00
fix(nvim-cmp): fix nvim-cmp config
This commit is contained in:
parent
450501ce3b
commit
7ff6dff903
@ -1,10 +1,12 @@
|
|||||||
|
" we are using https://github.com/hrsh7th/nvim-cmp/tree/3192a0c57837c1ec5bf298e4f3ec984c7d2d60c0
|
||||||
|
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
-- Setup nvim-cmp.
|
-- Setup nvim-cmp.
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = {
|
||||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||||
@ -12,33 +14,20 @@ lua <<EOF
|
|||||||
i = cmp.mapping.abort(),
|
i = cmp.mapping.abort(),
|
||||||
c = cmp.mapping.close(),
|
c = cmp.mapping.close(),
|
||||||
}),
|
}),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
['<Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
['<S-Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}),
|
|
||||||
formatting = {
|
|
||||||
format = require("lspkind").cmp_format({with_text = true, menu = ({
|
|
||||||
buffer = "[Buffer]",
|
|
||||||
})}),
|
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'path' }, -- For vsnip users.
|
||||||
|
-- { name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
}, {
|
}, {
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
}, {
|
|
||||||
{ name = 'path' },
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Setup lspconfig.
|
||||||
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user