neovim configuration using rocks.nvim plugin manager
1vim.diagnostic.config({
2 underline = true,
3 virtual_text = true,
4 signs = {
5 text = {
6 [vim.diagnostic.severity.ERROR] = "",
7 [vim.diagnostic.severity.WARN] = "",
8 [vim.diagnostic.severity.INFO] = "",
9 [vim.diagnostic.severity.HINT] = "",
10 },
11 linehl = {
12 [vim.diagnostic.severity.ERROR] = "DiagnosticLineError",
13 [vim.diagnostic.severity.WARN] = "DiagnosticLineWarn",
14 [vim.diagnostic.severity.INFO] = "DiagnosticLineInfo",
15 -- [vim.diagnostic.severity.HINT] = "DiagnosticLineHint",
16 },
17 },
18 -- float
19 -- update_in_insert
20 servirty_sort = true,
21})
22
23-- TODO: come back here later, find better way then this
24if vim.env.NOLSP == "1" then
25 return
26end
27do
28 local ok, lazydev = pcall(require, "lazydev")
29 if ok then
30 lazydev.setup({
31 library = {
32 { path = "${3rd}/luv/library", words = { "vim%.uv" } },
33 },
34 })
35 end
36end
37
38vim.api.nvim_create_autocmd("LspAttach", {
39 group = vim.api.nvim_create_augroup("user.lspattach", { clear = false }),
40 callback = function(ev)
41 vim.lsp.completion.enable(true, ev.data.client_id, ev.buf, { autotrigger = false })
42 end,
43})
44
45local ok, lspconfig = pcall(require, "lspconfig")
46if not ok then return end
47
48local function setup(server, opts)
49 -- NOTE: This isn't perfect, but it should work for 99% of uninstalled servers
50 local cmd = lspconfig[server].document_config.default_config.cmd[1]
51 if vim.fn.executable(cmd) == 0 then
52 return
53 end
54 opts = opts or {}
55 lspconfig[server].setup(opts)
56end
57
58for name, opts in pairs(require("core.lsp.servers")) do
59 setup(name, opts)
60end