Global configuration, hopefully

This commit is contained in:
Eduardo Cueto-Mendoza 2023-08-07 10:43:48 +01:00
commit cc8d398753
4 changed files with 61 additions and 53 deletions

View File

@ -0,0 +1,16 @@
require("lsp-format").setup {}
local on_attach = function(client)
require("lsp-format").on_attach(client)
-- ... custom code ...
end
require("lspconfig").bashls.setup { on_attach = on_attach }
require("lspconfig").clangd.setup { on_attach = on_attach }
require("lspconfig").julials.setup { on_attach = on_attach }
require("lspconfig").lua_ls.setup { on_attach = on_attach }
require("lspconfig").ltex.setup { on_attach = on_attach }
require("lspconfig").pylsp.setup { on_attach = on_attach }
require("lspconfig").texlab.setup { on_attach = on_attach }
require("lspconfig").zls.setup { on_attach = on_attach }

View File

@ -1,77 +1,66 @@
local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({buffer = bufnr})
lsp.default_keymaps({ buffer = bufnr })
end)
-- Language servers
if (MY_OS == 'Linux') then
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
'bashls',
'clangd',
'julials',
'lua_ls',
'ltex',
'pylsp',
'texlab',
'zls'
-- Replace these with whatever servers you want to install
'bashls',
'clangd',
'julials',
'lua_ls',
'ltex',
'pylsp',
'texlab',
'zls'
})
elseif (MY_OS == 'FreeBSD') then
print('On FreeBSD')
lsp.ensure_installed({
-- Replace these with whatever servers you want to install
'bashls',
'julials',
'pylsp',
})
end
--[[
START LANGUAGE SERVERS CONFIG HERE!!!
]]--
]]
--
-- (Optional) Configure lua language server for neovim
require('lspconfig').bashls.setup({})
require('lspconfig').clangd.setup({})
--require('lspconfig').gopls.setup({})
require('lspconfig').julials.setup({})
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
require('lspconfig').texlab.setup({})
local path = vim.fn.stdpath("config") .. "/after/plugin/dictionary-gb.txt"
local words = {}
for word in io.open(path, "r"):lines() do
table.insert(words, word)
table.insert(words, word)
end
require('lspconfig').ltex.setup({
settings = {
ltex = {
language = "en-GB",
settings = {
ltex = {
language = "en-GB",
dictionary = {
["en-GB"] = words,
},
},
},
},
},
})
require('lspconfig').pylsp.setup({})
--require('lspconfig').gopls.setup({
-- on_attach = on_attach,
--})
require('lspconfig').julials.setup({
-- --on_attach = on_attach,
-- symbol_cache_download = true,
-- --symbol_server = "https://symbol-server",
-- on_new_config = function(new_config, _)
-- local julia = vim.fn.expand("/usr/share/julia/bin/julia")
-- if require'lspconfig'.util.path.is_file(julia) then
-- vim.notify("Hello!")
-- new_config.cmd[1] = julia
-- end
-- end
})
require('lspconfig').zls.setup({})
require('lspconfig').bashls.setup({})
-- source: https://rust-analyzer.github.io/manual.html#nvim-lsp
--require('lspconfig').rust_analyzer.setup({
-- on_attach = on_attach,
@ -84,8 +73,13 @@ require('lspconfig').bashls.setup({})
-- }
--})
require('lspconfig').texlab.setup({})
require('lspconfig').zls.setup({})
--[[
END LANGUAGE SERVERS CONFIG HERE!!!
]]--
]]
--
lsp.setup()

View File

@ -49,14 +49,8 @@ vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {f
-- Leader key
vim.g.mapleader = " "
vim.g.maplocalleader = " "
--vim.g.maplocalleader = "\\"
-- Undotree instead of swapfile
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
--vim.g.maplocalleader = " "
vim.g.maplocalleader = "\\"
-- Airline
vim.g.airline_powerline_fonts = 1

View File

@ -35,6 +35,7 @@ return require('packer').startup(function(use)
-- Git Status
use( 'tpope/vim-fugitive' )
use('airblade/vim-gitgutter')
-- Language Servers
use {
@ -58,6 +59,9 @@ return require('packer').startup(function(use)
}
}
-- Code formatting
use "lukas-reineke/lsp-format.nvim"
-- Latex on NVIM
use 'lervag/vimtex'