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:
parent
5f769dbed9
commit
61ca196d73
|
@ -266,14 +266,14 @@ function! airline#extensions#branch#head()
|
||||||
endif
|
endif
|
||||||
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
|
return b:airline_head
|
||||||
endfunction
|
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 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 empty_message = get(g:, 'airline#extensions#branch#empty_message', '')
|
||||||
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
|
let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch)
|
||||||
return empty(head)
|
return empty(head)
|
||||||
|
|
Loading…
Reference in New Issue