summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/setup/lspconfig.lua
blob: f93cff7201e575627974635ee1c8c566bfc8d478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require("nvim-lsp-installer").setup {}
local lspconfig = require("lspconfig")

local function on_attach()
    vim.cmd('doautocmd User lspAttached')
    vim.cmd('augroup Format')
    vim.cmd('autocmd! * <buffer>')
    vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()')
    vim.cmd('augroup END')
end

lspconfig.sumneko_lua.setup {
    on_attach = on_attach,
    settings = {
        Lua = {
            diagnostics = {
                globals = { 'vim' }
            }
        }
    }
}
lspconfig.clangd.setup {
    on_attach = on_attach,
}
lspconfig.rust_analyzer.setup {
    on_attach = on_attach,
}
lspconfig.bashls.setup {
    on_attach = on_attach,
}
lspconfig.dockerls.setup {
    on_attach = on_attach,
}
lspconfig.yamlls.setup {
    on_attach = on_attach,
}
lspconfig.html.setup {
    on_attach = on_attach,
}
lspconfig.cssls.setup {
    on_attach = on_attach,
}
lspconfig.marksman.setup {
    on_attach = on_attach,
}
lspconfig.jsonls.setup {
    on_attach = on_attach,
}
lspconfig.tsserver.setup {
    on_attach = on_attach,
}
lspconfig.omnisharp.setup {
    on_attach = on_attach,
    use_mono = true,
}
lspconfig.texlab.setup {
    on_attach = on_attach,
}
vim.cmd("let g:tex_flavor = 'tex'")

local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
    local hl = "DiagnosticSign" .. type
    vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end