2021-09-30 17:58:22 +00:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
function M.config_cmp()
|
|
|
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
|
|
|
local cmp = require("cmp")
|
|
|
|
cmp.setup {
|
|
|
|
completion = {
|
|
|
|
completeopt = "menuone,noinsert,noselect",
|
|
|
|
autocomplete = false,
|
|
|
|
},
|
2021-12-01 17:49:21 +00:00
|
|
|
expand = function(args)
|
|
|
|
require("luasnip").lsp_expand(args.body)
|
|
|
|
end,
|
2021-09-30 17:58:22 +00:00
|
|
|
sources = {
|
|
|
|
{name = "nvim_lsp"},
|
2021-12-01 17:49:21 +00:00
|
|
|
{name = "luasnip"},
|
2021-09-30 17:58:22 +00:00
|
|
|
{name = "buffer"},
|
|
|
|
{name = "spell"},
|
2021-08-25 23:21:50 +00:00
|
|
|
},
|
|
|
|
}
|
2021-09-30 17:58:22 +00:00
|
|
|
|
|
|
|
-- Add a plug mapping to use in C-Space binding
|
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
"i",
|
|
|
|
"<Plug>(cmp_complete)",
|
|
|
|
"<cmd>lua require('cmp').complete()<CR>",
|
|
|
|
{silent = true, noremap = true}
|
|
|
|
)
|
2021-08-25 23:21:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- TODO: Some issue with tags completion maybe compe is better?
|
2021-09-30 17:58:22 +00:00
|
|
|
function M.config_complete()
|
2021-08-25 23:21:50 +00:00
|
|
|
vim.o.completeopt = "menuone,noinsert,noselect"
|
|
|
|
-- shortmess+=c
|
|
|
|
vim.g.completion_enable_auto_popup = 0
|
|
|
|
-- vim.api.nvim_set_keymap("i", "<C-Space>", "<Plug>(completion_trigger)", {silent=true})
|
|
|
|
vim.g.completion_enable_auto_paren = 1
|
|
|
|
vim.cmd([[
|
|
|
|
augroup completionPlugin
|
|
|
|
autocmd BufEnter * lua require('completion').on_attach()
|
|
|
|
augroup end
|
|
|
|
]])
|
|
|
|
end
|
|
|
|
|
2021-09-30 17:58:22 +00:00
|
|
|
return M
|