dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.44k forks source link

Recommended documentation addition #249

Closed mvolkmann closed 7 years ago

mvolkmann commented 7 years ago

To remove the gutter background color, add this to .vimrc:

highlight clear ALEErrorSign
highlight clear ALEWarningSign

This is especially useful when using emojis for error and warning signs that are configured like this:

let g:ale_sign_error = '💣'
let g:ale_sign_warning = 'âš '
liuchengxu commented 7 years ago

Hi, I also have written a colorscheme to avoid this situation :).

space-vim-dark

2017-01-27 7 25 13
w0rp commented 7 years ago

I have added this to the FAQ now: https://github.com/w0rp/ale#faq-change-signs

joaqo commented 7 years ago

@liuchengxu do you mind sharing how you got those red and yellow dots using your colorscheme? I like the colorscheme I am currently using, but would love to add those dots to it.

liuchengxu commented 7 years ago

@joaqo Very simple. As mentioned in https://github.com/w0rp/ale#faq-change-signs , what you need to do is to change the default signs in your .vimrc:

let g:ale_sign_error = '•'
let g:ale_sign_warning = '•'

Concerning the colors, you can customize them to your personal taste.

hi link ALEErrorSign    Error
hi link ALEWarningSign  Warning
joaqo commented 7 years ago

Hey @liuchengxu thanks for the answer! Sorry to bother you again, but when I run:

hi link ALEErrorSign    Error
hi link ALEWarningSign  Warning

For some reason the background of the icon turns red and the icon turns black, which is kind of the inverse of what I was hoping for, very weird. Do you have any idea of how could I be messing this up?

liuchengxu commented 7 years ago

@joaqo Check the current highlight setting via :verbose hi ALEErrorSign. In my case, it says:

:verbose hi ALEErrorSign
ALEErrorSign   xxx links to Error
        Last set from ~/.vim/plugged/space-vim-dark/colors/space-vim-dark.vim

next step, :verbose hi Error:

:verbose hi Error
Error          xxx cterm=bold ctermfg=160 ctermbg=235 gui=bold guifg=#e0211d
        Last set from ~/.vim/plugged/space-vim-dark/colors/space-vim-dark.vim

Based on 256-xterm-24bit-rgb-color-chart, I can see the colors are all expected. In terms of your problem, I think you should take a look at cterm option of Error. Does it have been set as cterm=inverse?

joaqo commented 7 years ago

:verbose hi ALEErrorSign looks the same as yours, but :verbose hi Error looked like this:

:verbose hi Error
Error          xxx term=reverse cterm=bold,reverse ctermfg=167 ctermbg=235 gui=bold,reverse guifg=#fb4934 guibg=bg
        Last set from ~/.vim/plugged/gruvbox/colors/gruvbox.vim

So it seems there is some wierd configs going on in my color theme gruvbox. Tweaked things a bit and ended up using,

hi link ALEErrorSign    GruvboxRed
hi link ALEWarningSign  GruvboxYellow

cause I couldn't get bothered deciphering where the reverse came from. This might help anyone else using gruvbox and works great. @liuchengxu thanks for the help!

liuchengxu commented 7 years ago

@joaqo Glad you have figured it out.

The reverse comes from cterm=bold,reverse gui=bold,reverse in the highlight setting of Error. If someone still wants to fix the reverse issue, just override cterm and gui option with reverse removed:

hi link ALEErrorSign    Error
hi link ALEWarningSign  Warning

hi Error   cterm=bold gui=bold
hi Warning cterm=bold gui=bold

For the case of gruvbox, it's simpler to use joaqo's solution: GruvboxRed and GruvboxYellow.

her commented 6 years ago

Just to add, if you want to avoid linking colors defined by your colorscheme (like Error or Warning) and don't want to redefine Error or Warning, you can define ALEErrorSign and ALEWarningSign colors yourself like so:

let g:ale_sign_error = "â—‰"
let g:ale_sign_warning = "â—‰"
highlight ALEErrorSign ctermfg=9 ctermbg=15 guifg=#C30500 guibg=#F5F5F5
highlight ALEWarningSign ctermfg=11 ctermbg=15 guifg=#ED6237 guibg=#F5F5F5

gui sets gvim and cterm sets vim fg, bg set the 'foreground' and 'background' colors respectively

screen shot 2018-02-25 at 8 34 57 pm
w0rp commented 6 years ago

Nice settings. I'm going to use those myself. It's a pity I can't make the signs prettier by default. You can't really make any assumptions about what characters someone's font might support, etc.

