mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-04-08 19:35:31 +02:00
fix separator colors for inactive splits
This commit is contained in:
parent
2f92346194
commit
47bfeee3ae
@ -6,7 +6,7 @@ Lean & mean statusline for vim that's light as air.
|
|||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
* tiny core (under 200 lines), written with extensibility in mind ([open/closed principle][8]).
|
* tiny core written with extensibility in mind ([open/closed principle][8]).
|
||||||
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [syntastic][5] and [lawrencium][21].
|
* integrates with a variety of plugins, including: [vim-bufferline][6], [fugitive][4], [unite][9], [ctrlp][10], [minibufexpl][15], [gundo][16], [undotree][17], [nerdtree][18], [tagbar][19], [syntastic][5] and [lawrencium][21].
|
||||||
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
|
* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols.
|
||||||
* optimized for speed; it loads in under a millisecond.
|
* optimized for speed; it loads in under a millisecond.
|
||||||
|
@ -4,10 +4,6 @@
|
|||||||
let s:sections = ['a','b','c','gutter','x','y','z','warning']
|
let s:sections = ['a','b','c','gutter','x','y','z','warning']
|
||||||
let s:highlighter = airline#highlighter#new()
|
let s:highlighter = airline#highlighter#new()
|
||||||
|
|
||||||
function! airline#get_highlighter()
|
|
||||||
return s:highlighter
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! airline#reload_highlight()
|
function! airline#reload_highlight()
|
||||||
call s:highlighter.highlight(['inactive'])
|
call s:highlighter.highlight(['inactive'])
|
||||||
call s:highlighter.highlight(['normal'])
|
call s:highlighter.highlight(['normal'])
|
||||||
@ -23,7 +19,6 @@ function! airline#load_theme(name)
|
|||||||
call airline#check_mode()
|
call airline#check_mode()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:get_section(winnr, key, ...)
|
function! s:get_section(winnr, key, ...)
|
||||||
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
let text = airline#util#getwinvar(a:winnr, 'airline_section_'.a:key, g:airline_section_{a:key})
|
||||||
let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
|
let [prefix, suffix] = [get(a:000, 0, '%( '), get(a:000, 1, ' %)')]
|
||||||
|
@ -27,7 +27,6 @@ function! airline#builder#new(active, highlighter)
|
|||||||
let line = '%{airline#check_mode()}'
|
let line = '%{airline#check_mode()}'
|
||||||
let side = 0
|
let side = 0
|
||||||
let prev_group = ''
|
let prev_group = ''
|
||||||
let separator_groups = []
|
|
||||||
for section in self._sections
|
for section in self._sections
|
||||||
if section[0] == '|'
|
if section[0] == '|'
|
||||||
let side = 1
|
let side = 1
|
||||||
@ -41,13 +40,10 @@ function! airline#builder#new(active, highlighter)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if prev_group != ''
|
if prev_group != ''
|
||||||
let sep = side == 0
|
call self._highlighter.add_separator(self._group(prev_group), self._group(section[0]))
|
||||||
\ ? [self._group(section[0]), self._group(prev_group)]
|
|
||||||
\ : [self._group(prev_group), self._group(section[0])]
|
|
||||||
call add(separator_groups, sep)
|
|
||||||
let line .= side == 0
|
let line .= side == 0
|
||||||
\ ? '%#'.self._group(section[0].'_to_'.prev_group).'#'
|
\ ? '%#'.self._group(section[0]).'_to_'.self._group(prev_group).'#'
|
||||||
\ : '%#'.self._group(prev_group.'_to_'.section[0]).'#'
|
\ : '%#'.self._group(prev_group).'_to_'.self._group(section[0]).'#'
|
||||||
let line .= side == 0
|
let line .= side == 0
|
||||||
\ ? self._active ? g:airline_left_sep : g:airline_left_alt_sep
|
\ ? self._active ? g:airline_left_sep : g:airline_left_alt_sep
|
||||||
\ : self._active ? g:airline_right_sep : g:airline_right_alt_sep
|
\ : self._active ? g:airline_right_sep : g:airline_right_alt_sep
|
||||||
@ -59,7 +55,6 @@ function! airline#builder#new(active, highlighter)
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'statusline': line,
|
\ 'statusline': line,
|
||||||
\ 'separator_groups': separator_groups,
|
|
||||||
\ }
|
\ }
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@ function! airline#highlighter#exec(group, colors)
|
|||||||
endif
|
endif
|
||||||
exec printf('hi %s %s %s %s %s %s %s %s',
|
exec printf('hi %s %s %s %s %s %s %s %s',
|
||||||
\ a:group,
|
\ a:group,
|
||||||
\ colors[0] != '' ? 'guifg='.colors[0] : '',
|
\ get(colors, 0, '') != '' ? 'guifg='.colors[0] : '',
|
||||||
\ colors[1] != '' ? 'guibg='.colors[1] : '',
|
\ get(colors, 1, '') != '' ? 'guibg='.colors[1] : '',
|
||||||
\ colors[2] != '' ? 'ctermfg='.colors[2] : '',
|
\ get(colors, 2, '') != '' ? 'ctermfg='.colors[2] : '',
|
||||||
\ colors[3] != '' ? 'ctermbg='.colors[3] : '',
|
\ get(colors, 3, '') != '' ? 'ctermbg='.colors[3] : '',
|
||||||
\ len(colors) > 4 && colors[4] != '' ? 'gui='.colors[4] : '',
|
\ get(colors, 4, '') != '' ? 'gui='.colors[4] : '',
|
||||||
\ len(colors) > 4 && colors[4] != '' ? 'cterm='.colors[4] : '',
|
\ get(colors, 4, '') != '' ? 'cterm='.colors[4] : '',
|
||||||
\ len(colors) > 4 && colors[4] != '' ? 'term='.colors[4] : '')
|
\ get(colors, 4, '') != '' ? 'term='.colors[4] : '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#highlighter#exec_separator(from, to)
|
function! airline#highlighter#exec_separator(from, to)
|
||||||
@ -30,9 +30,13 @@ function! airline#highlighter#exec_separator(from, to)
|
|||||||
return group
|
return group
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! airline#highlighter#new()
|
function! airline#highlighter#new()
|
||||||
let highlighter = {}
|
let highlighter = {}
|
||||||
|
let highlighter._separators = []
|
||||||
|
|
||||||
|
function! highlighter.add_separator(from, to)
|
||||||
|
call add(self._separators, [a:from, a:to])
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! highlighter.highlight(modes)
|
function! highlighter.highlight(modes)
|
||||||
" draw the base mode, followed by any overrides
|
" draw the base mode, followed by any overrides
|
||||||
@ -46,7 +50,9 @@ function! airline#highlighter#new()
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
for sep in w:airline_current_info.separator_groups
|
|
||||||
|
" synchronize separator colors
|
||||||
|
for sep in self._separators
|
||||||
call airline#highlighter#exec_separator(sep[0].suffix, sep[1].suffix)
|
call airline#highlighter#exec_separator(sep[0].suffix, sep[1].suffix)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user