autocomd: do not re-evaluate modelines

fixes #1804
This commit is contained in:
Christian Brabandt 2018-09-25 16:03:30 +02:00
parent 2390022e33
commit a0298263b7
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
5 changed files with 17 additions and 16 deletions

View File

@ -68,7 +68,7 @@ function! airline#switch_theme(name)
let w:airline_lastmode = '' let w:airline_lastmode = ''
call airline#load_theme() call airline#load_theme()
silent doautocmd User AirlineAfterTheme call airline#util#doautocmd('AirlineAfterTheme')
" this is required to prevent clobbering the startup info message, i don't know why... " this is required to prevent clobbering the startup info message, i don't know why...
call airline#check_mode(winnr()) call airline#check_mode(winnr())
@ -203,7 +203,7 @@ function! airline#check_mode(winnr)
if get(w:, 'airline_lastmode', '') != mode_string if get(w:, 'airline_lastmode', '') != mode_string
call airline#highlighter#highlight_modified_inactive(context.bufnr) call airline#highlighter#highlight_modified_inactive(context.bufnr)
call airline#highlighter#highlight(l:mode, context.bufnr) call airline#highlighter#highlight(l:mode, context.bufnr)
silent doautocmd User AirlineModeChanged call airline#util#doautocmd('AirlineModeChanged')
let w:airline_lastmode = mode_string let w:airline_lastmode = mode_string
endif endif

View File

@ -57,7 +57,7 @@ function! s:update_tabline()
\ || isdirectory(expand("<afile>")) \ || isdirectory(expand("<afile>"))
return return
endif endif
doautocmd User BufMRUChange call airline#util#doautocmd('BufMRUChange')
" sometimes, the tabline is not correctly updated see #1580 " sometimes, the tabline is not correctly updated see #1580
" so force redraw here " so force redraw here
let &tabline = &tabline let &tabline = &tabline

View File

@ -100,11 +100,11 @@ function! airline#extensions#tabline#xtabline#maps()
map <unique> <leader>cd2 <Plug>XTablineCdDown2 map <unique> <leader>cd2 <Plug>XTablineCdDown2
map <unique> <leader>cd3 <Plug>XTablineCdDown3 map <unique> <leader>cd3 <Plug>XTablineCdDown3
map <unique> <leader>cdh <Plug>XTablineCdHome map <unique> <leader>cdh <Plug>XTablineCdHome
nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:doautocmd BufAdd<cr>:pwd<cr> nnoremap <unique> <script> <Plug>XTablineCdCurrent :cd %:p:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> nnoremap <unique> <script> <Plug>XTablineCdDown1 :cd %:p:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> nnoremap <unique> <script> <Plug>XTablineCdDown2 :cd %:p:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:doautocmd BufAdd<cr>:pwd<cr> nnoremap <unique> <script> <Plug>XTablineCdDown3 :cd %:p:h:h:h:h<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:doautocmd BufAdd<cr>:pwd<cr> nnoremap <unique> <script> <Plug>XTablineCdHome :cd ~<cr>:call airline#util#doautocmd('BufAdd')<cr>:pwd<cr>
endif endif
endfunction endfunction

View File

@ -8,6 +8,7 @@ scriptencoding utf-8
call airline#init#bootstrap() call airline#init#bootstrap()
let s:spc = g:airline_symbols.space let s:spc = g:airline_symbols.space
let s:nomodeline = (v:version > 703 || (v:version == 703 && has("patch438"))) ? '<nomodeline>' : ''
function! airline#util#shorten(text, winwidth, minwidth, ...) function! airline#util#shorten(text, winwidth, minwidth, ...)
if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth if winwidth(0) < a:winwidth && len(split(a:text, '\zs')) > a:minwidth
@ -119,3 +120,7 @@ endfunction
function! airline#util#has_custom_scm() function! airline#util#has_custom_scm()
return !empty(get(g:, 'airline#extensions#branch#custom_head', '')) return !empty(get(g:, 'airline#extensions#branch#custom_head', ''))
endfunction endfunction
function! airline#util#doautocmd(event)
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
endfu

View File

@ -32,7 +32,7 @@ function! s:init()
silent call s:on_colorscheme_changed() silent call s:on_colorscheme_changed()
endif endif
silent doautocmd User AirlineAfterInit call airline#util#doautocmd('AirlineAfterInit')
endfunction endfunction
let s:active_winnr = -1 let s:active_winnr = -1
@ -86,7 +86,7 @@ function! s:airline_toggle()
endif endif
call airline#highlighter#reset_hlcache() call airline#highlighter#reset_hlcache()
silent doautocmd User AirlineToggledOff call airline#util#doautocmd('AirlineToggledOff')
else else
let s:stl = &statusline let s:stl = &statusline
augroup airline augroup airline
@ -133,7 +133,7 @@ function! s:airline_toggle()
call s:on_window_changed() call s:on_window_changed()
endif endif
silent doautocmd User AirlineToggledOn call airline#util#doautocmd('AirlineToggledOn')
endif endif
endfunction endfunction
@ -155,11 +155,7 @@ function! s:airline_refresh()
" disabled " disabled
return return
endif endif
let nomodeline='' call airline#util#doautocmd('AirlineBeforeRefresh')
if v:version > 703 || v:version == 703 && has("patch438")
let nomodeline = '<nomodeline>'
endif
exe printf("silent doautocmd %s User AirlineBeforeRefresh", nomodeline)
call airline#highlighter#reset_hlcache() call airline#highlighter#reset_hlcache()
call airline#load_theme() call airline#load_theme()
call airline#update_statusline() call airline#update_statusline()