diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index 8e9e934..17aac7c 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -190,15 +190,9 @@ endfunction function! s:map_keys() if get(g:, 'airline#extensions#tabline#buffer_idx_mode', 1) - noremap AirlineSelectTab1 :call select_tab(1) - noremap AirlineSelectTab2 :call select_tab(2) - noremap AirlineSelectTab3 :call select_tab(3) - noremap AirlineSelectTab4 :call select_tab(4) - noremap AirlineSelectTab5 :call select_tab(5) - noremap AirlineSelectTab6 :call select_tab(6) - noremap AirlineSelectTab7 :call select_tab(7) - noremap AirlineSelectTab8 :call select_tab(8) - noremap AirlineSelectTab9 :call select_tab(9) + for i in range(1, 9) + exe printf('noremap AirlineSelectTab%d :call select_tab(%d)', i, i) + endfor noremap AirlineSelectPrevTab :call jump_to_tab(-v:count1) noremap AirlineSelectNextTab :call jump_to_tab(v:count1) " Enable this for debugging diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index 62501c3..eb14002 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -104,15 +104,9 @@ function! airline#extensions#tabline#tabs#map_keys() if maparg('AirlineSelectTab1', 'n') is# ':1tabn' return endif - noremap AirlineSelectTab1 :1tabn - noremap AirlineSelectTab2 :2tabn - noremap AirlineSelectTab3 :3tabn - noremap AirlineSelectTab4 :4tabn - noremap AirlineSelectTab5 :5tabn - noremap AirlineSelectTab6 :6tabn - noremap AirlineSelectTab7 :7tabn - noremap AirlineSelectTab8 :8tabn - noremap AirlineSelectTab9 :9tabn + for i in range(1, 9) + exe printf('noremap AirlineSelectTab%d :%dtabn', i, i) + endfor noremap AirlineSelectPrevTab gT " tabn {count} goes to count tab does not go {count} tab pages forward! noremap AirlineSelectNextTab :exe repeat(':tabn\|', v:count1)