From e7edb4c75ad0d724ac9dd05e84412131faa4addf Mon Sep 17 00:00:00 2001 From: Kevin Sapper Date: Mon, 22 Feb 2016 07:32:36 +0100 Subject: [PATCH] Problem: Cannot rename the labels for buffers and tabs Solution: Add an option for the user to configure those labels and make the current values the default ones. --- autoload/airline/extensions/tabline/buffers.vim | 3 ++- autoload/airline/extensions/tabline/ctrlspace.vim | 7 +++++-- autoload/airline/extensions/tabline/tabs.vim | 3 ++- doc/airline.txt | 8 +++++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/autoload/airline/extensions/tabline/buffers.vim b/autoload/airline/extensions/tabline/buffers.vim index a33add90..c35507ca 100644 --- a/autoload/airline/extensions/tabline/buffers.vim +++ b/autoload/airline/extensions/tabline/buffers.vim @@ -5,6 +5,7 @@ scriptencoding utf-8 let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') let s:spc = g:airline_symbols.space let s:current_bufnr = -1 @@ -81,7 +82,7 @@ function! airline#extensions#tabline#buffers#get() call b.split() call b.add_section('airline_tabfill', '') if s:show_tab_type - call b.add_section('airline_tabtype', ' buffers ') + call b.add_section_spaced('airline_tabtype', s:buffers_label) endif let s:current_bufnr = cur diff --git a/autoload/airline/extensions/tabline/ctrlspace.vim b/autoload/airline/extensions/tabline/ctrlspace.vim index 9490ab02..a27a37e4 100644 --- a/autoload/airline/extensions/tabline/ctrlspace.vim +++ b/autoload/airline/extensions/tabline/ctrlspace.vim @@ -7,6 +7,9 @@ let s:current_bufnr = -1 let s:current_tabnr = -1 let s:current_tabline = '' +let s:buffers_label = get(g:, 'airline#extensions#tabline#buffers_label', 'buffers') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') + function! airline#extensions#tabline#ctrlspace#off() augroup airline_tabline_ctrlspace autocmd! @@ -41,7 +44,7 @@ function! airline#extensions#tabline#ctrlspace#get() let b = airline#extensions#tabline#new_builder() - call b.add_section_spaced('airline_tabtype', 'buffers') + call b.add_section_spaced('airline_tabtype', s:buffers_label) let s:buffer_list = ctrlspace#api#BufferList(cur_tab) for buffer in s:buffer_list @@ -88,7 +91,7 @@ function! airline#extensions#tabline#ctrlspace#get() call b.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index)) endfor - call b.add_section_spaced('airline_tabtype', 'tabs') + call b.add_section_spaced('airline_tabtype', s:tabs_label) let s:current_bufnr = cur_buf let s:current_tabnr = cur_tab diff --git a/autoload/airline/extensions/tabline/tabs.vim b/autoload/airline/extensions/tabline/tabs.vim index afe30766..0dba19bc 100644 --- a/autoload/airline/extensions/tabline/tabs.vim +++ b/autoload/airline/extensions/tabline/tabs.vim @@ -6,6 +6,7 @@ let s:show_tab_type = get(g:, 'airline#extensions#tabline#show_tab_type', 1) let s:show_tab_nr = get(g:, 'airline#extensions#tabline#show_tab_nr', 1) let s:tab_nr_type = get(g:, 'airline#extensions#tabline#tab_nr_type', 0) let s:close_symbol = get(g:, 'airline#extensions#tabline#close_symbol', 'X') +let s:tabs_label = get(g:, 'airline#extensions#tabline#tabs_label', 'tabs') let s:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1) let s:spc = g:airline_symbols.space @@ -84,7 +85,7 @@ function! airline#extensions#tabline#tabs#get() call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)') endfor elseif s:show_tab_type == 1 - call b.add_section('airline_tabtype', ' tabs ') + call b.add_section_spaced('airline_tabtype', s:tabs_label) endif let s:current_bufnr = curbuf diff --git a/doc/airline.txt b/doc/airline.txt index 79e10122..16fe8f11 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -518,9 +518,15 @@ eclim * enable/disable displaying index of the buffer. Note: If you're using ctrlspace the tabline shows your tabs on the right and - buffer on the left. Also none of the tabline switches is currently + buffer on the left. Also none of the above tabline switches is currently supported! +* rename label for buffers (default: 'buffers') + let g:airline#extensions#tabline#buffers_label = 'b' + +* rename label for tabs (default: 'tabs') + let g:airline#extensions#tabline#tabs_label = 't' + When enabled, numbers will be displayed in the tabline and mappings will be exposed to allow you to select a buffer directly. Up to 9 mappings will be exposed. >