nvim/after/plugin/lsp.lua

119 lines
2.9 KiB
Lua
Raw Normal View History

local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
2023-08-04 08:09:55 +00:00
lsp.default_keymaps({ buffer = bufnr })
end)
-- Language servers
if (MY_OS == 'Linux') then
2023-08-07 11:59:29 +00:00
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
'bashls',
'clangd',
'julials',
'lua_ls',
'ltex',
'pylsp',
'texlab',
'zls'
})
elseif (MY_OS == 'FreeBSD') then
2023-08-07 11:59:29 +00:00
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
'bashls',
'julials',
'pylsp',
})
end
2023-07-21 08:46:34 +00:00
--[[
START LANGUAGE SERVERS CONFIG HERE!!!
2023-08-04 08:09:55 +00:00
]]
--
2023-07-21 08:46:34 +00:00
-- (Optional) Configure lua language server for neovim
2023-07-22 12:00:46 +00:00
require('lspconfig').bashls.setup({})
2023-07-21 08:46:34 +00:00
2023-07-22 12:00:46 +00:00
require('lspconfig').clangd.setup({})
2023-08-04 09:40:30 +00:00
--require('lspconfig').gopls.setup({})
2023-07-22 12:00:46 +00:00
2023-07-27 12:06:46 +00:00
require('lspconfig').julials.setup({})
2023-07-21 08:46:34 +00:00
2023-08-07 11:59:29 +00:00
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
neededFileStatus = {
["codestyle-check"] = "Any",
},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
format = {
enable = true,
-- Put format options here
-- NOTE: the value should be STRING!!
defaultConfig = {
indent_style = "space",
indent_size = "4",
}
},
},
},
})
2023-07-21 08:46:34 +00:00
local path = vim.fn.stdpath("config") .. "/after/plugin/dictionary-gb.txt"
local words = {}
for word in io.open(path, "r"):lines() do
2023-08-04 08:09:55 +00:00
table.insert(words, word)
end
2023-07-21 08:46:34 +00:00
require('lspconfig').ltex.setup({
2023-08-04 08:09:55 +00:00
settings = {
ltex = {
language = "en-GB",
dictionary = {
["en-GB"] = words,
},
2023-08-04 08:09:55 +00:00
},
},
2023-07-21 08:46:34 +00:00
})
-- source: https://rust-analyzer.github.io/manual.html#nvim-lsp
--require('lspconfig').rust_analyzer.setup({
-- on_attach = on_attach,
-- settings = {
-- ["rust-analyzer"] = {
-- inlayHints = {
-- closingBraceHints = true, -- Whether to show inlay hints after a closing } to indicate what item it belongs to.
-- }
-- }
-- }
--})
2023-07-22 12:00:46 +00:00
require('lspconfig').texlab.setup({})
require('lspconfig').zls.setup({})
2023-07-21 08:46:34 +00:00
--[[
END LANGUAGE SERVERS CONFIG HERE!!!
2023-08-04 08:09:55 +00:00
]]
--
2023-07-21 08:46:34 +00:00
lsp.setup()