runtime/dircolors.vim: support termguicolors (#8175)

This commit is contained in:
Vadim A. Misbakh-Soloviov
2018-03-25 20:45:02 +07:00
committed by Justin M. Keyes
parent f8d2aef4f2
commit 9ebe2ad331

View File

@@ -32,7 +32,7 @@ syntax match dircolorsEscape '\\[abefnrtv?_\\^#]'
syntax match dircolorsEscape '\\[0-9]\{3}'
syntax match dircolorsEscape '\\x[0-9a-f]\{3}'
if !has('gui_running') && &t_Co == ''
if !(has('gui_running') || &termguicolors) && &t_Co == ''
syntax match dircolorsNumber '\<\d\+\>'
highlight default link dircolorsNumber Number
endif
@@ -84,7 +84,7 @@ endfunction
function! s:get_hi_str(color, place) abort
if a:color >= 0 && a:color <= 255
if has('gui_running')
if has('gui_running') || &termguicolors
return ' gui' . a:place . '=' . s:termguicolors[a:color]
elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88
return ' cterm' . a:place . '=' . a:color
@@ -169,7 +169,7 @@ function! s:preview_color(linenr) abort
\ ' "\_s\zs' . colordef . '\ze\_s"'
let hi_attrs_str = ''
if !empty(hi_attrs)
if has('gui_running')
if has('gui_running') || &termguicolors
let hi_attrs_str = ' gui=' . join(hi_attrs, ',')
else
let hi_attrs_str = ' cterm=' . join(hi_attrs, ',')
@@ -199,11 +199,11 @@ endfunction
let b:dc_next_index = 0
if has('gui_running')
if has('gui_running') || &termguicolors
call s:set_guicolors()
endif
if has('gui_running') || &t_Co != ''
if has('gui_running') || &termguicolors || &t_Co != ''
call s:reset_colors()
autocmd CursorMoved,CursorMovedI <buffer> call s:preview_color('.')