vim_config/config/ale.vim

104 lines
2.7 KiB
VimL

""" ALE configuration
let g:ale_completion_enabled = 0
let g:ale_sign_error = '->'
let g:ale_sign_warning = '~>'
" let g:ale_sign_error = '✘'
" let g:ale_sign_warning = '⚠'
let g:ale_elixir_elixir_ls_release = '/usr/lib/elixir-ls/'
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'javascriptreact': ['eslint'],
\ 'typescript': ['tsserver', 'tslint'],
\ 'typescriptreact': ['tsserver', 'tslint'],
\ 'python': ['pyls', 'pylint'],
\ 'rust': ['rls'],
\ 'elixir': ['elixir-ls'],
\ 'go': ['gopls'],
\ 'json': ['jsonlint'],
\ 'dockerfile': ['hadolint'],
\ 'vala': ['vala-language-server'],
\ 'scss': ['eslint'],
\ 'elm': ['elm_ls'],
\ 'sql': ['sql-lint'],
\}
let g:ale_fixers = {
\ 'javascript': ['prettier'],
\ 'typescript': ['prettier'],
\ 'javascriptreact': ['prettier'],
\ 'typescriptreact': ['prettier'],
\ 'python': ['black', 'pyls'],
\ 'rust': ['rustfmt'],
\ 'elixir': ['mix_format'],
\ 'graphql': ['prettier'],
\ 'perl': ['perltidy'],
\ 'go': ['gofmt'],
\ 'json': ['prettier'],
\ 'vala': ['uncrustify'],
\ 'dart': ['dartfmt'],
\ 'scss': ['prettier'],
\}
function! s:getValaProjectRoot(buffer) abort
let l:cur_path_abs = fnamemodify(a:buffer, ':p:h')
let l:maybe_doap_file = expand(l:cur_path_abs . s:sep . '*.doap')
if !empty(l:maybe_doap_file)
return l:cur_path_abs
endif
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
if filereadable(expand(l:path . '*.doap'))
return l:path
endif
endfor
return ''
endfunction
packloadall
call ale#linter#Define('vala', {
\ 'name': 'vala-language-server',
\ 'lsp': 'stdio',
\ 'output_stream': 'both',
\ 'executable': '/usr/bin/vala-language-server',
\ 'command': '%e',
\ 'project_root': function('s:getValaProjectRoot'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
let g:ale_rust_rls_config = {
\ 'rust': {
\ 'clippy_preference': 'on'
\ }
\ }
let g:ale_echo_msg_error_str = 'Err'
let g:ale_echo_msg_warning_str = 'Warn'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_go_langserver_executable = 'gopls'
" let g:ale_go_revive_executable = '/usr/bin/revive'
" let g:ale_go_revive_options = '-config ~/.vim/revive.toml'
let g:airline#extensions#ale#enabled = 1
" let g:ale_completion_enabled = 1
let g:ale_lint_on_enter = 0
let g:ale_lint_on_text_changed = 'never'
highlight ALEErrorSign ctermbg=NONE ctermfg=red
highlight ALEWarningSign ctermbg=NONE ctermfg=yellow
let g:ale_linters_explicit = 1
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
" let g:ale_set_balloons = 1
let g:ale_hover_to_preview = 1
let g:ale_float_preview = 1
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰']
packloadall