Move formatting of branch name into get_head

This allows for advanced customization where the shortening of the
branch name is up to the caller, unlike before.

This change is observable from the outside, and as such can be
dangerous. But AFAIK it does not change the default behavior.
This commit is contained in:
Max Nordlund gmail 2019-02-20 12:32:55 +01:00
parent 5f769dbed9
commit 61ca196d73
No known key found for this signature in database
GPG Key ID: 995D5074B7F9E79F
1 changed files with 3 additions and 3 deletions

View File

@ -266,14 +266,14 @@ function! airline#extensions#branch#head()
endif
endif
let winwidth = get(airline#parts#get('branch'), 'minwidth', 120)
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let b:airline_head = airline#util#shorten(b:airline_head, winwidth, minwidth)
return b:airline_head
endfunction
function! airline#extensions#branch#get_head()
let head = airline#extensions#branch#head()
let winwidth = get(airline#parts#get('branch'), 'minwidth', 120)
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let head = airline#util#shorten(head, winwidth, minwidth)
let empty_message = get(g:, 'airline#extensions#branch#empty_message', '')
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
return empty(head)