move formatters into their own namespace
This commit is contained in:
parent
1ca6ffb6d0
commit
ca925efdbf
|
@ -134,7 +134,7 @@ function! airline#extensions#tabline#title(n)
|
|||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
||||
return airline#extensions#tabline#{s:formatter}#format(a:nr, s:get_buffer_list())
|
||||
return airline#extensions#tabline#formatters#{s:formatter}#format(a:nr, s:get_buffer_list())
|
||||
endfunction
|
||||
|
||||
function! s:get_buffer_list()
|
||||
|
|
|
@ -7,7 +7,7 @@ let s:buf_nr_format = get(g:, 'airline#extensions#tabline#buffer_nr_format', '%s
|
|||
let s:buf_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
||||
|
||||
function! airline#extensions#tabline#default#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
|
@ -21,10 +21,10 @@ function! airline#extensions#tabline#default#format(bufnr, buffers)
|
|||
endif
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#default#wrap_name(a:bufnr, _)
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#default#wrap_name(bufnr, buffer_name)
|
||||
function! airline#extensions#tabline#formatters#default#wrap_name(bufnr, buffer_name)
|
||||
let _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||
" vim: et ts=2 sts=2 sw=2
|
||||
|
||||
function! airline#extensions#tabline#unique_tail#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#unique_tail#format(bufnr, buffers)
|
||||
let duplicates = {}
|
||||
let tails = {}
|
||||
let map = {}
|
||||
|
@ -15,12 +15,12 @@ function! airline#extensions#tabline#unique_tail#format(bufnr, buffers)
|
|||
let duplicates[nr] = nr
|
||||
endif
|
||||
let tails[tail] = 1
|
||||
let map[nr] = airline#extensions#tabline#default#wrap_name(nr, tail)
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, tail)
|
||||
endif
|
||||
endfor
|
||||
|
||||
for nr in values(duplicates)
|
||||
let map[nr] = airline#extensions#tabline#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
let map[nr] = airline#extensions#tabline#formatters#default#wrap_name(nr, fnamemodify(bufname(nr), ':p:.'))
|
||||
endfor
|
||||
|
||||
return map[a:bufnr]
|
|
@ -5,9 +5,9 @@ scriptencoding utf-8
|
|||
|
||||
let s:skip_symbol = '…'
|
||||
|
||||
function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
|
||||
function! airline#extensions#tabline#formatters#unique_tail_improved#format(bufnr, buffers)
|
||||
if len(a:buffers) <= 1 " don't need to compare bufnames if has less than one buffer opened
|
||||
return airline#extensions#tabline#default#format(a:bufnr, a:buffers)
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
|
||||
let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t')
|
||||
|
@ -84,8 +84,8 @@ function! airline#extensions#tabline#unique_tail_improved#format(bufnr, buffers)
|
|||
call insert(buf_name, s:skip_symbol)
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#default#wrap_name(a:bufnr, join(buf_name, '/'))
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, join(buf_name, '/'))
|
||||
else
|
||||
return airline#extensions#tabline#default#format(a:bufnr, a:buffers)
|
||||
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||
endif
|
||||
endfunction
|
Loading…
Reference in New Issue