Nvim: switch lsp to lua and cmp to coq

This commit is contained in:
2022-09-10 00:17:27 +02:00
parent 253e11a4b3
commit 6d352502a0
3 changed files with 87 additions and 103 deletions

View File

@@ -1,73 +1,73 @@
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
-- vim.fn["vsnip#anonymous"](args.body)
-- For `luasnip` user.
-- require('luasnip').lsp_expand(args.body)
-- For `ultisnips` user.
vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<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' }),
['<tab>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'ultisnips' },
{ name = 'calc' },
{ name = 'cmp_matlab' },
{ name = 'cmp_git' },
}, {
{ name = 'buffer', keyword_length = 5, max_item_count = 10, priority = -5 },
}),
--experimental = {
-- native_menu = false
--}
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.recently_used,
require("clangd_extensions.cmp_scores"),
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
})
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
sources = {
{ name = 'cmdline' }
},
mapping = cmp.mapping.preset.cmdline()
})
require("cmp_git").setup()
--local cmp = require'cmp'
--
--cmp.setup({
-- snippet = {
-- expand = function(args)
-- -- For `vsnip` user.
-- -- vim.fn["vsnip#anonymous"](args.body)
--
-- -- For `luasnip` user.
-- -- require('luasnip').lsp_expand(args.body)
--
-- -- For `ultisnips` user.
-- vim.fn["UltiSnips#Anon"](args.body)
-- end,
-- },
-- mapping = cmp.mapping.preset.insert({
-- ['<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' }),
-- ['<tab>'] = cmp.mapping.confirm({ select = true }),
-- ['<C-e>'] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
-- }),
-- }),
-- sources = cmp.config.sources({
-- { name = 'nvim_lsp' },
--
-- { name = 'path' },
--
-- { name = 'ultisnips' },
--
-- { name = 'calc' },
--
-- { name = 'cmp_matlab' },
--
-- { name = 'cmp_git' },
-- }, {
-- { name = 'buffer', keyword_length = 5, max_item_count = 10, priority = -5 },
-- }),
-- --experimental = {
-- -- native_menu = false
-- --}
--
-- sorting = {
-- comparators = {
-- cmp.config.compare.offset,
-- cmp.config.compare.exact,
-- cmp.config.compare.recently_used,
-- require("clangd_extensions.cmp_scores"),
-- cmp.config.compare.kind,
-- cmp.config.compare.sort_text,
-- cmp.config.compare.length,
-- cmp.config.compare.order,
-- },
-- },
--})
--
--cmp.setup.cmdline('/', {
-- sources = {
-- { name = 'buffer' }
-- }
--})
--
--cmp.setup.cmdline(':', {
-- sources = {
-- { name = 'cmdline' }
-- },
-- mapping = cmp.mapping.preset.cmdline()
--})
--
--require("cmp_git").setup()