Add Files command

This commit is contained in:
Junegunn Choi
2015-08-16 00:09:22 +09:00
parent 63fc2490d8
commit 4128925e3e
2 changed files with 29 additions and 0 deletions

View File

@@ -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
" ------------------------------------------------------------------