From e1a4cd764f7d2c97284e9fa6e52c986ad4a19270 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 13 Mar 2018 00:57:48 +0000 Subject: [PATCH] Adjust tab columns to allow for ellipsis and the left/right split --- autoload/airline/extensions/tabline/tabs.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 61715e5..d713719 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -46,14 +46,17 @@ function! s:get_visible_tabs(width, titles) let max_width = max([max_width, width]) endfor + " leave space for end ellipsis (...) and the left/right split (2 spaces) + let tab_columns = a:width - 8 + " only show current and surrounding tabs if there are too many tabs let position = index(tablist, curbuf) - if total_width > a:width && position > -1 + if total_width > tab_columns && position > -1 let tab_count = len(tablist) " determine how many tabs to show based on the longest tab width, " use one on the right side and put the rest on the left - let tab_max = a:width / max_width + let tab_max = tab_columns / max_width let tab_right = 1 let tab_left = max([0, tab_max - tab_right])