aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/lsp-config.lua
blob: 117db540b70dedc2631f883e96195455c7cfa63f (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
return {
	{
		"neovim/nvim-lspconfig",
		config = function()
			local capabilities = require('cmp_nvim_lsp').default_capabilities()
			vim.lsp.enable({
				"lua_ls", "clangd", "rust_analyzer", "bashls",
				"html", "cssls", "jsonls", "yamlls"
			})
			vim.diagnostic.config({
				virtual_text = {
					prefix = '',
					spacing = 4,
				},
				signs = {
					text = {
						[vim.diagnostic.severity.ERROR] = '',
						[vim.diagnostic.severity.WARN] = '',
					},
					linehl = {
						[vim.diagnostic.severity.ERROR] = 'ErrorMsg',
					},
					numhl = {
						[vim.diagnostic.severity.WARN] = 'WarningMsg',
					},
				},
				underline = true,
				update_in_insert = true,
				severity_sort = true,
			})
			vim.keymap.set("n", "K", vim.lsp.buf.hover, {})
			vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, {})
			vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, {})
			vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, {})
			vim.keymap.set('n', '<leader>lf', vim.lsp.buf.format)
		end
	}
}