Fzf: How to go back to the fzf list after editing using vim in `vim (rg -i string . -l | fzf)`

Created on 21 Jun 2019  路  3Comments  路  Source: junegunn/fzf

  • Category

    • [x] fzf binary

    • [ ] fzf-tmux script

    • [ ] Key bindings

    • [ ] Completion

    • [ ] Vim

    • [ ] Neovim

    • [ ] Etc.

  • OS

    • [x] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Windows Subsystem for Linux

    • [ ] Etc.

  • Shell

    • [ ] bash

    • [ ] zsh

    • [x] fish


When I use vim to open the file searched by rg/ag/grep like this:
~
vim (rg -i string . -l | fzf)
~

after if I edit the file using vim, I need to come back to fzf list (include the filter I typed) for me to choose again instead of exiting the entire command, but currently I have to execute vim (rg -i string . -l | fzf) again and type the filter to get the list I wanted, since the command cost a few seconds, it will waste time.

After exiting vim, how can make fzf back to the state before editing using vim(Enter on the chosen file)?

question

Most helpful comment

fzf doesn't maintain persistent state so it's not possible. However, as a workaround, you can consider using execute action using --bind option like so:

rg -i string . -l | fzf --bind 'enter:execute:vim {} < /dev/tty'

All 3 comments

fzf doesn't maintain persistent state so it's not possible. However, as a workaround, you can consider using execute action using --bind option like so:

rg -i string . -l | fzf --bind 'enter:execute:vim {} < /dev/tty'

Thank you, it works
Could you please add a built-in option for fzf to maintain persistent state, it is very useful for a lot of other programs.

No, it's beyond the scope of the project. And it's not really possible because fzf reads from standard input over which we don't have any control.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jan-warchol picture jan-warchol  路  3Comments

sandric picture sandric  路  3Comments

chrisamow picture chrisamow  路  3Comments

olethanh picture olethanh  路  3Comments

erusev picture erusev  路  3Comments