[vim] Use 24-bit colors if termguicolors is set

This commit is contained in:
Junegunn Choi 2017-01-22 14:40:30 +09:00
parent ff248d566d
commit cbb5134874
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -167,9 +167,12 @@ function! s:common_sink(action, lines) abort
endfunction
function! s:get_color(attr, ...)
let gui = has('termguicolors') && &termguicolors
let fam = gui ? 'gui' : 'cterm'
let pat = gui ? '^#[a-f0-9]\+' : '^[0-9]\+$'
for group in a:000
let code = synIDattr(synIDtrans(hlID(group)), a:attr, 'cterm')
if code =~ '^[0-9]\+$'
let code = synIDattr(synIDtrans(hlID(group)), a:attr, fam)
if code =~? pat
return code
endif
endfor