From 980e78b4bf0d1e3a359ed96997058e3f86580852 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 14 Mar 2018 14:51:19 +0000 Subject: [PATCH] Add configurable variable airline#extensions#tabline#skipped_tabs_marker --- autoload/airline/extensions/tabline/tabs.vim | 11 +++++++---- doc/airline.txt | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 1096850f..cc4aefc1 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -31,7 +31,7 @@ function! s:evaluate_tabline(tabline) let tabline = substitute(tabline, '%#[^#]\+#', '', 'g') let tabline = substitute(tabline, '%(\([^)]\+\))', '\1', 'g') let tabline = substitute(tabline, '%\d\+[TX]', '', 'g') - let tabline = substitute(tabline, '%=', '', 'g') + let tabline = substitute(tabline, '%=', ' ', 'g') let tabline = substitute(tabline, '%\d*\*', '', 'g') return tabline endfunction @@ -91,7 +91,10 @@ function! airline#extensions#tabline#tabs#get() let right_tab = curtab + 1 let left_position = tabs_position let right_position = tabs_position + 1 - let remaining_space = &columns - strlen(s:evaluate_tabline(b.build())) - 8 + let remaining_space = &columns - strlen(s:evaluate_tabline(b.build())) + + let skipped_tabs_marker = get(g:, 'airline#extensions#tabline#skipped_tabs_marker', '...') + let remaining_space -= 4 + 2 * strlen(s:evaluate_tabline(skipped_tabs_marker)) " Add the current tab let tab_title = s:get_title(tab_nr_type, curtab) @@ -147,12 +150,12 @@ function! airline#extensions#tabline#tabs#get() if get(g:, 'airline#extensions#tabline#current_first', 0) let left_position -= 1 endif - call b.insert_raw('%#airline_tab#...', left_position) + call b.insert_raw('%#airline_tab#'.skipped_tabs_marker, left_position) let right_position += 1 endif if right_tab <= num_tabs - call b.insert_raw('%#airline_tab#...', right_position) + call b.insert_raw('%#airline_tab#'.skipped_tabs_marker, right_position) endif let s:current_bufnr = curbuf diff --git a/doc/airline.txt b/doc/airline.txt index c0ac19bd..e148818e 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -709,6 +709,9 @@ with the middle mouse button to delete that buffer. * rename label for tabs (default: 'tabs') (c) > let g:airline#extensions#tabline#tabs_label = 't' +* change the symbol for skipped tabs/buffers (default '...') > + let g:airline#extensions#tabline#skipped_tabs_marker = '…' + * always show current tabpage/buffer first > let airline#extensions#tabline#current_first = 1 < default: 0