mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-01-19 10:42:46 +08:00
treat inactive as a new mode, allowing it to be themeable (#59).
This commit is contained in:
parent
295749d581
commit
a8a34b8992
|
@ -30,18 +30,19 @@ endfunction
|
|||
function! airline#load_theme(name)
|
||||
let g:airline_theme = a:name
|
||||
let inactive_colors = g:airline#themes#{g:airline_theme}#inactive "also lazy loads the theme
|
||||
call airline#exec_highlight('airline_inactive', inactive_colors.mode)
|
||||
call airline#highlight(['inactive'], '_inactive')
|
||||
call airline#highlight(['normal'])
|
||||
endfunction
|
||||
|
||||
function! airline#highlight(modes)
|
||||
" always draw the base mode, and then override any/all of the colors with _override
|
||||
function! airline#highlight(modes, ...)
|
||||
" draw the base mode, followed by any overrides
|
||||
let mapped = map(a:modes, 'v:val == a:modes[0] ? v:val : a:modes[0]."_".v:val')
|
||||
for mode in mapped
|
||||
for key in s:airline_highlight_groups
|
||||
if exists('g:airline#themes#{g:airline_theme}#{mode}[key]')
|
||||
let colors = g:airline#themes#{g:airline_theme}#{mode}[key]
|
||||
call airline#exec_highlight(s:airline_highlight_map[key], colors)
|
||||
let group_suffix = a:0 ? a:1 : ''
|
||||
call airline#exec_highlight(s:airline_highlight_map[key].group_suffix, colors)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
@ -102,12 +103,12 @@ function! airline#update_statusline(active)
|
|||
call airline#update_externals()
|
||||
call s:apply_window_overrides()
|
||||
|
||||
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 l:mode_color = a:active ? "%#Al2#" : "%#Al2_inactive#"
|
||||
let l:mode_sep_color = a:active ? "%#Al3#" : "%#Al3_inactive#"
|
||||
let l:info_color = a:active ? "%#Al4#" : "%#Al4_inactive#"
|
||||
let l:info_sep_color = a:active ? "%#Al5#" : "%#Al5_inactive#"
|
||||
let l:status_color = a:active ? "%#Al6#" : "%#Al6_inactive#"
|
||||
let l:file_flag_color = a:active ? "%#Al7#" : "%#Al7_inactive#"
|
||||
|
||||
let sl = l:mode_color
|
||||
if a:active
|
||||
|
@ -123,7 +124,7 @@ function! airline#update_statusline(active)
|
|||
\ ? s:get_section('gutter')
|
||||
\ : '%#warningmsg#'.g:airline_externals_syntastic.l:file_flag_color."%{&ro ? g:airline_readonly_symbol : ''}".l:status_color
|
||||
else
|
||||
let sl.=' %f%m'
|
||||
let sl.=l:status_color.' %f%m'
|
||||
endif
|
||||
if !exists('w:airline_left_only')
|
||||
let sl.='%= '.s:get_section('x').' '
|
||||
|
@ -153,12 +154,8 @@ function! airline#update_highlight()
|
|||
let l:mode = ['normal']
|
||||
endif
|
||||
|
||||
if &modified
|
||||
call add(l:mode, 'modified')
|
||||
endif
|
||||
if &paste
|
||||
call add(l:mode, 'paste')
|
||||
endif
|
||||
if &modified | call add(l:mode, 'modified') | endif
|
||||
if &paste | call add(l:mode, 'paste') | endif
|
||||
|
||||
let mode_string = join(l:mode)
|
||||
if s:lastmode != mode_string
|
||||
|
|
|
@ -15,7 +15,8 @@ let s:V4 = [ '#c7915b' , 173 ] " coffee
|
|||
let s:PA = [ '#f4cf86' , 222 ] " dirtyblonde
|
||||
let s:RE = [ '#ff9eb8' , 211 ] " dress
|
||||
|
||||
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
|
||||
let s:file = [ '#ff2c4b' , s:N3[1] , 196 , s:N3[3] , '' ]
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
|
||||
|
@ -24,8 +25,6 @@ let g:airline#themes#badwolf#normal_modified = {
|
|||
\ 'info' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
|
||||
\ 'info_separator' : [ s:N4[0] , s:N2[1] , s:N4[1] , s:N2[3] , 'bold' ] ,
|
||||
\ 'statusline' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
let g:airline#themes#badwolf#inactive = {
|
||||
\ 'mode' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
|
||||
|
@ -47,3 +46,6 @@ let g:airline#themes#badwolf#visual = airline#themes#generate_color_map(s:V1, s:
|
|||
let g:airline#themes#badwolf#visual_modified = {
|
||||
\ 'info_separator' : [ s:V2[1] , s:V4[0] , s:V2[3] , s:V4[1] , 'bold' ] ,
|
||||
\ 'statusline' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
|
||||
|
||||
|
||||
let g:airline#themes#badwolf#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
let g:airline#themes#dark#inactive = { 'mode': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] }
|
||||
|
||||
let s:file = [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ]
|
||||
let s:N1 = [ '#00005f' , '#dfff00' , 17 , 190 ]
|
||||
let s:N2 = [ '#ffffff' , '#444444' , 255 , 238 ]
|
||||
|
@ -39,3 +37,8 @@ let g:airline#themes#dark#visual_modified = {
|
|||
\ 'info_separator': [ '#ff5f00' , '#5f005f' , 202 , 53 , '' ] ,
|
||||
\ 'statusline': [ '#ffffff' , '#5f005f' , 255 , 53 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA = [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ]
|
||||
let g:airline#themes#dark#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
let g:airline#themes#light#inactive = { 'mode': [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ] }
|
||||
|
||||
let s:file = [ '#df0000' , '#ffffff' , 160 , 255 ]
|
||||
let s:N1 = [ '#ffffff' , '#005fff' , 255 , 27 ]
|
||||
|
@ -39,3 +38,7 @@ let g:airline#themes#light#visual_modified = {
|
|||
\ 'info_separator': [ '#ffaf00' , '#ffdfdf' , 214 , 224 , '' ] ,
|
||||
\ 'statusline': [ '#df0000' , '#ffdfdf' , 160 , 224 , '' ] ,
|
||||
\ }
|
||||
|
||||
|
||||
let s:IA = [ '#9e9e9e' , '#ffffff' , 247 , 255 , '' ]
|
||||
let g:airline#themes#light#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
|
|
@ -39,9 +39,10 @@ let g:airline#themes#powerlineish#visual = {
|
|||
\ 'mode' : [ s:V1[0] , s:V1[1] , s:V1[2] , s:V1[3] , '' ] ,
|
||||
\ 'mode_separator' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
|
||||
|
||||
let g:airline#themes#powerlineish#inactive = {
|
||||
\ 'mode' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
|
||||
|
||||
let g:airline#themes#powerlineish#replace = copy(airline#themes#powerlineish#normal)
|
||||
let g:airline#themes#powerlineish#replace.mode = [ s:RE[0] , s:RE[1] , s:RE[2] , s:RE[3] , '' ]
|
||||
let g:airline#themes#powerlineish#replace.mode_separator = [ s:RE[1] , s:N2[1] , s:RE[3] , s:N2[3] , '' ]
|
||||
|
||||
|
||||
let s:IA = [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ]
|
||||
let g:airline#themes#powerlineish#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
|
|
@ -36,8 +36,7 @@ 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:file = [ '#ff0000' , s:guibg , 160 , 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 ]
|
||||
|
@ -49,7 +48,7 @@ let g:airline#themes#simple#normal = {
|
|||
\ 'info': [ s:N2[0] , s:N2[1] , s:N2[2] , s:N2[3] , '' ] ,
|
||||
\ '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 , '' ] ,
|
||||
\ 'file': s:file,
|
||||
\ }
|
||||
let g:airline#themes#simple#normal_modified = {
|
||||
\ 'statusline': [ '#df0000' , s:guibg, 160 , s:termbg , '' ] ,
|
||||
|
@ -95,3 +94,8 @@ let g:airline#themes#simple#visual = {
|
|||
\ 'statusline': [ s:V3[0] , s:V3[1] , s:V3[2] , s:V3[3] , '' ] ,
|
||||
\ }
|
||||
let g:airline#themes#simple#visual_modified = copy(g:airline#themes#simple#normal_modified)
|
||||
|
||||
|
||||
let s:IA = [ '#4e4e4e' , s:guibg , 239 , s:termbg , '' ]
|
||||
let g:airline#themes#simple#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
" cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63
|
||||
" green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60
|
||||
|
||||
let g:airline#themes#solarized#inactive = { 'mode': [ '#073642' , '#586e75' , 235 , 240 , '' ] }
|
||||
|
||||
let s:N1 = [ '#fdf6e3' , '#657b83' , 230 , 241 ]
|
||||
let s:N2 = [ '#fdf6e3' , '#93a1a1' , 230 , 245 ]
|
||||
let s:N3 = [ '#657b83' , '#fdf6e3' , 241 , 230 ]
|
||||
|
@ -38,11 +36,8 @@ let g:airline#themes#solarized#insert = airline#themes#generate_color_map(s:I1,
|
|||
let g:airline#themes#solarized#insert_modified = s:NM
|
||||
|
||||
|
||||
" I can't find how to customise the paste and replace colors without breaking
|
||||
" the modified color. If someone knows how they can modify this below.
|
||||
"let s:IP1 = [ s:I1[0] , '#268bd2' , s:I1[2] , 33 ]
|
||||
"let g:airline#themes#solarized#insert_paste = airline#themes#generate_color_map(s:IP1, s:I2, s:I3, s:file)
|
||||
"let g:airline#themes#solarized#insert_paste_modified = s:NM
|
||||
let s:IP1 = [ s:I1[0] , '#268bd2' , s:I1[2] , 33 ]
|
||||
let g:airline#themes#solarized#insert_paste = airline#themes#generate_color_map(s:IP1, s:N2, s:N3, s:file)
|
||||
|
||||
|
||||
let s:IR1 = [ s:I1[0] , '#859900' , s:I1[2] , 64 ]
|
||||
|
@ -54,3 +49,6 @@ let s:V1 = [ '#fdf6e3' , '#6c71c4' , 230 , 61 ]
|
|||
let g:airline#themes#solarized#visual = airline#themes#generate_color_map(s:V1, s:N2, s:N3, s:file)
|
||||
let g:airline#themes#solarized#visual_modified = s:NM
|
||||
|
||||
|
||||
let s:IA = [ '#073642' , '#586e75' , 235 , 240 , '' ]
|
||||
let g:airline#themes#solarized#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)
|
||||
|
|
|
@ -92,10 +92,11 @@ let s:VM = {
|
|||
\ 'statusline': s:NM.statusline
|
||||
\ }
|
||||
|
||||
" inactive
|
||||
let s:IA = [s:N3[0], s:N3[1], s:N3[2], s:N3[3], '']
|
||||
|
||||
" actual mapping goes next
|
||||
let g:airline#themes#solarized2#inactive = {
|
||||
\ 'mode': [s:N3[0], s:N3[1], s:N3[2], s:N3[3], ''],
|
||||
\ }
|
||||
let g:airline#themes#solarized2#inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:IA)
|
||||
|
||||
|
||||
let g:airline#themes#solarized2#normal =
|
||||
|
|
Loading…
Reference in New Issue
Block a user