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