diff options
Diffstat (limited to 'plugin')
-rwxr-xr-x | plugin/vim-fancy-line.vim | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/plugin/vim-fancy-line.vim b/plugin/vim-fancy-line.vim index 8e470ff..410912d 100755 --- a/plugin/vim-fancy-line.vim +++ b/plugin/vim-fancy-line.vim | |||
@@ -5,7 +5,7 @@ augroup MAX_FANCYLINE | |||
5 | set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split | 5 | set laststatus=2 | " required by AirLine and Lightline, without status line does not appear until a window split |
6 | 6 | ||
7 | 7 | ||
8 | if (&term ==? 'linux' && &termguicolors == 0) | 8 | if (&term ==? 'linux') |
9 | let g:group_active = 'StatusLineTerm' | 9 | let g:group_active = 'StatusLineTerm' |
10 | let g:group_inactive = 'StatusLineTermNC' | 10 | let g:group_inactive = 'StatusLineTermNC' |
11 | let g:group_tabline = 'TabLine' | 11 | let g:group_tabline = 'TabLine' |
@@ -31,25 +31,23 @@ augroup MAX_FANCYLINE | |||
31 | " this function reverts foreground color and background color of a given | 31 | " this function reverts foreground color and background color of a given |
32 | " highlight group and returns the name of a newly created _invert group | 32 | " highlight group and returns the name of a newly created _invert group |
33 | function! CreateInvertGroup(highlight_group) | 33 | function! CreateInvertGroup(highlight_group) |
34 | let w:gui_bg=synIDattr(synIDtrans(hlID(a:highlight_group)), 'bg', 'gui') | ||
35 | let w:gui_fg=synIDattr(synIDtrans(hlID(a:highlight_group)), 'fg', 'gui') | ||
36 | let w:cterm_bg=synIDattr(synIDtrans(hlID(a:highlight_group)), 'bg', 'cterm') | ||
37 | let w:cterm_fg=synIDattr(synIDtrans(hlID(a:highlight_group)), 'fg', 'cterm') | ||
34 | 38 | ||
35 | if(synIDattr(synIDtrans(hlID(a:highlight_group)), 'reverse')==0) | 39 | if(w:gui_bg ==# '') | let w:gui_bg = 'NONE' | endif |
36 | let w:color=synIDattr(hlID(a:highlight_group), 'bg#') | 40 | if(w:gui_fg ==# '') | let w:gui_fg = 'NONE' | endif |
37 | let w:termcolor=synIDattr(hlID(a:highlight_group), 'bg') | 41 | if(w:cterm_bg ==# '') | let w:cterm_bg = 'NONE' | endif |
38 | else | 42 | if(w:cterm_fg ==# '') | let w:cterm_fg = 'NONE' | endif |
39 | let w:color=synIDattr(hlID(a:highlight_group), 'fg#') | ||
40 | let w:termcolor=synIDattr(hlID(a:highlight_group), 'fg') | ||
41 | endif | ||
42 | 43 | ||
43 | let l:retval=a:highlight_group.'_invert' | 44 | let l:retval=a:highlight_group.'_invert' |
44 | if(exists('w:color') && w:color ==# '') | ||
45 | let w:color = 'NONE' | ||
46 | endif | ||
47 | if(exists('w:termcolor') && w:termcolor ==# '') | ||
48 | let w:termcolor = 'NONE' | ||
49 | endif | ||
50 | 45 | ||
51 | silent! exec 'highlight! '.l:retval.' guifg='.w:color | 46 | if(1 == synIDattr(synIDtrans(hlID(a:highlight_group)), 'reverse')) |
52 | silent! exec 'highlight! '.l:retval.' ctermfg='.w:termcolor | 47 | exec 'highlight! default '.l:retval.' ctermfg='.w:cterm_fg.' ctermbg=NONE'.' guifg='.w:gui_fg.' guibg=NONE' |
48 | else | ||
49 | exec 'highlight! default '.l:retval.' ctermfg='.w:cterm_bg.' ctermbg=NONE'.' guifg='.w:gui_bg.' guibg=NONE' | ||
50 | endif | ||
53 | 51 | ||
54 | return l:retval | 52 | return l:retval |
55 | endfunction | 53 | endfunction |