vim: add ultisnips as cmp source, cleanup
This commit is contained in:
parent
2a9bcf2f24
commit
4d52dcadc7
@ -123,6 +123,7 @@ cmp.setup({
|
|||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
|
{ name = 'ultisnips' },
|
||||||
}),
|
}),
|
||||||
mapping = {
|
mapping = {
|
||||||
["<Tab>"] = cmp.mapping({
|
["<Tab>"] = cmp.mapping({
|
||||||
@ -175,25 +176,8 @@ cmp.setup({
|
|||||||
|
|
||||||
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'nixd', 'texlab', 'verible' }
|
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'lua_ls', 'nixd', 'texlab', 'verible' }
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
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
|
for _, lsp in pairs(servers) do
|
||||||
require('lspconfig')[lsp].setup {
|
require('lspconfig')[lsp].setup {
|
||||||
on_attach = on_attach(),
|
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user