[Q] Reload keybinding to retrigger completion from already running fzf
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 ?
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.