~gpanders/dotfiles

ea29155674e9a83854bcdfbd7090a45d9c313079 — Greg Anders a month ago 82c9cc8
[vim] Replace ALE with neomake
4 files changed, 18 insertions(+), 100 deletions(-)

D .vim/after/plugin/ale.vim
A .vim/after/plugin/neomake.vim
D .vim/plugin/ale.vim
M .vim/plugin/minpac.vim
D .vim/after/plugin/ale.vim => .vim/after/plugin/ale.vim +0 -91
@@ 1,91 0,0 @@
if !get(g:, 'loaded_ale') || &compatible
    finish
endif

if !exists('g:ale_linters')
    let g:ale_linters = {}
endif

if !exists('g:ale_fixers')
    let g:ale_fixers = {}
endif

augroup plugin_ale | exec 'autocmd!' | augroup END

if get(g:, 'ale_completion_enabled')
    let cot = &completeopt
    set completeopt=menu,menuone,preview,noselect,noinsert
    if cot =~# 'popup'
        set completeopt-=preview completeopt+=popup
    endif
endif

if empty(&completefunc)
    setglobal completefunc=ale#completion#OmniFunc
endif

" Python
let g:ale_linters.python = ['pylint', 'flake8', 'pyls', 'mypy']
let g:ale_fixers.python = ['black', 'isort']
let g:ale_python_black_change_directory = 0
let g:ale_python_pylint_change_directory = 0
let g:ale_python_flake8_change_directory = 0
let g:ale_python_mypy_ignore_invalid_syntax = 1
let g:ale_python_mypy_options = '--ignore-missing-imports'
let g:ale_python_pyls_config = {
            \ 'pyls': {
            \   'configurationSources': ['flake8'],
            \   'plugins': {
            \     'pycodestyle': {
            \       'enabled': v:false,
            \     },
            \   },
            \ }}

" C/C++
let g:ale_linters.c = ['clangd']
let g:ale_linters.cpp = g:ale_linters.c


let g:ale_c_clangd_options = '--clang-tidy --fallback-style=LLVM --background-index --suggest-missing-includes --header-insertion=iwyu'
let g:ale_cpp_clangd_options = g:ale_c_clangd_options . ' --clang-tidy-checks=cppcoreguidelines-*'

let g:ale_c_parse_makefile = 1
let g:ale_c_parse_compile_commands = 1

" VHDL
let g:ale_vhdl_xvhdl_options = '--2008 --nolog'

" Rust
let g:ale_linters.rust = ['cargo', 'rls']
let g:ale_rust_rls_toolchain = 'stable'

" Go
let g:ale_linters.go = ['golint', 'gofmt', 'gopls']
let g:ale_fixers.go = ['gofmt']

" sh
let g:ale_fixers.sh = ['shfmt']
let g:ale_sh_shfmt_base_options = '-s'
autocmd plugin_ale FileType sh let g:ale_sh_shfmt_options = g:ale_sh_shfmt_base_options . ' -ln=' . (get(b:, 'is_bash') ? 'bash' : 'posix')

function! s:toggle()
    if !g:ale_enabled
        return
    endif

    if !&modifiable || &readonly
        silent ALEDisableBuffer
    elseif !get(b:, 'ale_enabled', 1)
        silent ALEEnableBuffer
    endif
endfunction

augroup plugin_ale
    autocmd OptionSet modifiable,readonly call <SID>toggle()
    autocmd BufWinEnter * call <SID>toggle()

    " Use ALE to format whole buffer if fixers are enabled for the current
    " filetype
    autocmd FileType * if has_key(g:ale_fixers, &filetype) | exec 'nmap gq<CR> <Plug>(ale_fix)' | endif
augroup END

A .vim/after/plugin/neomake.vim => .vim/after/plugin/neomake.vim +17 -0
@@ 0,0 1,17 @@
if !get(g:, 'loaded_neomake')
    finish
endif

call neomake#configure#automake({
            \ 'TextChanged': {},
            \ 'InsertLeave': {},
            \ 'BufWritePost': {'delay': 0},
            \ 'BufWinEnter': {},
            \ }, 500)

let g:neomake_error_sign = { 'text': 'E' }
let g:neomake_warning_sign = { 'text': 'W' }
let g:neomake_message_sign = { 'text': 'M' }
let g:neomake_info_sign = { 'text': 'I' }

let g:neomake_python_enabled_makers = ['pylint', 'mypy']

D .vim/plugin/ale.vim => .vim/plugin/ale.vim +0 -8
@@ 1,8 0,0 @@
" This variable must be set before ALE is loaded so that it can create the
" proper autocmds
let g:ale_lint_on_text_changed = 'normal'

" Don't change syntax highlighting, just use the sign column
let g:ale_set_highlights = 0

let g:ale_disable_lsp = 1

M .vim/plugin/minpac.vim => .vim/plugin/minpac.vim +1 -1
@@ 66,7 66,7 @@ function! s:PackInit() abort
    call minpac#add('mhinz/vim-signify')

    " Asynchronous linting
    call minpac#add('dense-analysis/ale')
    call minpac#add('neomake/neomake')

    " Auto generate tags files
    call minpac#add('ludovicchabant/vim-gutentags')