Merge pull request #1898 from clobrano/short-path-formatter
Add formatter for short paths
This commit is contained in:
commit
773f0e3637
@ -0,0 +1,19 @@
|
|||||||
|
" MIT License. Copyright (c) 2013-2019 Bailey Ling et al.
|
||||||
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||||
|
|
||||||
|
function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers)
|
||||||
|
let _ = ''
|
||||||
|
|
||||||
|
let name = bufname(a:bufnr)
|
||||||
|
if empty(name)
|
||||||
|
let _ .= '[No Name]'
|
||||||
|
else
|
||||||
|
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||||
|
endfunction
|
@ -976,7 +976,15 @@ with the middle mouse button to delete that buffer.
|
|||||||
" The `unique_tail_improved` - another algorithm, that will smartly uniquify
|
" The `unique_tail_improved` - another algorithm, that will smartly uniquify
|
||||||
" buffers names with similar filename, suppressing common parts of paths.
|
" buffers names with similar filename, suppressing common parts of paths.
|
||||||
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||||||
<
|
|
||||||
|
" The `short_path` - is a simple formatter, that will show the
|
||||||
|
filename, with its extension, and the first parent directory only.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
/home/user/project/subdir/file.ext -> subdir/file.ext
|
||||||
|
|
||||||
|
let g:airline#extensions#tabline#formatter = 'short_path'
|
||||||
|
|
||||||
* configure the minimum number of buffers needed to show the tabline. >
|
* configure the minimum number of buffers needed to show the tabline. >
|
||||||
let g:airline#extensions#tabline#buffer_min_count = 0
|
let g:airline#extensions#tabline#buffer_min_count = 0
|
||||||
<
|
<
|
||||||
|
Loading…
x
Reference in New Issue
Block a user