From abcb3c4bb356641ba27d81efedf0bf3edad9486d Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 20 Apr 2016 21:06:04 +0200 Subject: [PATCH] Update each window only once in s:on_window_changed. We might come there several times for different autocommands. The key uses bufnr/winnr and the number of total windows, and is stored for the tab. --- plugin/airline.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/airline.vim b/plugin/airline.vim index fc8e975b..db0b937d 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -37,6 +37,13 @@ function! s:on_window_changed() if pumvisible() && (!&previewwindow || g:airline_exclude_preview) return endif + " Handle each window only once, since we might come here several times for + " different autocommands. + let l:key = [bufnr('%'), winnr(), winnr('$')] + if get(t:, 'airline_last_window_changed', []) == l:key + return + endif + let t:airline_last_window_changed = l:key call s:init() call airline#update_statusline() endfunction