zsh.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. -- npm i -g bash-language-server
  2. require("lspconfig").bashls.setup {
  3. cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
  4. on_attach = require("lsp").common_on_attach,
  5. filetypes = { "sh", "zsh" },
  6. }
  7. -- npm i -g bash-language-server
  8. require("lspconfig").bashls.setup {
  9. cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
  10. on_attach = require("lsp").common_on_attach,
  11. filetypes = { "sh", "zsh" },
  12. }
  13. -- sh
  14. local sh_arguments = {}
  15. local shfmt = { formatCommand = "shfmt -ci -s -bn", formatStdin = true }
  16. local shellcheck = {
  17. LintCommand = "shellcheck -f gcc -x",
  18. lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
  19. }
  20. if O.lang.sh.formatter == "shfmt" then
  21. table.insert(sh_arguments, shfmt)
  22. end
  23. if O.lang.sh.linter == "shellcheck" then
  24. table.insert(sh_arguments, shellcheck)
  25. end
  26. require("lspconfig").efm.setup {
  27. -- init_options = {initializationOptions},
  28. cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
  29. init_options = { documentFormatting = true, codeAction = false },
  30. filetypes = { "zsh" },
  31. settings = {
  32. rootMarkers = { ".git/" },
  33. languages = {
  34. sh = sh_arguments,
  35. },
  36. },
  37. }