diff --git a/autoload/base16.vim b/autoload/base16.vim index d482b22..20b0e96 100644 --- a/autoload/base16.vim +++ b/autoload/base16.vim @@ -6,6 +6,7 @@ function! base16#highlight(bang, group, ...) echohl None return endif + let l:termguicolors = (has('termguicolors') && &termguicolors) let l:fg = 0 let l:bg = 0 let l:sp = 0 @@ -15,14 +16,14 @@ function! base16#highlight(bang, group, ...) let l:fg = 1 let [l:gui, l:cterm] = s:Color(l:arg[3:]) execute 'highlight' a:group 'guifg='.l:gui - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'ctermfg='.l:cterm endif elseif l:arg =~? '^bg=' let l:bg = 1 let [l:gui, l:cterm] = s:Color(l:arg[3:]) execute 'highlight' a:group 'guibg='.l:gui - if !has('termguicolors') || !&termguicolors + if !termguicolors execute 'highlight' a:group 'ctermbg='.l:cterm endif elseif l:arg =~? '^sp=' @@ -44,8 +45,14 @@ function! base16#highlight(bang, group, ...) endif if len(l:attrs) > 0 execute 'highlight' a:group 'gui='.join(l:attrs, ',') + if !termguicolors + execute 'highlight' a:group 'cterm='.join(l:attrs, ',') + endif elseif a:bang execute 'highlight' a:group 'gui=NONE' + if !termguicolors + execute 'highlight' a:group 'cterm=NONE' + endif endif endfunction