mirror of
https://github.com/vim-airline/vim-airline-themes
synced 2025-01-07 22:20:52 +00:00
introduce new warning section, and refactor whitespace into an extension which uses it
This commit is contained in:
parent
4d67c802b3
commit
528f56472c
@ -105,8 +105,7 @@ function! s:get_statusline(winnr, active)
|
||||
let sl.=a:active ? g:airline_right_sep : g:airline_right_alt_sep
|
||||
let sl.=l:mode_color
|
||||
let sl.=s:get_section(a:winnr, 'z')
|
||||
let sl.="%#Al3#"
|
||||
let sl.='%{g:airline_detect_white_space && search(" $","nw") ? " ✹ " : ""}'
|
||||
let sl.='%#Al3#'.s:getwinvar(a:winnr, 'airline_section_warning', '')
|
||||
endif
|
||||
return sl
|
||||
endfunction
|
||||
|
@ -136,6 +136,10 @@ function! airline#extensions#load()
|
||||
call airline#extensions#bufferline#init(s:ext)
|
||||
endif
|
||||
|
||||
if g:airline_detect_whitespace
|
||||
call airline#extensions#whitespace#init(s:ext)
|
||||
endif
|
||||
|
||||
call airline#exec_funcrefs(g:airline_statusline_funcrefs, 0)
|
||||
endfunction
|
||||
|
||||
|
11
autoload/airline/extensions/whitespace.vim
Normal file
11
autoload/airline/extensions/whitespace.vim
Normal file
@ -0,0 +1,11 @@
|
||||
" MIT license. Copyright (c) 2013 Bailey Ling.
|
||||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||
|
||||
function! airline#extensions#whitespace#check()
|
||||
let w:airline_section_warning = '%{get(w:, "airline_active", 0) && search(" $", "nw")'
|
||||
\ .'? " ".g:airline_whitespace_symbol." " : ""}'
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#whitespace#init(ext)
|
||||
call a:ext.add_statusline_funcref(function('airline#extensions#whitespace#check'))
|
||||
endfunction
|
@ -27,7 +27,8 @@ call s:check_defined('g:airline_enable_tagbar', 1)
|
||||
call s:check_defined('g:airline_detect_iminsert', 0)
|
||||
call s:check_defined('g:airline_detect_modified', 1)
|
||||
call s:check_defined('g:airline_detect_paste', 1)
|
||||
call s:check_defined('g:airline_detect_white_space', 1)
|
||||
call s:check_defined('g:airline_detect_whitespace', 1)
|
||||
call s:check_defined('g:airline_whitespace_symbol', '✹')
|
||||
call s:check_defined('g:airline_branch_prefix', exists('g:airline_powerline_fonts')?' ':'')
|
||||
call s:check_defined('g:airline_readonly_symbol', exists('g:airline_powerline_fonts')?'':'RO')
|
||||
call s:check_defined('g:airline_linecolumn_prefix', exists('g:airline_powerline_fonts')?' ':':')
|
||||
|
Loading…
Reference in New Issue
Block a user