fzf-tab icon indicating copy to clipboard operation
fzf-tab copied to clipboard

[Q] Reload keybinding to retrigger completion from already running fzf

Open shadarim opened this issue 3 years ago • 1 comments

FZF has a reload action, which would execute a given command and load the results back in fzf. How do I replicate this with fzf-tab ?

Example use would be with: kill -9 <tab> and from within the completion hit Ctrl-R to reload the process list.

I can bind the reload as follows: zstyle ':fzf-tab:complete:*' fzf-bindings 'ctrl-r:reload(ps -ef)' and this does indeed reload the process list, but with some unwanted side effects:

  • list is not searchable anymore
  • color changes
  • selecting an entry is not outputting anything into the terminal anymore.

I guess this is because the newly generated list is not fed into fzf-tab as completions ? Any hints on how to get the desired behavior ?

shadarim avatar Oct 04 '22 19:10 shadarim

This is very hard.

You have to spawn a new zsh process to generate the new reuslt, and feed ${TMPPREFIX:-/tmp/zsh}-fzf-tab-$USER/completions.$$ to fzf.

Aloxaf avatar Oct 13 '22 02:10 Aloxaf