37 lines
1.1 KiB
Lua
37 lines
1.1 KiB
Lua
local cmp = require("cmp")
|
|
|
|
cmp.setup({
|
|
mapping = {
|
|
["<C-b>"] = 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-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
|
['<C-e>'] = cmp.mapping({
|
|
i = cmp.mapping.abort(),
|
|
c = cmp.mapping.close(),
|
|
}),
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
},
|
|
sources = cmp.config.sources({
|
|
{name = "nvim_lsp"},
|
|
}, {
|
|
{name = "buffer"},
|
|
}),
|
|
})
|
|
|
|
cmp.setup.cmdline(":", {
|
|
sources = cmp.config.sources({
|
|
{name = "path"},
|
|
}, {
|
|
{name = "buffer"},
|
|
}),
|
|
})
|
|
|
|
-- Setup lspconfig.
|
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
local lsps = {"sumneko_lua", "rust_analyzer"}
|
|
for _, lsp in pairs(lsps) do
|
|
require('lspconfig')[lsp].setup {
|
|
capabilities = capabilities
|
|
}
|
|
end
|