mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-03-01 21:07:01 +08:00
[Files] Fix path display when cwd is ~
This commit is contained in:
@@ -234,6 +234,11 @@ endfunction
|
|||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
" Files
|
" Files
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
function! s:shortpath()
|
||||||
|
let short = pathshorten(fnamemodify(getcwd(), ':~:.'))
|
||||||
|
return empty(short) ? '~/' : short . (short =~ '/$' ? '' : '/')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fzf#vim#files(dir, ...)
|
function! fzf#vim#files(dir, ...)
|
||||||
let args = {'options': '-m '.get(g:, 'fzf_files_options', '')}
|
let args = {'options': '-m '.get(g:, 'fzf_files_options', '')}
|
||||||
if !empty(a:dir)
|
if !empty(a:dir)
|
||||||
@@ -244,7 +249,7 @@ function! fzf#vim#files(dir, ...)
|
|||||||
let args.dir = dir
|
let args.dir = dir
|
||||||
let args.options .= ' --prompt '.shellescape(dir)
|
let args.options .= ' --prompt '.shellescape(dir)
|
||||||
else
|
else
|
||||||
let args.options .= ' --prompt '.shellescape(pathshorten(fnamemodify(getcwd(), ':~:.')).'/')
|
let args.options .= ' --prompt '.shellescape(s:shortpath())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return s:fzf('files', args, a:000)
|
return s:fzf('files', args, a:000)
|
||||||
|
|||||||
Reference in New Issue
Block a user