From 05572482b81e2e8916d1847f15721c65bc8a13cf Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 7 Feb 2019 08:17:33 +0100 Subject: [PATCH] tabline: add forgotten changes from commit cd1d8c2a96da9 I accidentally missed including some more changes for buffer_idx_mode=2. So add those files now. --- CHANGELOG.md | 2 ++ autoload/airline/extensions/tabline/tabs.vim | 13 ++++++++++--- doc/airline.txt | 19 ++++++++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 770d5f97..b2f146f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ This is the Changelog for the vim-airline project. - Improvements - The statusline can be configured to be shown on top (in the tabline) Set the `g:airline_statusline_ontop` to enable this experimental feature. + - If `buffer_idx_mode=2`, up to 89 mappings will be exposed to access more + buffers directly (issue #1823) ## [0.10] - 2018-12-15 - New features diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index eb140024..dba63b0b 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -104,9 +104,16 @@ function! airline#extensions#tabline#tabs#map_keys() if maparg('AirlineSelectTab1', 'n') is# ':1tabn' return endif - for i in range(1, 9) - exe printf('noremap AirlineSelectTab%d :%dtabn', i, i) - endfor + let bidx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) + if bidx_mode == 1 + for i in range(1, 9) + exe printf('noremap AirlineSelectTab%d :%dtabn', i, i) + endfor + else + for i in range(10, 99) + exe printf('noremap AirlineSelectTab%d :%dtabn', i, i-9) + endfor + endif noremap AirlineSelectPrevTab gT " tabn {count} goes to count tab does not go {count} tab pages forward! noremap AirlineSelectNextTab :exe repeat(':tabn\|', v:count1) diff --git a/doc/airline.txt b/doc/airline.txt index 46de37c1..8a45fc2e 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -859,9 +859,10 @@ with the middle mouse button to delete that buffer. * enable/disable displaying index of the buffer. - When enabled, numbers will be displayed in the tabline and mappings will be - exposed to allow you to select a buffer directly. Up to 11 mappings will be - exposed. > + `buffer_idx_mode` allows 2 different modes to access buffers from the + tabline. When enabled, numbers will be displayed in the tabline and mappings + will be exposed to allow you to select a buffer directly. + In default mode, when the variable is 1 Up to 11 mappings will be exposed: > let g:airline#extensions#tabline#buffer_idx_mode = 1 nmap 1 AirlineSelectTab1 @@ -875,6 +876,18 @@ with the middle mouse button to delete that buffer. nmap 9 AirlineSelectTab9 nmap - AirlineSelectPrevTab nmap + AirlineSelectNextTab +< + In mode 2, (when the variable is 2) 89 mappings will be exposed + (Note: To avoid ambiguity, there won't be AirlineSelectTab1 + - AirlineSelectTab9 maps): > + + let g:airline#extensions#tabline#buffer_idx_mode = 2 + nmap 10 AirlineSelectTab10 + nmap 11 AirlineSelectTab11 + nmap 12 AirlineSelectTab12 + nmap 13 AirlineSelectTab13 + ... + nmap 99 AirlineSelectTab99 < The AirlineSelectTab mapping handles counts as well, so one can handle arbirtrarily number of buffers/tabs.