mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 15:59:23 +08:00
Merge pull request #736 from lawm/truncate
tabline: add fnametruncate option to truncate long tab/buffer names
This commit is contained in:
commit
f45ecdac15
|
@ -3,6 +3,7 @@
|
|||
|
||||
let s:fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':~:.')
|
||||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
let s:fnametruncate = get(g:, 'airline#extensions#tabline#fnametruncate', 0)
|
||||
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
|
||||
|
@ -19,6 +20,9 @@ function! airline#extensions#tabline#formatters#default#format(bufnr, buffers)
|
|||
else
|
||||
let _ .= fnamemodify(name, s:fmod)
|
||||
endif
|
||||
if a:bufnr != bufnr('%') && s:fnametruncate && strlen(_) > s:fnametruncate
|
||||
let _ = strpart(_, 0, s:fnametruncate)
|
||||
endif
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
|
|
|
@ -489,6 +489,9 @@ exposed.
|
|||
<
|
||||
* configure collapsing parent directories in buffer name. >
|
||||
let g:airline#extensions#tabline#fnamecollapse = 1
|
||||
<
|
||||
* configure truncating non-active buffer names to specified length. >
|
||||
let g:airline#extensions#tabline#fnametruncate = 0
|
||||
|
||||
" The `unique_tail` algorithm will display the tail of the filename, unless
|
||||
" there is another file of the same name, in which it will display it along
|
||||
|
|
Loading…
Reference in New Issue
Block a user