Add Files command
This commit is contained in:
parent
63fc2490d8
commit
4128925e3e
2 changed files with 29 additions and 0 deletions
|
@ -32,6 +32,7 @@ List of commands
|
||||||
|
|
||||||
| Command | List |
|
| Command | List |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
| `Files [PATH]` | Files (similar to `:FZF`) |
|
||||||
| `Buffers` | Open buffers |
|
| `Buffers` | Open buffers |
|
||||||
| `Colors` | Color schemes |
|
| `Colors` | Color schemes |
|
||||||
| `Ag [PATTERN]` | [ag][ag] search result (`CTRL-A` to select all, `CTRL-D` to deselect all) |
|
| `Ag [PATTERN]` | [ag][ag] search result (`CTRL-A` to select all, `CTRL-D` to deselect all) |
|
||||||
|
|
|
@ -94,6 +94,34 @@ function! s:align_lists(lists)
|
||||||
return a:lists
|
return a:lists
|
||||||
endfunction
|
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
|
" Lines
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue