summaryrefslogtreecommitdiffstatshomepage
path: root/nvim/.config/nvim/lua/tobyvin/plugins/lspconfig.lua
blob: 3549fe20700b7e8e326c80e89f7f9ef0791ae711 (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
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
	vim.notify("Failed to load module 'lspconfig'", vim.log.levels.ERROR)
	return
end

local lsp = require("tobyvin.lsp")

require("lspconfig.ui.windows").default_options.border = "single"

lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, lsp.default_config)

local available = lspconfig.util.available_servers()
for name, config in pairs(lsp.configs) do
	if not vim.tbl_contains(available, name) then
		lspconfig[name].setup(config)
	end
end

vim.api.nvim_create_autocmd("LspAttach", {
	group = vim.api.nvim_create_augroup("tobyvin_lsp_config", { clear = true }),
	desc = "lsp",
	callback = function(args)
		local lspinfo = require("lspconfig.ui.lspinfo")
		vim.keymap.set("n", "<leader>li", lspinfo, { desc = "lsp info", buffer = args.buf })
	end,
})