diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 8a028d4..42bc72b 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -328,8 +328,14 @@ endfunction " ------------------------------------------------------------------ function! fzf#vim#gitfiles(...) + let root = systemlist('git rev-parse --show-toplevel')[0] + if v:shell_error + call s:warn('Not in git repo') + return + endif call s:fzf({ \ 'source': 'git ls-tree --name-only -r HEAD', + \ 'dir': root, \ 'sink*': s:function('s:common_sink'), \ 'options': '--prompt "GitFiles> " -m'.s:expect(), \}, a:000)