commit 38da97eebbdc95549d3895cb6f30c423b9d70197
parent 8f8d6eb17811dbaffad9d86394c33e4b25b56cc5
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date: Fri, 10 Jun 2022 15:31:03 +0200
style(lsp): reformat
Diffstat:
1 file changed, 28 insertions(+), 24 deletions(-)
diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua
@@ -1,5 +1,5 @@
-local lsp = require'lspconfig'
-vim.cmd[[packadd nvim-lspconfig]]
+local lsp = require 'lspconfig'
+vim.cmd [[packadd nvim-lspconfig]]
vim.diagnostic.config {
virtual_text = {
@@ -34,28 +34,29 @@ vim.api.nvim_create_autocmd({ "User LspProgressUpdate" }, {
local function on_attach(client, bufnr)
local function buf_set_keymap(lhs, rhs)
vim.api.nvim_buf_set_keymap(bufnr, 'n', lhs, string.format("<cmd>lua %s<CR>", rhs),
- { noremap=true, silent=true })
+ { noremap = true, silent = true })
end
+
-- Mappings.
--- autocmd CursorHold,CursorHoldI *.rs lua vim.lsp.diagnostic.show_line_diagnostics{focusable=false}
+ -- autocmd CursorHold,CursorHoldI *.rs lua vim.lsp.diagnostic.show_line_diagnostics{focusable=false}
-- See `:help vim.lsp.*` for documentation on any of the below functions
- buf_set_keymap('gD', 'vim.lsp.buf.implementation()')
+ buf_set_keymap('gD', 'vim.lsp.buf.implementation()')
buf_set_keymap('<Leader>d', 'vim.lsp.buf.definition()')
- buf_set_keymap('K', 'vim.lsp.buf.hover()')
- buf_set_keymap('<C-S-K>', 'vim.lsp.buf.signature_help()')
- buf_set_keymap('gr', 'vim.lsp.buf.rename()')
+ buf_set_keymap('K', 'vim.lsp.buf.hover()')
+ buf_set_keymap('<C-S-K>', 'vim.lsp.buf.signature_help()')
+ buf_set_keymap('gr', 'vim.lsp.buf.rename()')
buf_set_keymap('<Leader>a', 'vim.lsp.buf.code_action()')
- buf_set_keymap('[d', 'vim.diagnostic.goto_prev()')
- buf_set_keymap(']d', 'vim.diagnostic.goto_next()')
- buf_set_keymap('<Leader>l', 'vim.diagnostic.setloclist()')
- buf_set_keymap('<Leader>q', 'vim.diagnostic.setqflist()')
- buf_set_keymap('<Leader>=', 'vim.lsp.buf.format { async = true }')
- buf_set_keymap('gR', 'require"telescope.builtin".lsp_references()')
+ buf_set_keymap('[d', 'vim.diagnostic.goto_prev()')
+ buf_set_keymap(']d', 'vim.diagnostic.goto_next()')
+ buf_set_keymap('<Leader>l', 'vim.diagnostic.setloclist()')
+ buf_set_keymap('<Leader>q', 'vim.diagnostic.setqflist()')
+ buf_set_keymap('<Leader>=', 'vim.lsp.buf.format { async = true }')
+ buf_set_keymap('gR', 'require"telescope.builtin".lsp_references()')
buf_set_keymap('<Leader>s', 'require"telescope.builtin".lsp_dynamic_workspace_symbols()')
-- I always have telecope on, but we never know
local f = nil
- for _,path in pairs(vim.lsp.buf.list_workspace_folders()) do
+ for _, path in pairs(vim.lsp.buf.list_workspace_folders()) do
if #path > 0 and path ~= vim.fn.expand("$HOME") then
f = path
break
@@ -74,8 +75,10 @@ local function on_attach(client, bufnr)
end)
end
+-- TexLab and LTeX things
+
local function texlab_attach(client, bufnr)
- vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>m', '<cmd>TexlabForward<CR>', { noremap=true, silent=true })
+ vim.api.nvim_buf_set_keymap(bufnr, 'n', '<Leader>m', '<cmd>TexlabForward<CR>', { noremap = true, silent = true })
vim.lsp.protocol.SymbolKind = {
'file';
'sec';
@@ -196,19 +199,20 @@ local system_lsps = {
on_attach = on_attach,
capabilities = capabilities,
cmd = { "zk", "lsp" },
- filetypes = {'markdown'},
+ filetypes = { 'markdown' },
root_dir = function()
return vim.loop.cwd()
end,
}
}
-for lname,config in pairs(system_lsps) do
+for lname, config in pairs(system_lsps) do
lsp[lname].setup(config)
end
+-- Lsp installer lsps
+
require("nvim-lsp-installer").setup {}
-local lsp_installer_servers = require'nvim-lsp-installer.servers'
local lsps = {
-- Default configs
@@ -222,7 +226,7 @@ local lsps = {
rust_analyzer = {
capabilities = capabilities,
on_attach = on_attach,
- cmd = {"rustup", "run", "nightly", "rust-analyzer"}
+ cmd = { "rustup", "run", "nightly", "rust-analyzer" }
},
sumneko_lua = (function()
return {
@@ -238,7 +242,7 @@ local lsps = {
},
diagnostics = {
-- Get the language server to recognize the `vim` global
- globals = {'vim'},
+ globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
@@ -303,7 +307,7 @@ local lsps = {
enabled = { "latex", "tex", "bib", "markdown", },
language = "auto",
diagnosticSeverity = "information",
- dictionary = (function ()
+ dictionary = (function()
local files = {}
for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do
local lang = vim.fn.fnamemodify(file, ":t:r")
@@ -315,7 +319,7 @@ local lsps = {
end
if files.default then
- for lang,_ in pairs(files) do
+ for lang, _ in pairs(files) do
if lang ~= "default" then
vim.list_extend(files[lang], files.default)
end
@@ -339,6 +343,6 @@ local lsps = {
},
}
-for lname,config in pairs(lsps) do
+for lname, config in pairs(lsps) do
lsp[lname].setup(config)
end