mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 02:09:48 +08:00
Merge pull request #2611 from uridium/master
Allow to define own path for short_path formatter
This commit is contained in:
commit
9e2d021fc6
|
@ -6,6 +6,7 @@ scriptencoding utf-8
|
|||
let s:fnamecollapse = get(g:, 'airline#extensions#tabline#fnamecollapse', 1)
|
||||
|
||||
function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers)
|
||||
let fmod = get(g:, 'airline#extensions#tabline#fnamemod', ':p:h:t')
|
||||
let _ = ''
|
||||
|
||||
let name = bufname(a:bufnr)
|
||||
|
@ -15,7 +16,7 @@ function! airline#extensions#tabline#formatters#short_path#format(bufnr, buffers
|
|||
" Neovim Terminal
|
||||
let _ = substitute(name, '\(term:\)//.*:\(.*\)', '\1 \2', '')
|
||||
else
|
||||
let _ .= fnamemodify(name, ':p:h:t') . '/' . fnamemodify(name, ':t')
|
||||
let _ .= fnamemodify(name, fmod) . '/' . fnamemodify(name, ':t')
|
||||
endif
|
||||
|
||||
return airline#extensions#tabline#formatters#default#wrap_name(a:bufnr, _)
|
||||
|
|
|
@ -1321,6 +1321,13 @@ Note: Not displayed if the number of tabs is less than 1
|
|||
|
||||
let g:airline#extensions#tabline#formatter = 'short_path'
|
||||
|
||||
" `short_path` can also display file name as relative to the current
|
||||
" directory, if possible
|
||||
let g:airline#extensions#tabline#fnamemod = ':h'
|
||||
|
||||
" or display file name as relative to the home directory, if possible
|
||||
let g:airline#extensions#tabline#fnamemod = ':~:h'
|
||||
|
||||
* defines the customized format() function to display tab title in tab mode. >
|
||||
let g:airline#extensions#tabline#tabtitle_formatter = 'MyTabTitleFormatter'
|
||||
<
|
||||
|
|
Loading…
Reference in New Issue
Block a user