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.
This commit is contained in:
Kevin Sapper 2016-02-22 07:32:36 +01:00
parent e6ab7bdf6d
commit e7edb4c75a
4 changed files with 16 additions and 5 deletions

View File

@ -5,6 +5,7 @@ scriptencoding utf-8
let s:buffer_idx_mode = get(g:, 'airline#extensions#tabline#buffer_idx_mode', 0) 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: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:spc = g:airline_symbols.space
let s:current_bufnr = -1 let s:current_bufnr = -1
@ -81,7 +82,7 @@ function! airline#extensions#tabline#buffers#get()
call b.split() call b.split()
call b.add_section('airline_tabfill', '') call b.add_section('airline_tabfill', '')
if s:show_tab_type if s:show_tab_type
call b.add_section('airline_tabtype', ' buffers ') call b.add_section_spaced('airline_tabtype', s:buffers_label)
endif endif
let s:current_bufnr = cur let s:current_bufnr = cur

View File

@ -7,6 +7,9 @@ let s:current_bufnr = -1
let s:current_tabnr = -1 let s:current_tabnr = -1
let s:current_tabline = '' 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() function! airline#extensions#tabline#ctrlspace#off()
augroup airline_tabline_ctrlspace augroup airline_tabline_ctrlspace
autocmd! autocmd!
@ -41,7 +44,7 @@ function! airline#extensions#tabline#ctrlspace#get()
let b = airline#extensions#tabline#new_builder() 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) let s:buffer_list = ctrlspace#api#BufferList(cur_tab)
for buffer in s:buffer_list 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)) call b.add_section_spaced(group, tab.title.ctrlspace#api#TabBuffersNumber(tab.index))
endfor 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_bufnr = cur_buf
let s:current_tabnr = cur_tab let s:current_tabnr = cur_tab

View File

@ -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: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: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: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:show_splits = get(g:, 'airline#extensions#tabline#show_splits', 1)
let s:spc = g:airline_symbols.space 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.')}%)') call b.add_section_spaced(group, '%(%{airline#extensions#tabline#get_buffer_name('.nr.')}%)')
endfor endfor
elseif s:show_tab_type == 1 elseif s:show_tab_type == 1
call b.add_section('airline_tabtype', ' tabs ') call b.add_section_spaced('airline_tabtype', s:tabs_label)
endif endif
let s:current_bufnr = curbuf let s:current_bufnr = curbuf

View File

@ -518,9 +518,15 @@ eclim <https://eclim.org>
* enable/disable displaying index of the buffer. * enable/disable displaying index of the buffer.
Note: If you're using ctrlspace the tabline shows your tabs on the right and 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! 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 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 to allow you to select a buffer directly. Up to 9 mappings will be
exposed. > exposed. >