As in #368, this is a clone of a feature existing in CtrlP. Imagine I'm working on a project with this structure:
โโโ .git
โโโ module1
โย ย โโโ bang
โโโ module2
โย ย โโโ boom
โโโ module3
ย ย โโโ twang
If I am editing module3/twang, and I use FZF, I cannot see any files outside of module3/. CtrlP will traverse up the directory tree until it finds a .git, .svn, .hv, etc. folder. This means that any project that is under version control can easily be traversed using only this one navigation tool. Would it be possible to add something similar to FZF? If not in the standard options, perhaps with some additional configuration by the users?
Are you using autochdir? If so I suggest not doing that, it's a legacy option that should not be used.
Something like this?
function! s:find_root()
for vcs in ['.git', '.svn', '.hg']
let dir = finddir(vcs.'/..', ';')
if !empty(dir)
execute 'FZF' dir
return
endif
endfor
FZF
endfunction
command! FZFR call s:find_root()
FZF -> Files if you have fzf.vim projectgit rev-parse --show-toplevelfzf#run() directly if you need more controlThanks guys.
Closed #369
On Wed, Oct 7, 2015 at 3:40 AM Junegunn Choi [email protected]
wrote:
Something like this?
function! s:find_root()
for vcs in ['.git', '.svn', '.hg']
let dir = finddir(vcs.'/..', ';')
if !empty(dir)
execute 'FZF' dir
return
endif
endfor
FZFendfunction
command! FZFR call s:find_root()
- FZF -> Files if you have fzf.vim project
- Using VCS-specific commands to find the root should give more
accurate results
- e.g. git rev-parse --show-toplevel
- You can consider using the low-level fzf#run() directly if you need
more controlโ
Reply to this email directly or view it on GitHub
https://github.com/junegunn/fzf/issues/369#issuecomment-146053423.
Most helpful comment
Something like this?
FZF->Filesif you have fzf.vim projectgit rev-parse --show-toplevelfzf#run()directly if you need more control