summaryrefslogtreecommitdiff
path: root/.config/nvim/ftplugin/zig.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-08 20:17:26 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-07-08 20:17:26 +0200
commit88616bde7c7b5b25f505997aa2171245f7341453 (patch)
tree7232fff70899952e2f91cb8b5d39c496840105db /.config/nvim/ftplugin/zig.lua
parent8c0ace95e67f76b900cacd8daa38faa1444cb3b9 (diff)
Updates to lang stuff
Diffstat (limited to '.config/nvim/ftplugin/zig.lua')
-rw-r--r--.config/nvim/ftplugin/zig.lua47
1 files changed, 34 insertions, 13 deletions
diff --git a/.config/nvim/ftplugin/zig.lua b/.config/nvim/ftplugin/zig.lua
index 72ce8cb..6ece5ae 100644
--- a/.config/nvim/ftplugin/zig.lua
+++ b/.config/nvim/ftplugin/zig.lua
@@ -1,14 +1,35 @@
--- Because lspinstall don't support zig yet,
--- So we need zls preset in global lib
--- Further custom install zls in
--- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
-require("lspconfig").zls.setup {
- root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
- on_attach = require("cfg.lsp").common_on_attach,
+if not require("cfg.utils").check_lsp_client_active "bashls" then
+ -- npm i -g bash-language-server
+ require("lspconfig").bashls.setup {
+ cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
+ on_attach = require("cfg.lsp").common_on_attach,
+ filetypes = { "sh", "zsh" },
+ }
+end
+
+-- sh
+local sh_arguments = {}
+
+local shellcheck = {
+ LintCommand = "shellcheck -f gcc -x",
+ lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
}
-require("cfg.utils").define_augroups {
- _zig_autoformat = {
- { "BufEnter", "*.zig", ':lua vim.api.nvim_buf_set_option(0, "commentstring", "// %s")' },
- },
-}
-vim.cmd "setl expandtab tabstop=8 softtabstop=4 shiftwidth=4"
+
+if O.lang.sh.linter == "shellcheck" then
+ table.insert(sh_arguments, shellcheck)
+end
+
+if not require("cfg.utils").check_lsp_client_active "efm" then
+ require("lspconfig").efm.setup {
+ -- init_options = {initializationOptions},
+ cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
+ init_options = { documentFormatting = true, codeAction = false },
+ filetypes = { "zsh" },
+ settings = {
+ rootMarkers = { ".git/" },
+ languages = {
+ sh = sh_arguments,
+ },
+ },
+ }
+end