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
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#tabline#get_buffer_name(nr)
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:get_buffer_list()
|
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_nr_show = get(g:, 'airline#extensions#tabline#buffer_nr_show', 0)
|
||||||
let s:buf_modified_symbol = g:airline_symbols.modified
|
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 _ = ''
|
||||||
|
|
||||||
let name = bufname(a:bufnr)
|
let name = bufname(a:bufnr)
|
||||||
@ -21,10 +21,10 @@ function! airline#extensions#tabline#default#format(bufnr, buffers)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return airline#extensions#tabline#default#wrap_name(a:bufnr, _)
|
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||||
endfunction
|
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 _ = s:buf_nr_show ? printf(s:buf_nr_format, a:bufnr) : ''
|
||||||
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
let _ .= substitute(a:buffer_name, '\\', '/', 'g')
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
" MIT License. Copyright (c) 2013-2015 Bailey Ling.
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" 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 duplicates = {}
|
||||||
let tails = {}
|
let tails = {}
|
||||||
let map = {}
|
let map = {}
|
||||||
@ -15,12 +15,12 @@ function! airline#extensions#tabline#unique_tail#format(bufnr, buffers)
|
|||||||
let duplicates[nr] = nr
|
let duplicates[nr] = nr
|
||||||
endif
|
endif
|
||||||
let tails[tail] = 1
|
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
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for nr in values(duplicates)
|
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
|
endfor
|
||||||
|
|
||||||
return map[a:bufnr]
|
return map[a:bufnr]
|
@ -5,9 +5,9 @@ scriptencoding utf-8
|
|||||||
|
|
||||||
let s:skip_symbol = '…'
|
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
|
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
|
endif
|
||||||
|
|
||||||
let curbuf_tail = fnamemodify(bufname(a:bufnr), ':t')
|
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)
|
call insert(buf_name, s:skip_symbol)
|
||||||
endif
|
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
|
else
|
||||||
return airline#extensions#tabline#default#format(a:bufnr, a:buffers)
|
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
Loading…
x
Reference in New Issue
Block a user