mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-01-18 09:05:15 +08:00
Add Files command
This commit is contained in:
@@ -94,6 +94,34 @@ function! s:align_lists(lists)
|
||||
return a:lists
|
||||
endfunction
|
||||
|
||||
" ------------------------------------------------------------------
|
||||
" Files
|
||||
" ------------------------------------------------------------------
|
||||
function! s:files(dir, bang)
|
||||
let args = {
|
||||
\ 'sink*': function('s:common_sink'),
|
||||
\ 'options': '-m'.s:expect()
|
||||
\}
|
||||
|
||||
if !empty(a:dir)
|
||||
if !isdirectory(expand(a:dir))
|
||||
echohl WarningMsg
|
||||
echom 'Invalid directory'
|
||||
echohl None
|
||||
return
|
||||
endif
|
||||
let dir = substitute(a:dir, '/*$', '/', '')
|
||||
let args.dir = dir
|
||||
let args.options .= ' --prompt '.shellescape(dir)
|
||||
else
|
||||
let args.options .= ' --prompt "./"'
|
||||
endif
|
||||
|
||||
call s:fzf(args, a:bang)
|
||||
endfunction
|
||||
|
||||
command! -bang -nargs=? -complete=dir Files call s:files(<q-args>, <bang>0)
|
||||
|
||||
" ------------------------------------------------------------------
|
||||
" Lines
|
||||
" ------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user