support configuring tabline separators independently. resolves #215.
This commit is contained in:
parent
2066410156
commit
53364af1e3
@ -11,11 +11,11 @@ endfunction
|
|||||||
function! s:prototype.add_section(group, contents)
|
function! s:prototype.add_section(group, contents)
|
||||||
if self._curgroup != ''
|
if self._curgroup != ''
|
||||||
if self._curgroup == a:group
|
if self._curgroup == a:group
|
||||||
let self._line .= self._side ? g:airline_left_alt_sep : g:airline_right_alt_sep
|
let self._line .= self._side ? self._context.left_alt_sep : self._context.right_alt_sep
|
||||||
else
|
else
|
||||||
call airline#highlighter#add_separator(self._curgroup, a:group, self._side)
|
call airline#highlighter#add_separator(self._curgroup, a:group, self._side)
|
||||||
let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#'
|
let self._line .= '%#'.self._curgroup.'_to_'.a:group.'#'
|
||||||
let self._line .= self._side ? g:airline_left_sep : g:airline_right_sep
|
let self._line .= self._side ? self._context.left_sep : self._context.right_sep
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -40,6 +40,13 @@ function! airline#builder#new(context)
|
|||||||
let builder._side = 1
|
let builder._side = 1
|
||||||
let builder._curgroup = ''
|
let builder._curgroup = ''
|
||||||
let builder._line = ''
|
let builder._line = ''
|
||||||
|
|
||||||
|
call extend(builder._context, {
|
||||||
|
\ 'left_sep': g:airline_left_sep,
|
||||||
|
\ 'left_alt_sep': g:airline_left_alt_sep,
|
||||||
|
\ 'right_sep': g:airline_right_sep,
|
||||||
|
\ 'right_alt_sep': g:airline_right_alt_sep,
|
||||||
|
\ }, 'keep')
|
||||||
return builder
|
return builder
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -8,6 +8,14 @@ let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
|||||||
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s: ')
|
||||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
let s:buf_modified_symbol = g:airline_symbols.modified
|
||||||
|
|
||||||
|
let s:builder_context = {
|
||||||
|
\ 'active' : 1,
|
||||||
|
\ 'left_sep' : get(g:, 'airline#extensions#tabline#left_sep' , g:airline_left_sep),
|
||||||
|
\ 'left_alt_sep' : get(g:, 'airline#extensions#tabline#left_alt_sep' , g:airline_left_alt_sep),
|
||||||
|
\ 'right_sep' : get(g:, 'airline#extensions#tabline#right_sep' , g:airline_right_sep),
|
||||||
|
\ 'right_alt_sep' : get(g:, 'airline#extensions#tabline#right_alt_sep', g:airline_right_alt_sep),
|
||||||
|
\ }
|
||||||
|
|
||||||
function! airline#extensions#tabline#init(ext)
|
function! airline#extensions#tabline#init(ext)
|
||||||
if has('gui_running')
|
if has('gui_running')
|
||||||
set guioptions-=e
|
set guioptions-=e
|
||||||
@ -68,7 +76,7 @@ function! airline#extensions#tabline#get_buffer_name(nr)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_buffers()
|
function! s:get_buffers()
|
||||||
let b = airline#builder#new({'active': 1})
|
let b = airline#builder#new(s:builder_context)
|
||||||
let cur = bufnr('%')
|
let cur = bufnr('%')
|
||||||
for nr in range(1, bufnr('$'))
|
for nr in range(1, bufnr('$'))
|
||||||
if buflisted(nr) && bufexists(nr)
|
if buflisted(nr) && bufexists(nr)
|
||||||
@ -96,7 +104,7 @@ function! s:get_buffers()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_tabs()
|
function! s:get_tabs()
|
||||||
let b = airline#builder#new({'active': 1})
|
let b = airline#builder#new(s:builder_context)
|
||||||
for i in range(1, tabpagenr('$'))
|
for i in range(1, tabpagenr('$'))
|
||||||
let group = i == tabpagenr() ? 'airline_tabsel' : 'airline_tab'
|
let group = i == tabpagenr() ? 'airline_tabsel' : 'airline_tab'
|
||||||
let val = '%('
|
let val = '%('
|
||||||
|
@ -312,6 +312,12 @@ virtualenv <https://github.com/jmcantrell/vim-virtualenv>
|
|||||||
* configure how buffer numbers should be formatted with |printf|. >
|
* configure how buffer numbers should be formatted with |printf|. >
|
||||||
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
|
let g:airline#extensions#tabline#buffer_nr_format = '%s: '
|
||||||
<
|
<
|
||||||
|
* configure separators for the tabline only. >
|
||||||
|
let g:airline#extensions#tabline#left_sep = ''
|
||||||
|
let g:airline#extensions#tabline#left_alt_sep = ''
|
||||||
|
let g:airline#extensions#tabline#right_sep = ''
|
||||||
|
let g:airline#extensions#tabline#right_alt_sep = ''
|
||||||
|
<
|
||||||
Note: Enabling this extension will modify |showtabline| and |guioptions|.
|
Note: Enabling this extension will modify |showtabline| and |guioptions|.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user