junegunn / junegunn/fzf.vim

fzf#run() based on the results of fzf#run() + function

Open
#872 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- Category
- [X] Question
- [ ] Bug
- [ ] Suggestion
- OS
- [X] Linux
- [ ] macOS
- [ ] Windows
- [ ] Etc.
- Vim
- [ ] Vim
- [X] Neovim

I'm attempting to use a fzf#run to determine what directory to select, and then launch a GFiles. The actual workflow is to select from a list of git repos, then cd to the selected repo and use GFiles to pick an initial file to open. (This is intended to approximate the emacs/helm/projectile command `helm-projectile-switch-project`.)

I understand that my current implementation, using a sink to launch another FZF completion doesn't work, but I can't figure out if what I want is actually supported without some sort of sleep-style hack. Is there a way to accomplish effectively piping the output one fzf into another?

```
" Current implementation. The problem here is that we run CdGFiles inside of an fzf#run()
" :CdGFiles will cd to and then run GFiles
function! CdGFilesImpl(directory)
exec 'cd' a:directory
GFiles
endfunction
command! -bang -nargs=1 CdGFiles call CdGFilesImpl()

function! ProjectileProject()
call fzf#run(fzf#wrap({'source': 'bash -c "find ~/code -maxdepth 2 -type d -name \"*.git\" -exec dirname {} \; | sort"',
\ 'sink': 'CdGFiles'}))
endfunction
nnoremap pp :call ProjectileProject()
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the fzf#run(), fzf#wrap(), and sink handling used by the CdGFiles command in the Vim integration. Determine whether one fzf invocation can launch another while preserving the selected directory, and define completion by either a supported nested workflow or clear documentation of the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, vim
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.