my configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.4 KiB

  1. local utils = require('utils')
  2. vim.g['ale_fixers'] = {
  3. ['javascript'] = [['prettier', 'eslint']],
  4. ['typescript'] = [['prettier', 'tslint', 'eslint']],
  5. ['typescriptreact'] = [['prettier', 'tslint', 'eslint']],
  6. ['html'] = [['eslint']],
  7. ['json'] = [['prettier', 'fixjson', 'jq']],
  8. ['scss'] = [['prettier', 'stylelint']],
  9. ['css'] = [['prettier', 'stylelint']],
  10. ['less'] = [['prettier', 'stylelint']],
  11. ['stylus'] = [['stylelint']],
  12. ['c'] = [['clang-format']],
  13. ['cpp'] = [['clang-format']],
  14. ['rust'] = [['rustfmt']],
  15. ['python'] = [['yapf', 'isort', 'black']],
  16. ['zsh'] = [['shfmt']],
  17. ['sh'] = [['shfmt']],
  18. ['go'] = [['gofmt', 'goimports']],
  19. ['markdown'] = [['prettier']],
  20. ['vue'] = [['prettier']],
  21. ['yaml'] = [['prettier']],
  22. ['ansible'] = [['prettier']],
  23. ['puppet'] = [['puppetlint']],
  24. ['java'] = [['google_java_format']]
  25. }
  26. vim.g['ale_fix_on_save'] = 1
  27. vim.g['ale_go_gofmt_options'] = '-s'
  28. vim.g['ale_go_gometalinter_options'] = '--fast'
  29. vim.g['ale_go_golangci_lint_options'] = '--fast'
  30. vim.g['ale_go_golangci_lint_package'] = 1
  31. vim.g['ale_rust_cargo_use_clippy'] = 1
  32. vim.g['ale_rust_analyzer_config'] = {
  33. ['rust-analyzer'] = {
  34. ['assist'] = {
  35. ['importMergeBehavior'] = 'last',
  36. ['importPrefix'] = 'by_self',
  37. },
  38. ['cargo.loadOutDirsFromCheck'] = true,
  39. ['procMacro.enable'] = true
  40. }
  41. }
  42. vim.g['ale_linters'] = {
  43. ['go'] = [['golangci-lint', 'gobuild', 'golint']],
  44. ['rust'] = [['cargo', 'rls']],
  45. ['typescript'] = [['tslint', 'tsserver', 'typecheck']]
  46. }
  47. vim.g['ale_completion_enabled'] = 1
  48. vim.g['ale_echo_msg_error_str'] = 'E'
  49. vim.g['ale_echo_msg_warning_str'] = 'W'
  50. vim.g['ale_echo_msg_format'] = '[%linter%] [%severity%] %code = %%s '
  51. -- alt k & j to jump through errors
  52. utils.map{'n', '<M-k>', '<Plug>(ale_previous_wrap)'}
  53. utils.map{'n', '<M-j>', '<Plug>(ale_next_wrap)'}
  54. -- Disable for minified code and enable whitespace trimming
  55. vim.g['ale_pattern_options'] = {
  56. ['.min.js$'] = {['ale_linters'] = [[]], ['ale_fixers'] = [[]]},
  57. ['.min.css$'] = {['ale_linters'] = [[]], ['ale_fixers'] = [[]]},
  58. ['*'] = {['ale_fixers'] = [['trim_whitespace', 'remove_trailing_lines']]}
  59. }
  60. vim.g['ale_set_loclist'] = 0
  61. vim.g['ale_set_quickfix'] = 1
  62. -- Define :ALEToggleFixer command to Disable autofix globally
  63. vim.cmd [[
  64. command! ALEToggleFixer execute "let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) ? 0 : 1"
  65. ]]