From 61ca196d7384f66af267a8af5b491a345118a7b2 Mon Sep 17 00:00:00 2001 From: Max Nordlund gmail Date: Wed, 20 Feb 2019 12:32:55 +0100 Subject: [PATCH] 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. --- autoload/airline/extensions/branch.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 5a47f81d..efbd5192 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -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)