1

I am using neovim with ALE and I want to change the coloring of style errors in general for any language and particularly in python using flake8, in the following code of my configuration file I try to change the color for E501 W503 rules without success:

    highlight ALEError ctermfg=Red guifg=#FF0000
    highlight ALEWarning ctermfg=Yellow guifg=#FFFF00
    
    highlight ALEErrorE501 ctermfg=Green guifg=#00FF00
    highlight ALEWarningW503 ctermfg=Blue guifg=#0000FF
    
function! ALECustomHighlight()
    if !exists('w:ale')
        return
    endif
    for l:entry in w:ale
        if l:entry.linter ==# 'flake8'
            if l:entry.code ==# 'E501'
                call matchadd('ALEErrorE501', l:entry.text, 100)
            elseif l:entry.code ==# 'W503'
                call matchadd('ALEWarningW503', l:entry.text, 100)
            endif
        endif
    endfor
endfunction

autocmd User ALELintPost call ALECustomHighlight()

I don't know what the problem is because it doesn't give me any errors but my python file hasn't changed (I restarted neovim)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.