Closed tmpm697 closed 3 days ago
You're sequentially running two separate programs from your shell and I don't think it's possible to accomplish seamless transition between the two.
Having said that, you can experiment with --no-clear
(though I don't think it's worth it), and you'll generally have better experience with non-full screen layouts i.e. --height
or --tmux
.
example() {
local result
result=$(fzf --no-clear --no-tmux --no-height)
sleep 2
[[ -n $result ]] && vim "$result"
tput rmcup
}
I simply can't put sleep 2
out of if [[ $key == 'ctrl-h' ]]
dues to I'm processing result
base on the key pressed.
If it's ctrl-h
then do something with result
but else do other things.
I'm not suggesting that you add "sleep" to your script, it doesn't make any sense. I was trying to demonstrate the effect of --no-clear
.
If sleep 2
does not make sense then check this:
test=$(echo "1\n2\n3\n" | fzf --expect 'ctrl-h,ctrl-l')
key=$(head -1 <<< $test)
if [[ $key == 'ctrl-h' ]]; then
cat ./test.txt # this file is 10MB text file
fi
--no-clear
will cause prompt swallow which fzf takes whole prompt and after fzf exit, prompt still black until user manually redraw screen, is there a way to use it without swallow
prompt?
Checklist
man fzf
)Output of
fzf --version
0.53
OS
Shell
Problem / Steps to reproduce
So I found out why fzf causes prompt flick issue, especially with
fzf --expect 'ctrl-h,ctrl-m'
, this dues to users will run other processes base on the key press later after fzf already exit:To fix this, fzf need methods to monitor processes after keys pressed with
--expect
, and make sure only exit fzf if they're all done.I think this is better than requires all shells to give some kind of constraint for a special process (fzf) to aware of others before exit/return.