aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.config/nvim/lua.lua
blob: 4395485d12de8fbeff4e353c412f0b7cdabeb57f (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
66
67
-- LSP configuration

local lspconfig = require('lspconfig')

local on_attach = function(client, _)
  client.request = require('lspfuzzy').wrap_request(client.request)
end
vim.lsp.config('*', {on_attach = on_attach})

lspconfig.clangd.setup{
	filetypes = { "c", "cpp", "objc", "objcpp", "ch" },
	on_attach = on_attach,
}
lspconfig.gopls.setup{on_attach = on_attach}
lspconfig.pylsp.setup{on_attach = on_attach}
lspconfig.rust_analyzer.setup{on_attach = on_attach}
lspconfig.quick_lint_js.setup{on_attach = on_attach}
lspconfig.zls.setup{on_attach = on_attach}
require('lspfuzzy').setup{}

if vim.fn.has('nvim-0.9') then
	-- XXX: neovim's built-in C et al treesitter parsers are better, although
	-- not ideal either.
	require('nvim-treesitter.configs').setup{
		ensure_installed = { "go", "proto", "rust", "python", "lua", "comment", "zig" },
		highlight = { enable = true, disable = { "c", "cpp", "vim", "make" } },
	}
end

local lsp_icons = {
  Class = " ",
  Color = " ",
  Constant = " ",
  Constructor = " ",
  Enum = " ",
  EnumMember = " ",
  Field = "󰄶 ",
  File = " ",
  Folder = " ",
  Function = "ƒ ",
  Interface = "󰜰",
  Keyword = "󰌆 ",
  Method = "∫ ",
  Module = "󰏗 ",
  Property = " ",
  Snippet = "󰘍 ",
  Struct = " ",
  Text = " ",
  Unit = " ",
  Value = "󰎠 ",
  Variable = " ",
}


function lsp_icons_setup()
  local kinds = vim.lsp.protocol.CompletionItemKind
  for i, kind in ipairs(kinds) do
    kinds[i] = lsp_icons[kind] or kind
  end
end

lsp_icons_setup()

vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })