Cache hunk values, shorten for small windows

Cache the hunk values. In case of short windows, shorten the hunk string
a little bit and make the branch extension take the hunk value into
account when deciding how much to shorten it.
This commit is contained in:
Christian Brabandt
2016-07-03 20:44:05 +02:00
parent a710cb99dd
commit 8fda614d0d
2 changed files with 12 additions and 3 deletions

View File

@@ -166,7 +166,8 @@ function! airline#extensions#branch#head()
if empty(b:airline_head) || !found_fugitive_head && !s:check_in_path()
let b:airline_head = ''
endif
let b:airline_head = airline#util#shorten(b:airline_head, 120, 9)
let minwidth = empty(get(b:, 'airline_hunks', '')) ? 14 : 7
let b:airline_head = airline#util#shorten(b:airline_head, 120, minwidth)
return b:airline_head
endfunction