mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-25 17:57:36 +08:00
added airlinetoggle function
This commit is contained in:
parent
c5e21aa170
commit
8ec527465d
|
@ -144,6 +144,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*
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,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')
|
||||||
|
@ -76,6 +77,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")')
|
||||||
|
@ -89,10 +112,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
Block a user