From 6141a59278e3e46f49f7a08455cebb7b16fa4e67 Mon Sep 17 00:00:00 2001 From: Rich Alesi Date: Wed, 15 Jan 2014 21:31:07 -0700 Subject: [PATCH] Allow changes to airline_symbols.branch after init If the user updates the airline_symbols.branch variable later in the vimrc, the value will not update after the initial init. Since these variables are only used in the get_head() function, I moved them locally within the function to allow evaluation on each instance. --- autoload/airline/extensions/branch.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 2177f64c..77339c7e 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -10,10 +10,6 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand finish endif -let s:empty_message = get(g:, 'airline#extensions#branch#empty_message', - \ get(g:, 'airline_branch_empty_message', '')) -let s:symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) - function! airline#extensions#branch#head() let head = '' @@ -48,9 +44,13 @@ endfunction function! airline#extensions#branch#get_head() let head = airline#extensions#branch#head() + let empty_message = get(g:, 'airline#extensions#branch#empty_message', + \ get(g:, 'airline_branch_empty_message', '')) + let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) + return empty(head) - \ ? s:empty_message - \ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head) + \ ? empty_message + \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) endfunction function! s:check_in_path()