From d0e083b6abbac3638254dcbaae64f62f5a6cf569 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 18 Aug 2021 23:10:50 +0200 Subject: [PATCH] nvim: Add efm languageserver Added a general purpose languageserver to round out the language server possibilities. For now only configured to take care of bash linting (using shellcheck) and formatting, but can be extended to a variety of other languages (even helping more prosaic forms like markdown and pandoc). --- bootstrap/packages.txt | 2 ++ nvim/.config/nvim/lua/plug/_lsp.lua | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/bootstrap/packages.txt b/bootstrap/packages.txt index 1e2d1c6..1ebd8d5 100644 --- a/bootstrap/packages.txt +++ b/bootstrap/packages.txt @@ -34,6 +34,7 @@ docx2txt duf dunst dust +efm-langserver entr evince exa @@ -214,6 +215,7 @@ vagrant vi vifm vim-language-server +vimiv visidata xcape xclip diff --git a/nvim/.config/nvim/lua/plug/_lsp.lua b/nvim/.config/nvim/lua/plug/_lsp.lua index 36bcee2..20f81dd 100644 --- a/nvim/.config/nvim/lua/plug/_lsp.lua +++ b/nvim/.config/nvim/lua/plug/_lsp.lua @@ -111,6 +111,32 @@ end -- set up simple servers for _, lsp in ipairs(servers) do lspcfg[lsp].setup {on_attach = on_attach} end +lspcfg.efm.setup { + on_attach = on_attach, + init_options = { + documentFormatting = true, + codeAction = true, + completion = true, + documentSymbol = true, + hover = true + }, + filetypes = {"sh"}, + settings = { + rootMarkers = {".git/"}, + languages = { + sh = { + { + lintCommand = 'shellcheck -f gcc -x', + lintFormats = { + '%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', + '%f:%l:%c: %tote: %m' + } + }, {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} + } + } + } +} + -- 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"