zsh.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 table.insert(sh_arguments, shfmt) end
  21. if O.lang.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end
  22. require"lspconfig".efm.setup {
  23. -- init_options = {initializationOptions},
  24. cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
  25. init_options = {documentFormatting = true, codeAction = false},
  26. filetypes = {"zsh"},
  27. settings = {
  28. rootMarkers = {".git/"},
  29. languages = {
  30. sh = sh_arguments,
  31. }
  32. }
  33. }