implement support for detected modified buffers
This commit is contained in:
parent
4c51377489
commit
3877ddb7bb
|
@ -8,6 +8,9 @@ let g:airline#themes#default#normal = {
|
||||||
\ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] ,
|
\ 'file': [ '#ff0000' , '#1c1c1c' , 160 , 233 , '' ] ,
|
||||||
\ 'inactive': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] ,
|
\ 'inactive': [ '#4e4e4e' , '#1c1c1c' , 239 , 234 , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
|
let g:airline#themes#default#normal_modified = copy(g:airline#themes#default#normal)
|
||||||
|
let g:airline#themes#default#normal_modified.info_seperator = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
let g:airline#themes#default#normal_modified.statusline = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
|
||||||
let g:airline#themes#default#insert = {
|
let g:airline#themes#default#insert = {
|
||||||
\ 'mode': [ '#00005f' , '#00dfff' , 17 , 45 , 'bold' ] ,
|
\ 'mode': [ '#00005f' , '#00dfff' , 17 , 45 , 'bold' ] ,
|
||||||
|
@ -16,6 +19,9 @@ let g:airline#themes#default#insert = {
|
||||||
\ 'info_seperator': [ '#005fff' , '#000087' , 27 , 18 , 'bold' ] ,
|
\ 'info_seperator': [ '#005fff' , '#000087' , 27 , 18 , 'bold' ] ,
|
||||||
\ 'statusline': [ '#ffffff' , '#000080' , 15 , 17 , '' ] ,
|
\ 'statusline': [ '#ffffff' , '#000080' , 15 , 17 , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
|
let g:airline#themes#default#insert_modified = copy(g:airline#themes#default#insert)
|
||||||
|
let g:airline#themes#default#insert_modified.info_seperator = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
let g:airline#themes#default#insert_modified.statusline = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
|
||||||
let g:airline#themes#default#visual = {
|
let g:airline#themes#default#visual = {
|
||||||
\ 'mode': [ '#000000' , '#ffaf00' , 232 , 214 , 'bold' ] ,
|
\ 'mode': [ '#000000' , '#ffaf00' , 232 , 214 , 'bold' ] ,
|
||||||
|
@ -24,3 +30,6 @@ let g:airline#themes#default#visual = {
|
||||||
\ 'info_seperator': [ '#ff5f00' , '#5f0000' , 202 , 52 , 'bold' ] ,
|
\ 'info_seperator': [ '#ff5f00' , '#5f0000' , 202 , 52 , 'bold' ] ,
|
||||||
\ 'statusline': [ '#ffffff' , '#5f0000' , 15 , 52 , '' ] ,
|
\ 'statusline': [ '#ffffff' , '#5f0000' , 15 , 52 , '' ] ,
|
||||||
\ }
|
\ }
|
||||||
|
let g:airline#themes#default#visual_modified = copy(g:airline#themes#default#visual)
|
||||||
|
let g:airline#themes#default#visual_modified.info_seperator = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
let g:airline#themes#default#visual_modified.statusline = [ '#ffffff' , '#5f005f' , 255 , 53 , '' ]
|
||||||
|
|
|
@ -40,6 +40,11 @@ values):
|
||||||
let g:airline_left_right='<'
|
let g:airline_left_right='<'
|
||||||
<
|
<
|
||||||
|
|
||||||
|
* enable/disable color change when buffer is modified
|
||||||
|
>
|
||||||
|
let g:airline_modified_detection=1
|
||||||
|
<
|
||||||
|
|
||||||
* enable/disable fugitive integration
|
* enable/disable fugitive integration
|
||||||
>
|
>
|
||||||
let g:airline_enable_fugitive=1
|
let g:airline_enable_fugitive=1
|
||||||
|
|
|
@ -22,12 +22,16 @@ endif
|
||||||
if !exists('g:airline_theme')
|
if !exists('g:airline_theme')
|
||||||
let g:airline_theme = 'default'
|
let g:airline_theme = 'default'
|
||||||
endif
|
endif
|
||||||
|
if !exists('g:airline_modified_detection')
|
||||||
|
let g:airline_modified_detection=1
|
||||||
|
endif
|
||||||
|
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
|
|
||||||
let s:airline_colors_normal = g:airline#themes#{g:airline_theme}#normal
|
for mode in ['normal','insert','visual']
|
||||||
let s:airline_colors_insert = g:airline#themes#{g:airline_theme}#insert
|
let s:airline_colors_{mode} = g:airline#themes#{g:airline_theme}#{mode}
|
||||||
let s:airline_colors_visual = g:airline#themes#{g:airline_theme}#visual
|
let s:airline_colors_{mode}_modified = g:airline#themes#{g:airline_theme}#{mode}_modified
|
||||||
|
endfor
|
||||||
|
|
||||||
let s:airline_mode_map = {
|
let s:airline_mode_map = {
|
||||||
\ 'n' : ' NORMAL ',
|
\ 'n' : ' NORMAL ',
|
||||||
|
@ -50,9 +54,13 @@ let s:airline_highlight_map = {
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:highlight(mode, keys)
|
function! s:highlight(mode, keys)
|
||||||
|
let l:mode = a:mode
|
||||||
|
if g:airline_modified_detection && &modified
|
||||||
|
let l:mode .= '_modified'
|
||||||
|
endif
|
||||||
for key in a:keys
|
for key in a:keys
|
||||||
if exists('s:airline_colors_{a:mode}') && exists('s:airline_colors_{a:mode}[key]')
|
if exists('s:airline_colors_{l:mode}') && exists('s:airline_colors_{l:mode}[key]')
|
||||||
let colors = s:airline_colors_{a:mode}[key]
|
let colors = s:airline_colors_{l:mode}[key]
|
||||||
let cmd = printf('hi %s %s %s %s %s %s %s',
|
let cmd = printf('hi %s %s %s %s %s %s %s',
|
||||||
\ s:airline_highlight_map[key],
|
\ s:airline_highlight_map[key],
|
||||||
\ colors[0] != '' ? 'guifg='.colors[0] : '',
|
\ colors[0] != '' ? 'guifg='.colors[0] : '',
|
||||||
|
|
Loading…
Reference in New Issue