Add GitFiles command

This commit is contained in:
Ilia Choly 2015-10-30 12:05:54 -04:00 committed by Ilia Choly
parent 0e995e1913
commit 1a2d597045
4 changed files with 15 additions and 0 deletions

View file

@ -49,6 +49,7 @@ Commands
| Command | List |
| --- | --- |
| `Files [PATH]` | Files (similar to `:FZF`) |
| `GitFiles` | Git files
| `Buffers` | Open buffers |
| `Colors` | Color schemes |
| `Ag [PATTERN]` | [ag][ag] search result (`CTRL-A` to select all, `CTRL-D` to deselect all) |

View file

@ -323,6 +323,18 @@ function! fzf#vim#history(...)
\}, a:000)
endfunction
" ------------------------------------------------------------------
" GitFiles
" ------------------------------------------------------------------
function! fzf#vim#gitfiles(...)
call s:fzf({
\ 'source': 'git ls-tree --name-only -r HEAD',
\ 'sink*': s:function('s:common_sink'),
\ 'options': '--prompt "GitFiles> " -m'.s:expect(),
\}, a:000)
endfunction
" ------------------------------------------------------------------
" Buffers
" ------------------------------------------------------------------

View file

@ -75,6 +75,7 @@ COMMANDS *fzf-vim-commands*
Command | List ~
-----------------+---------------------------------------------------------------------
`Files[PATH]` | Files (similar to `:FZF` )
`GitFiles` | Git files
`Buffers` | Open buffers
`Colors` | Color schemes
`Ag[PATTERN]` | {ag}{5} search result (CTRL-A to select all, CTRL-D to deselect all)

View file

@ -43,6 +43,7 @@ endfunction
call s:defs([
\'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, s:w(<bang>0))',
\'command! -bang GitFiles call fzf#vim#gitfiles(s:w(<bang>0))',
\'command! -bang Buffers call fzf#vim#buffers(s:w(<bang>0))',
\'command! -bang Lines call fzf#vim#lines(s:w(<bang>0))',
\'command! -bang BLines call fzf#vim#buffer_lines(s:w(<bang>0))',