her commented 6 years ago

hi @w0rp! glad you like it 🙂

💟 thanks for the amazing plugin!! It's really great.

realestninja commented 5 years ago

Just to add, if you want to avoid linking colors defined by your colorscheme (like Error or Warning) and don't want to redefine Error or Warning, you can define ALEErrorSign and ALEWarningSign colors yourself like so:

let g:ale_sign_error = "â—‰"
let g:ale_sign_warning = "â—‰"
highlight ALEErrorSign ctermfg=9 ctermbg=15 guifg=#C30500 guibg=#F5F5F5
highlight ALEWarningSign ctermfg=11 ctermbg=15 guifg=#ED6237 guibg=#F5F5F5

gui sets gvim and cterm sets vim fg, bg set the 'foreground' and 'background' colors respectively

screen shot 2018-02-25 at 8 34 57 pm

@her When I override ctermfg/ctermbg, it just removes the colors, but it doesn't use the colors of the provided number. I end up with a default fg/bg of what my terminal is using. What am I missing? I'm using base16 Solarized Dark terminal wide. Does that change the behaviour of how I reference colors with numbers?

roachsinai commented 5 years ago

Hi, there. I followed @her 's setting, but I got a half circle,

image


If I using gVim I got a small circle,

image


How could I get the effect like @her ?

roachsinai commented 5 years ago

Worked with konsole 19.04.

Kingmk13 commented 5 years ago

@her When I override ctermfg/ctermbg, it just removes the colors, but it doesn't use the colors of the provided number. I end up with a default fg/bg of what my terminal is using. What am I missing? I'm using base16 Solarized Dark terminal wide. Does that change the behaviour of how I reference colors with numbers?

Me too. The only 2 ways to made it works were :

The output of :verbose hi ALEWarningSign varry...

Maybe we should open another issues for it ? (sorry if it is not the right place)

EDIT : It will be useful to add this settings in the FAQ with the other highlights

her commented 4 years ago

@realestninja @Kingmk13

if there are already highlights for the group you need to use !

let g:ale_change_sign_column_color = 1 
highlight! ALESignColumnWithErrors ctermfg=0 ctermbg=8 guifg=#A5A5A5 guibg=#F5F5F5
highlight! ALESignColumnWithoutErrors ctermfg=0 ctermbg=0 guifg=#A5A5A5 guibg=#F5F5F5

hope this helps! 🙃

Kingmk13 commented 4 years ago

Sorry for the late respond I was busy with other install/configs... Thanks you @her, but it doesn't work. However I didn't know the trick with the !. :smiley:

It only works if you put the settings in a fyletype (like c.vim or python.vim in .vim/after/ftplugins/) or if you enter the command. So apparently it needs ALE to be fully loaded to take effect. To have my ALE's highlight group automatically customized for all fyletype, I used autocmd in my .vimrc :

autocmd VimEnter * :let g:ale_change_sign_column_color = 1 
autocmd VimEnter * :highlight! ALESignColumnWithErrors ctermfg=0 ctermbg=8 guifg=#A5A5A5 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALESignColumnWithoutErrors ctermfg=0 ctermbg=0 guifg=#A5A5A5 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEErrorSign ctermfg=9 ctermbg=8 guifg=#C30500 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEWarningSign ctermfg=11 ctermbg=8 guifg=#ED6237 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEInfoSign   ctermfg=14 ctermbg=8 guifg=#ED6237 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEError ctermfg=9 ctermbg=8 guifg=#C30500 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEWarning ctermfg=11 ctermbg=8 guifg=#ED6237 guibg=#F5F5F5
autocmd VimEnter * :highlight! ALEInfo   ctermfg=14 ctermbg=8 guifg=#ED6237 guibg=#F5F5F5
Domiragi commented 2 months ago

I have the same problem with not being to set color when using a colorscheme, checking :verbose hi ALEWarningSign gives me the output ALEWarningSign xxx cleared. I found out that this is a problem with the colorscheme config and its location in vimrc. I use haishanh/night-owl.vim; one of the settings is hi clear, and because I load the colorscheme after I set the settings for ALE, the highlights I set earlier get cleared out. Setting the colorscheme options before setting the highlight colors for ALE fix this problem for me. Checking several other popular colorschemes like Monokai, Dracula or Gruvbox, they all first set hi clear, so I assume most colorschemes have this setting and I'm commenting here for anyone who has the same problem.