Merge pull request #141 from chrisbra/master
added airlinetoggle function
This commit is contained in:
commit
f5afe4bcac
|
@ -92,6 +92,9 @@ COMMANDS *airline-commands*
|
||||||
:AirlineToggleWhitespace *:AirlineToggleWhitespace*
|
:AirlineToggleWhitespace *:AirlineToggleWhitespace*
|
||||||
Toggles whitespace detection.
|
Toggles whitespace detection.
|
||||||
|
|
||||||
|
:AirlineToggle *:AirlineToggle*
|
||||||
|
Toggle this plugin (e.g. the nice statusline)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CUSTOMIZATION *airline-customization*
|
CUSTOMIZATION *airline-customization*
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ call s:check_defined('g:airline_mode_map', {
|
||||||
\ '' : 'S-BLOCK',
|
\ '' : 'S-BLOCK',
|
||||||
\ })
|
\ })
|
||||||
|
|
||||||
|
|
||||||
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
|
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
|
||||||
call s:check_defined('g:airline_section_b', '%{get(w:, "airline_current_branch", "")}')
|
call s:check_defined('g:airline_section_b', '%{get(w:, "airline_current_branch", "")}')
|
||||||
call s:check_defined('g:airline_section_c', '%f%m')
|
call s:check_defined('g:airline_section_c', '%f%m')
|
||||||
|
@ -70,6 +71,28 @@ function! s:on_window_changed()
|
||||||
call airline#update_statusline()
|
call airline#update_statusline()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:airline_toggle()
|
||||||
|
if exists("#airline")
|
||||||
|
augroup airline
|
||||||
|
au!
|
||||||
|
augroup END
|
||||||
|
augroup! airline
|
||||||
|
if exists("s:stl")
|
||||||
|
let &stl = s:stl
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let s:stl = &stl
|
||||||
|
augroup airline
|
||||||
|
autocmd!
|
||||||
|
autocmd ColorScheme * call airline#reload_highlight()
|
||||||
|
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
|
||||||
|
\ call <sid>on_window_changed()
|
||||||
|
augroup END
|
||||||
|
" update statusline now
|
||||||
|
call <sid>on_window_changed()
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:get_airline_themes(a, l, p)
|
function! s:get_airline_themes(a, l, p)
|
||||||
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:a.'*'), "\n")
|
||||||
return map(files, 'fnamemodify(v:val, ":t:r")')
|
return map(files, 'fnamemodify(v:val, ":t:r")')
|
||||||
|
@ -83,10 +106,6 @@ function! s:airline_theme(...)
|
||||||
endfunction
|
endfunction
|
||||||
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
command! -nargs=? -complete=customlist,<sid>get_airline_themes AirlineTheme call <sid>airline_theme(<f-args>)
|
||||||
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
command! AirlineToggleWhitespace call airline#extensions#whitespace#toggle()
|
||||||
|
command! AirlineToggle call <sid>airline_toggle()
|
||||||
|
|
||||||
augroup airline
|
call <sid>airline_toggle()
|
||||||
autocmd!
|
|
||||||
autocmd ColorScheme * call airline#reload_highlight()
|
|
||||||
autocmd WinEnter,BufWinEnter,FileType,BufUnload,ShellCmdPost *
|
|
||||||
\ call <sid>on_window_changed()
|
|
||||||
augroup END
|
|
||||||
|
|
Loading…
Reference in New Issue