void-packages/srcpkgs/fzf/files/fzf-file-widget
Dominik Honnef bc693d1375 fzf: fix fzf-file-widget, improve template
fzf-file-widget had several mistakes:

1) It was missing zsh -c for the tmux command to run
2) the fsel function wasn't accessible from the shell we spawned in the
new tmux pane

We solved the second issue by converting the function to an executable
fzf-fsel. We also patched the bash key bindings to make use of that
executable.

While we were at it, we improved the template by setting wrksrc
correctly and cd'ing in pre_build.
2015-04-18 05:21:23 +02:00

14 lines
411 B
Plaintext

if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
local height
height=${FZF_TMUX_HEIGHT:-40%}
if [[ $height =~ %$ ]]; then
height="-p ${height%\%}"
else
height="-l $height"
fi
tmux split-window $height "cd $(printf %q "$PWD"); zsh -c 'tmux send-keys -t $TMUX_PANE \"\$(fzf-fsel)\"'"
else
LBUFFER="${LBUFFER}$(fzf-fsel)"
zle redisplay
fi