mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-25 17:57:36 +08:00
make the mode and branch text window local
This commit is contained in:
parent
5d92aaecaa
commit
2a10bfc32f
|
@ -168,9 +168,10 @@ function! airline#update_highlight()
|
||||||
else
|
else
|
||||||
let l:mode = ['normal']
|
let l:mode = ['normal']
|
||||||
endif
|
endif
|
||||||
let g:airline_current_mode_text = get(g:airline_mode_map, l:m, l:m)
|
let w:airline_current_mode = get(g:airline_mode_map, l:m, l:m)
|
||||||
else
|
else
|
||||||
let l:mode = ['inactive']
|
let l:mode = ['inactive']
|
||||||
|
let w:airline_current_mode = get(g:airline_mode_map, '__')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if g:airline_detect_modified && &modified | call add(l:mode, 'modified') | endif
|
if g:airline_detect_modified && &modified | call add(l:mode, 'modified') | endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
" vim: ts=2 sts=2 sw=2 fdm=indent
|
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||||
|
|
||||||
function! airline#extensions#branch#apply()
|
function! airline#extensions#branch#apply()
|
||||||
let g:airline_current_branch = exists('*fugitive#head') && strlen(fugitive#head()) > 0
|
let w:airline_current_branch = exists('*fugitive#head') && strlen(fugitive#head()) > 0
|
||||||
\ ? g:airline_branch_prefix.fugitive#head()
|
\ ? g:airline_branch_prefix.fugitive#head()
|
||||||
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
|
\ : exists('*lawrencium#statusline') && strlen(lawrencium#statusline()) > 0
|
||||||
\ ? g:airline_branch_prefix.lawrencium#statusline()
|
\ ? g:airline_branch_prefix.lawrencium#statusline()
|
||||||
|
|
|
@ -42,6 +42,7 @@ call s:check_defined('g:airline_statusline_funcrefs', [])
|
||||||
call s:check_defined('g:airline_exclude_funcrefs', [])
|
call s:check_defined('g:airline_exclude_funcrefs', [])
|
||||||
|
|
||||||
call s:check_defined('g:airline_mode_map', {
|
call s:check_defined('g:airline_mode_map', {
|
||||||
|
\ '__' : ' ---- ',
|
||||||
\ 'n' : 'NORMAL',
|
\ 'n' : 'NORMAL',
|
||||||
\ 'i' : 'INSERT',
|
\ 'i' : 'INSERT',
|
||||||
\ 'R' : 'REPLACE',
|
\ 'R' : 'REPLACE',
|
||||||
|
@ -54,8 +55,8 @@ call s:check_defined('g:airline_mode_map', {
|
||||||
\ '' : 'S-BLOCK',
|
\ '' : 'S-BLOCK',
|
||||||
\ })
|
\ })
|
||||||
|
|
||||||
call s:check_defined('g:airline_section_a', '%{get(g:, "airline_current_mode_text", "")}')
|
call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}')
|
||||||
call s:check_defined('g:airline_section_b', '%{get(g:, "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')
|
||||||
call s:check_defined('g:airline_section_gutter', '')
|
call s:check_defined('g:airline_section_gutter', '')
|
||||||
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
|
call s:check_defined('g:airline_section_x', "%{strlen(&filetype)>0?&filetype:''}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user