From 7d5154ae680f8713938435943d9a8fddabefee0d Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 2 Nov 2015 10:17:56 +0900 Subject: [PATCH] [GitFiles] List files from project root --- autoload/fzf/vim.vim | 6 ++++++ 1 file changed, 6 insertions(+) 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)