nvim: Update lsp lua configuration

Uses arch aur-packaged installation of sumneko_lua, and invokes it for
any lua file.
Takes care of some additional configuration to enable easier programming
for neovim itself.
This commit is contained in:
Marty Oehme 2021-02-19 16:51:36 +01:00
parent 696953d3f7
commit 2f056a8701
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 30 additions and 12 deletions

View file

@ -54,6 +54,8 @@ linux-lts-headers
littler
logrotate
lscolors-git
lua-format
lua-language-server
lvm2
lynx
maim

View file

@ -30,14 +30,31 @@ require'lspconfig'.bashls.setup {on_attach = on_attach}
require'lspconfig'.gopls.setup {on_attach = on_attach}
require'lspconfig'.texlab.setup {on_attach = on_attach}
-- To get builtin LSP running, do something like:
-- NOTE: This replaces the calls where you would have before done `require('nvim_lsp').sumneko_lua.setup()`
require('nlua.lsp.nvim').setup(require('lspconfig'), {
-- requires the lua-language-server package to be installed
-- The arch package defaults to the following directory
local sumneko_root_path = "/usr/share/lua-language-server"
require'lspconfig'.sumneko_lua.setup {
cmd = { "lua-language-server", "-E", sumneko_root_path .. "/main.lua"};
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = vim.split(package.path, ';'),
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
},
},
},
},
on_attach = on_attach,
-- Include globals you want to tell the LSP are real :)
globals = {
-- Colorbuddy
"Color", "c", "Group", "g", "s"
}
})
}

View file

@ -70,7 +70,6 @@ Plug 'reedes/vim-textobj-sentence'
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
" Language Integration
Plug 'tjdevries/nlua.nvim' " lua lsp integration
Plug 'euclidianAce/BetterLua.vim' " better syntax highlighting for lua
Plug 'sheerun/vim-polyglot' " syntax plugins for almost every language
Plug 'stephpy/vim-yaml'