Avoid heavy execution of highlight command
This commit is contained in:
parent
b0ea537173
commit
1845c5ed30
@ -121,12 +121,15 @@ function! s:update_statusline(active)
|
|||||||
call setwinvar(winnr(), '&statusline', sl)
|
call setwinvar(winnr(), '&statusline', sl)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
let s:lastmode = ''
|
||||||
|
|
||||||
function! AirlineModePrefix()
|
function! AirlineModePrefix()
|
||||||
if !&lazyredraw
|
if !&lazyredraw
|
||||||
redrawstatus
|
redrawstatus
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:mode = mode()
|
let l:mode = mode()
|
||||||
|
if s:lastmode != l:mode
|
||||||
call <sid>highlight('normal', ['statusline','statusline_nc','inactive','mode','mode_separator','info','info_separator','file'])
|
call <sid>highlight('normal', ['statusline','statusline_nc','inactive','mode','mode_separator','info','info_separator','file'])
|
||||||
|
|
||||||
if l:mode ==# "i" || l:mode ==# "R"
|
if l:mode ==# "i" || l:mode ==# "R"
|
||||||
@ -134,6 +137,8 @@ function! AirlineModePrefix()
|
|||||||
elseif l:mode ==? "v" || l:mode ==# ""
|
elseif l:mode ==? "v" || l:mode ==# ""
|
||||||
call <sid>highlight('visual', ['statusline','mode','mode_separator','info','info_separator'])
|
call <sid>highlight('visual', ['statusline','mode','mode_separator','info','info_separator'])
|
||||||
endif
|
endif
|
||||||
|
let s:lastmode = l:mode
|
||||||
|
endif
|
||||||
|
|
||||||
if has_key(s:airline_mode_map, l:mode)
|
if has_key(s:airline_mode_map, l:mode)
|
||||||
return s:airline_mode_map[l:mode]
|
return s:airline_mode_map[l:mode]
|
||||||
|
Loading…
Reference in New Issue
Block a user