From 5147d385a5111074cceb2a2bb8cf1a5ed8ee895d Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 23 Aug 2017 17:56:57 +0200 Subject: [PATCH] branch: cache filename path fixes #1536 --- autoload/airline/extensions/branch.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index baf30d3..8bcedd3 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -138,9 +138,10 @@ function! s:update_hg_branch(path) endfunction function! s:update_branch() - let l:path = exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h") + let b:airline_fname_path = get(b:, 'airline_fname_path', + \ exists("*fnamemodify") ? fnamemodify(resolve(@%), ":p:h") : expand("%:p:h")) for vcs in keys(s:vcs_config) - call {s:vcs_config[vcs].update_branch}(l:path) + call {s:vcs_config[vcs].update_branch}(b:airline_fname_path) if b:buffer_vcs_config[vcs].branch != s:vcs_config[vcs].branch let b:buffer_vcs_config[vcs].branch = s:vcs_config[vcs].branch unlet! b:airline_head