mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 18:31:02 +08:00
shorten inactive windows to only the filename. resolves #35. also, treat inactive as a mode so it can be themed independently.
This commit is contained in:
parent
05995a20df
commit
43bc51a0d2
|
@ -1,6 +1,6 @@
|
|||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||
let s:is_win32term = (has('win32') || has('win64')) && !has('gui_running')
|
||||
let s:load_the_theme = g:airline#themes#{g:airline_theme}#normal
|
||||
let s:inactive_colors = g:airline#themes#{g:airline_theme}#inactive "also lazy loads the theme
|
||||
|
||||
let s:airline_highlight_map = {
|
||||
\ 'mode' : 'Al2',
|
||||
|
@ -9,10 +9,21 @@ let s:airline_highlight_map = {
|
|||
\ 'info_separator' : 'Al5',
|
||||
\ 'statusline' : 'Al6',
|
||||
\ 'file' : 'Al7',
|
||||
\ 'inactive' : 'Al9',
|
||||
\ }
|
||||
let s:airline_highlight_groups = keys(s:airline_highlight_map)
|
||||
|
||||
function! airline#exec_highlight(group, colors)
|
||||
exec printf('hi %s %s %s %s %s %s %s',
|
||||
\ a:group,
|
||||
\ a:colors[0] != '' ? 'guifg='.a:colors[0] : '',
|
||||
\ a:colors[1] != '' ? 'guibg='.a:colors[1] : '',
|
||||
\ a:colors[2] != '' ? 'ctermfg='.a:colors[2] : '',
|
||||
\ a:colors[3] != '' ? 'ctermbg='.a:colors[3] : '',
|
||||
\ a:colors[4] != '' ? 'gui='.a:colors[4] : '',
|
||||
\ a:colors[4] != '' ? 'term='.a:colors[4] : '')
|
||||
endfunction
|
||||
call airline#exec_highlight('airline_inactive', s:inactive_colors.mode)
|
||||
|
||||
function! airline#highlight(modes)
|
||||
" always draw the base mode, and then override any/all of the colors with _override
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
|
@ -23,14 +34,7 @@ function! airline#highlight(modes)
|
|||
if s:is_win32term
|
||||
let colors = map(colors, 'v:val != "" && v:val > 128 ? v:val - 128 : v:val')
|
||||
endif
|
||||
exec printf('hi %s %s %s %s %s %s %s',
|
||||
\ s:airline_highlight_map[key],
|
||||
\ colors[0] != '' ? 'guifg='.colors[0] : '',
|
||||
\ colors[1] != '' ? 'guibg='.colors[1] : '',
|
||||
\ colors[2] != '' ? 'ctermfg='.colors[2] : '',
|
||||
\ colors[3] != '' ? 'ctermbg='.colors[3] : '',
|
||||
\ colors[4] != '' ? 'gui='.colors[4] : '',
|
||||
\ colors[4] != '' ? 'term='.colors[4] : '')
|
||||
call airline#exec_highlight(s:airline_highlight_map[key], colors)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -85,27 +89,29 @@ function! airline#update_statusline(active)
|
|||
call airline#update_externals()
|
||||
call s:apply_window_overrides()
|
||||
|
||||
let l:mode_color = a:active ? "%#Al2#" : "%#Al9#"
|
||||
let l:mode_sep_color = a:active ? "%#Al3#" : "%#Al9#"
|
||||
let l:info_color = a:active ? "%#Al4#" : "%#Al9#"
|
||||
let l:info_sep_color = a:active ? "%#Al5#" : "%#Al9#"
|
||||
let l:status_color = a:active ? "%#Al6#" : "%#Al9#"
|
||||
let l:file_flag_color = a:active ? "%#Al7#" : "%#Al9#"
|
||||
let l:mode_color = a:active ? "%#Al2#" : "%#airline_inactive#"
|
||||
let l:mode_sep_color = a:active ? "%#Al3#" : "%#airline_inactive#"
|
||||
let l:info_color = a:active ? "%#Al4#" : "%#airline_inactive#"
|
||||
let l:info_sep_color = a:active ? "%#Al5#" : "%#airline_inactive#"
|
||||
let l:status_color = a:active ? "%#Al6#" : "%#airline_inactive#"
|
||||
let l:file_flag_color = a:active ? "%#Al7#" : "%#airline_inactive#"
|
||||
|
||||
let sl = l:mode_color
|
||||
let sl.= a:active
|
||||
\ ? '%{airline#update_highlight()} '.s:get_section('a').' %{&paste ? g:airline_paste_symbol." " : ""}'
|
||||
\ : ' '.s:get_section('a').' %#Al9#'
|
||||
let sl.=l:mode_sep_color
|
||||
let sl.=a:active ? g:airline_left_sep : g:airline_left_alt_sep
|
||||
let sl.=l:info_color
|
||||
let sl.=' '.s:get_section('b').' '
|
||||
let sl.=l:info_sep_color
|
||||
let sl.=a:active ? g:airline_left_sep : g:airline_left_alt_sep
|
||||
let sl.=a:active ? l:status_color.' '.s:get_section('c').' ' : ' '.bufname(winbufnr(winnr()))
|
||||
let sl.=g:airline_section_gutter != ''
|
||||
\ ? g:airline_section_gutter
|
||||
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:status_color."%<%=".l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
|
||||
if a:active
|
||||
let sl.='%{airline#update_highlight()} '.s:get_section('a').' %{&paste ? g:airline_paste_symbol." " : ""}'
|
||||
let sl.=l:mode_sep_color
|
||||
let sl.=a:active ? g:airline_left_sep : g:airline_left_alt_sep
|
||||
let sl.=l:info_color
|
||||
let sl.=' '.s:get_section('b').' '
|
||||
let sl.=l:info_sep_color
|
||||
let sl.=g:airline_left_sep
|
||||
let sl.=l:status_color.' '.s:get_section('c').' '
|
||||
let sl.=s:get_section('gutter') != ''
|
||||
\ ? s:get_section('gutter')
|
||||
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:status_color."%<%=".l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
|
||||
else
|
||||
let sl.=' %f%<%='
|
||||
endif
|
||||
let sl.=' '.s:get_section('x').' '
|
||||
let sl.=l:info_sep_color
|
||||
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
let g:airline#themes#badwolf#inactive = { 'mode': [ '#45413b' , '#242321' , 238 , 235 , '' ] }
|
||||
|
||||
let s:N1 = [ '#141413' , '#aeee00' , 232 , 154 ]
|
||||
let s:N2 = [ '#f4cf86' , '#45413b' , 222 , 238 ]
|
||||
let s:N3 = [ '#8cffba' , '#242321' , 121 , 235 ]
|
||||
|
@ -8,14 +10,12 @@ let g:airline#themes#badwolf#normal = {
|
|||
\ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] ,
|
||||
\ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] ,
|
||||
\ 'file': [ '#ff2c4b' , '#242321' , 196 , 235 , '' ] ,
|
||||
\ 'inactive': [ '#45413b' , '#242321' , 238 , 235 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#badwolf#normal_modified = {
|
||||
\ 'mode_separator' : [ '#aeee00' , '#666462' , 154 , 241 , 'bold' ] ,
|
||||
\ 'info' : [ '#f4cf86' , '#666462' , 222 , 241 , '' ] ,
|
||||
\ 'info_separator' : [ '#666462' , '#45413b' , 241 , 238 , 'bold' ] ,
|
||||
\ 'statusline' : [ '#ffa724' , '#45413b' , 214 , 238 , '' ] ,
|
||||
\ 'inactive' : [ '#88633f' , '#45413b' , 95 , 238 , '' ] ,
|
||||
\ }
|
||||
|
||||
let s:I1 = [ '#141413' , '#0a9dff' , 232 , 39 ]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
let g:airline#themes#dark#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] }
|
||||
|
||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
let s:N3 = [ '#9cffd3' , '#202020' , 85 , 234 ]
|
||||
|
@ -8,7 +10,6 @@ let g:airline#themes#dark#normal = {
|
|||
\ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] ,
|
||||
\ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] ,
|
||||
\ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] ,
|
||||
\ 'inactive': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#dark#normal_modified = {
|
||||
\ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] ,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
let g:airline#themes#light#inactive = { 'mode': [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ] }
|
||||
|
||||
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
let s:N2 = [ '#000087' , '#00dfff' , 18 , 45 ]
|
||||
let s:N3 = [ '#005fff' , '#afffff' , 27 , 159 ]
|
||||
|
@ -8,7 +10,6 @@ let g:airline#themes#light#normal = {
|
|||
\ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] ,
|
||||
\ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] ,
|
||||
\ 'file': [ '#df0000' , '#ffffff' , 160 , 255 , '' ] ,
|
||||
\ 'inactive': [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#light#normal_modified = {
|
||||
\ 'info_separator': [ '#00dfff' , '#ffdfdf' , 45 , 224 , '' ] ,
|
||||
|
|
|
@ -36,6 +36,8 @@ let s:termbg = 232
|
|||
let s:termsep = 236
|
||||
let s:guisep = '#303030'
|
||||
|
||||
let g:airline#themes#simple#inactive = {'mode': [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] }
|
||||
|
||||
let s:N1 = s:swap ? [ s:guibg , '#00dfff' , s:termbg , 45 ] : [ '#00dfff' , s:guibg , 45 , s:termbg ]
|
||||
let s:N2 = [ '#ff5f00' , s:guibg, 202 , s:termbg ]
|
||||
let s:N3 = [ '#767676' , s:guibg, 243 , s:termbg ]
|
||||
|
@ -48,7 +50,6 @@ let g:airline#themes#simple#normal = {
|
|||
\ 'info_separator': [ s:guisep , s:N3[1] , s:termsep , s:N3[3] , 'bold' ] ,
|
||||
\ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] ,
|
||||
\ 'file': [ '#ff0000' , s:guibg , 160 , s:termbg , '' ] ,
|
||||
\ 'inactive': [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#simple#normal_modified = {
|
||||
\ 'statusline': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] ,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
let g:airline#themes#solarized#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] }
|
||||
|
||||
let s:N1 = [ '#fdf6e3' , '#657b83' , 230 , 241 ]
|
||||
let s:N2 = [ '#fdf6e3' , '#93a1a1' , 230 , 245 ]
|
||||
let s:N3 = [ '#657b83' , '#fdf6e3' , 241 , 230 ]
|
||||
|
@ -8,7 +10,6 @@ let g:airline#themes#solarized#normal = {
|
|||
\ 'info_separator': [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , 'bold' ] ,
|
||||
\ 'statusline': [ s:N3[0] , s:N3[1] , s:N3[2] , s:N3[3] , '' ] ,
|
||||
\ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] ,
|
||||
\ 'inactive': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#solarized#normal_modified = {
|
||||
\ 'info_separator': [ '#444444' , '#5f005f' , 238 , 53 , '' ] ,
|
||||
|
|
Loading…
Reference in New Issue
Block a user