2021-04-30 18:27:39 +00:00
|
|
|
" Install ALE
|
2024-07-19 22:05:09 +00:00
|
|
|
Blink 'dense-analysis/ale'
|
2021-04-30 18:27:39 +00:00
|
|
|
let g:airline#extensions#ale#enabled = 1
|
|
|
|
" Speed up first load time for quick editing
|
|
|
|
let g:ale_lint_on_enter = 0
|
|
|
|
|
|
|
|
" NOTE: Some of these are installed when bootstrapping environment, outside of vim setup
|
|
|
|
let g:ale_linters = {
|
|
|
|
\ 'go': ['gopls', 'golint', 'golangci-lint'],
|
2023-07-20 18:32:57 +00:00
|
|
|
\ 'python': ['pyright', 'mypy'],
|
2021-04-30 18:27:39 +00:00
|
|
|
\ 'rust': ['rls', 'cargo'],
|
|
|
|
\ 'sh': ['language_server', 'shell', 'shellcheck'],
|
|
|
|
\ 'text': ['proselint', 'alex'],
|
|
|
|
\}
|
|
|
|
let g:ale_linter_aliases = {
|
|
|
|
\ 'markdown': ['text'],
|
|
|
|
\}
|
|
|
|
" More than a few languages use the same fixers
|
|
|
|
let s:ale_pretty_trim_fixer = ['prettier', 'trim_whitespace', 'remove_trailing_lines']
|
|
|
|
let g:ale_fixers = {
|
|
|
|
\ '*': ['trim_whitespace', 'remove_trailing_lines'],
|
|
|
|
\ 'go': ['gofmt', 'goimports'],
|
|
|
|
\ 'json': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'rust': ['rustfmt'],
|
|
|
|
\ 'python': [ 'black', 'autopep8', 'reorder-python-imports', 'remove_trailing_lines', 'trim_whitespace'],
|
|
|
|
\ 'markdown': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'yaml': ['prettier', 'remove_trailing_lines'],
|
|
|
|
\ 'css': s:ale_pretty_trim_fixer,
|
|
|
|
\ 'javascript': s:ale_pretty_trim_fixer,
|
|
|
|
\}
|
|
|
|
|
|
|
|
" Language specific options
|
|
|
|
let g:ale_python_flake8_options = '--max-line-length 88'
|
|
|
|
let g:ale_go_golangci_lint_options = ''
|
|
|
|
let g:ale_go_golangci_lint_package = 1
|
2021-06-14 01:31:30 +00:00
|
|
|
let g:ale_rust_cargo_use_clippy = 1
|
|
|
|
let g:ale_rust_rls_config = {
|
|
|
|
\ 'rust': {
|
|
|
|
\ 'clippy_preference': 'on'
|
|
|
|
\ }
|
|
|
|
\ }
|
2021-04-30 18:27:39 +00:00
|
|
|
" Create shortcut for ALEFix
|
|
|
|
nnoremap <F4> :ALEFix<CR>
|