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.
This commit is contained in:
Rich Alesi 2014-01-15 21:31:07 -07:00
parent 5f1c24528c
commit 6141a59278

View File

@ -10,10 +10,6 @@ if !s:has_fugitive && !s:has_lawrencium && !s:has_vcscommand
finish finish
endif 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() function! airline#extensions#branch#head()
let head = '' let head = ''
@ -48,9 +44,13 @@ endfunction
function! airline#extensions#branch#get_head() function! airline#extensions#branch#get_head()
let head = airline#extensions#branch#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) return empty(head)
\ ? s:empty_message \ ? empty_message
\ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.(g:airline_symbols.space), head) \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head)
endfunction endfunction
function! s:check_in_path() function! s:check_in_path()