|
@ -14,50 +14,72 @@ function M.config() |
|
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. |
|
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. |
|
|
end, |
|
|
end, |
|
|
}, |
|
|
}, |
|
|
mapping = { -- TODO: do these mappings |
|
|
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-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. |
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. |
|
|
--[''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), |
|
|
|
|
|
--[''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), |
|
|
|
|
|
--[''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. |
|
|
|
|
|
--[''] = cmp.mapping({ |
|
|
|
|
|
-- i = cmp.mapping.abort(), |
|
|
|
|
|
-- c = cmp.mapping.close(), |
|
|
|
|
|
--}), |
|
|
|
|
|
}, |
|
|
}, |
|
|
sources = cmp.config.sources({ |
|
|
sources = cmp.config.sources({ |
|
|
{ name = 'luasnip' }, |
|
|
{ name = 'nvim_lsp' }, |
|
|
-- { name = 'nvim_lsp' }, |
|
|
-- { name = 'luasnip' }, -- For luasnip users. |
|
|
-- { name = 'ultisnips' }, |
|
|
-- { name = 'ultisnips' }, -- For ultisnips users. |
|
|
-- { name = 'snippy' }, |
|
|
-- { name = 'snippy' }, -- For snippy users. |
|
|
}, {{ name = 'buffer' }}) |
|
|
}, { |
|
|
|
|
|
{ name = 'buffer' }, |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
-- Set configuration for specific filetype. |
|
|
|
|
|
cmp.setup.filetype('gitcommit', { |
|
|
|
|
|
sources = cmp.config.sources({ |
|
|
|
|
|
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. |
|
|
|
|
|
}, { |
|
|
|
|
|
{ name = 'buffer' }, |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- completion for status line commands (if you enabled `native_menu`, this won't work anymore). |
|
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). |
|
|
cmp.setup.cmdline('/', { |
|
|
cmp.setup.cmdline('/', { |
|
|
sources = { |
|
|
sources = { |
|
|
{ name = 'buffer' } |
|
|
{ name = 'buffer' } |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). |
|
|
cmp.setup.cmdline(':', { |
|
|
cmp.setup.cmdline(':', { |
|
|
sources = cmp.config.sources({ |
|
|
sources = cmp.config.sources({ |
|
|
{ name = 'path' } |
|
|
{ name = 'path' } |
|
|
}, { |
|
|
}, { |
|
|
{ name = 'cmdline' } |
|
|
{ name = 'cmdline' } |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
-- nvim-lspconfig config |
|
|
-- nvim-lspconfig config |
|
|
local servers = { 'clangd', 'ccls' } |
|
|
-- Use a loop to conveniently call 'setup' on multiple servers and |
|
|
|
|
|
-- map buffer local keybindings when the language server attaches |
|
|
|
|
|
local servers = { 'ccls' } |
|
|
for _, lsp in pairs(servers) do |
|
|
for _, lsp in pairs(servers) do |
|
|
require('lspconfig')[lsp].setup { |
|
|
require('lspconfig')[lsp].setup { |
|
|
on_attach = on_attach, |
|
|
on_attach = on_attach, |
|
|
flags = { |
|
|
flags = { |
|
|
-- This will be the default in neovim 0.7+ |
|
|
-- This will be the default in neovim 0.7+ |
|
|
debounce_text_changes = 150, |
|
|
debounce_text_changes = 150, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- C-CPP-Modern config |
|
|
|
|
|
vim.g.cpp_function_highlight = 1 |
|
|
|
|
|
vim.g.cpp_attributes_highlight = 1 |
|
|
|
|
|
vim.g.cpp_member_highlight = 1 |
|
|
|
|
|
vim.g.cpp_simple_highlight = 1 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
return M |
|
|
return M |
|
|
|
|
|
|
|
|