vim: add ultisnips as cmp source, cleanup

This commit is contained in:
Asmir A 2023-07-07 11:12:48 +02:00
parent 2a9bcf2f24
commit 4d52dcadc7

View File

@ -123,6 +123,7 @@ cmp.setup({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'path' },
{ name = 'ultisnips' },
}),
mapping = {
["<Tab>"] = cmp.mapping({
@ -175,25 +176,8 @@ cmp.setup({
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'nixd', 'texlab', 'verible' }
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local on_attach = function(bufnr)
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "line",
}
vim.diagnostic.open_float(nil, opts)
end,
})
end
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach(),
capabilities = capabilities
}
end