Merge pull request #2187 from kazukazuinaina/add_section_c_short_path

[add] short_path formatter in section_c
This commit is contained in:
Christian Brabandt 2020-08-03 12:21:44 +02:00 committed by GitHub
commit a836e09e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,8 @@
scriptencoding utf-8
function! airline#formatter#short_path#format(val) abort
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
return '%{pathshorten(expand("'.a:val.'"))}%'
endif
return a:val
endfunction

View File

@ -146,7 +146,7 @@ function! airline#init#bootstrap()
\ 'function': 'airline#parts#readonly',
\ 'accent': 'red',
\ })
call airline#parts#define_raw('file', '%f%m')
call airline#parts#define_raw('file', airline#formatter#short_path#format('%f%m'))
call airline#parts#define_raw('path', '%F%m')
call airline#parts#define('linenr', {
\ 'raw': '%{g:airline_symbols.linenr}%l',