mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-23 22:15:28 +02:00
[fix] issue #2338
add check airline_stl_path_style's flag and pathshortln api
This commit is contained in:
parent
a94d8034c3
commit
ec4bbabe4a
@ -12,7 +12,7 @@ function! s:ModifierFlags()
|
|||||||
return (exists("+autochdir") && &autochdir) ? ':p' : ':.'
|
return (exists("+autochdir") && &autochdir) ? ':p' : ':.'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#fugitiveline#bufname()
|
function! airline#extensions#fugitiveline#bufname() abort
|
||||||
if !exists('b:fugitive_name')
|
if !exists('b:fugitive_name')
|
||||||
let b:fugitive_name = ''
|
let b:fugitive_name = ''
|
||||||
try
|
try
|
||||||
@ -49,13 +49,21 @@ function! s:sh_autocmd_handler()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#extensions#fugitiveline#init(ext)
|
function! airline#extensions#fugitiveline#init(ext) abort
|
||||||
if exists("+autochdir") && &autochdir
|
if exists("+autochdir") && &autochdir
|
||||||
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
" if 'acd' is set, vim-airline uses the path section, so we need to redefine this here as well
|
||||||
|
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||||
|
call airline#parts#define_raw('path', '%<%{pathshorten(airline#extensions#fugitiveline#bufname())}%m')
|
||||||
|
else
|
||||||
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
call airline#parts#define_raw('path', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if get(g:, 'airline_stl_path_style', 'default') ==# 'short'
|
||||||
|
call airline#parts#define_raw('file', '%<%{pathshorten(airline#extensions#fugitiveline#bufname())}%m')
|
||||||
else
|
else
|
||||||
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
call airline#parts#define_raw('file', '%<%{airline#extensions#fugitiveline#bufname()}%m')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
autocmd ShellCmdPost,CmdwinLeave * call s:sh_autocmd_handler()
|
autocmd ShellCmdPost,CmdwinLeave * call s:sh_autocmd_handler()
|
||||||
autocmd User AirlineBeforeRefresh call s:sh_autocmd_handler()
|
autocmd User AirlineBeforeRefresh call s:sh_autocmd_handler()
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user