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.
13 lines
411 B
Text
13 lines
411 B
Text
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
|