Fzf: Resume old query in vim

Created on 12 Oct 2015  路  4Comments  路  Source: junegunn/fzf

I looked, and it doesn't look like there is anyway to resume an old query (specifically in VIM).

This could easily be implemented as a cli switch IMO:

fzf --resume

Similar to the Unite.vim implementation.

Any ideas/alternatives are welcome.

Most helpful comment

So you mean you want to use the same query again? fzf basically does not have persistent state unless you use --history option to save the history. There are several ways to achieve what you want:

  1. Use --history option (e.g. add it to $FZF_DEFAULT_OPTS). Start fzf and press CTRL-P (mapped to previous-history action when --history is set)
  2. If you want to avoid pressing CTRL-P, you can read the last line of the saved history file and use --query option to start fzf with the previous query
  3. Instead of using --history, you can use --print-query option to get the query on exit and restart fzf with --query option.

So it's possible. Maybe it's not as easy as unite.vim? But I have no desire to compete with that :) Note that I try not to add any more command-line switches at this point unless absolutely necessary since I think fzf already has too many options.

All 4 comments

So you mean you want to use the same query again? fzf basically does not have persistent state unless you use --history option to save the history. There are several ways to achieve what you want:

  1. Use --history option (e.g. add it to $FZF_DEFAULT_OPTS). Start fzf and press CTRL-P (mapped to previous-history action when --history is set)
  2. If you want to avoid pressing CTRL-P, you can read the last line of the saved history file and use --query option to start fzf with the previous query
  3. Instead of using --history, you can use --print-query option to get the query on exit and restart fzf with --query option.

So it's possible. Maybe it's not as easy as unite.vim? But I have no desire to compete with that :) Note that I try not to add any more command-line switches at this point unless absolutely necessary since I think fzf already has too many options.

Thanks! That should work perfectly :D

Didn't know about the --history option

Unfortunately it does not work perfectly. The previous candidate selection is reset. "--history" should save the current candidate along with the search pattern.

@MichaelMackus check out my fork:
https://github.com/mrbiggfoot/fzf

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jan-warchol picture jan-warchol  路  3Comments

chrisamow picture chrisamow  路  3Comments

firedev picture firedev  路  3Comments

olethanh picture olethanh  路  3Comments

lbeier picture lbeier  路  3Comments