diff --git a/bin/fzf-tmux b/bin/fzf-tmux index ffb98d9c..f1fcb091 100755 --- a/bin/fzf-tmux +++ b/bin/fzf-tmux @@ -115,7 +115,7 @@ mkfifo $fifo2 mkfifo $fifo3 if [ -n "$term" -o -t 0 ]; then tmux set-window-option -q synchronize-panes off \;\ - split-window $opt "$envs"' sh -c "'$fzf' '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3' '"$close"'"' $swap + split-window $opt "cd $(printf %q "$PWD");$envs"' sh -c "'$fzf' '"$fzf_args"' > '$fifo2'; echo \$? > '$fifo3' '"$close"'"' $swap else mkfifo $fifo1 tmux set-window-option -q synchronize-panes off \;\ diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index b7c79463..90112475 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -20,7 +20,7 @@ __fsel_tmux() { else height="-l $height" fi - tmux split-window $height "bash -c 'source ~/.fzf.bash; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"'" + tmux split-window $height "cd $(printf %q "$PWD");bash -c 'source ~/.fzf.bash; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"'" } __fcd() { diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index be39e3d5..ce1eea75 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -27,7 +27,8 @@ function fzf_key_bindings function __fzf_ctrl_t if [ -n "$TMUX_PANE" -a "$FZF_TMUX" != "0" ] - tmux split-window (__fzf_tmux_height) "fish -c 'fzf_key_bindings; __fzf_ctrl_t_tmux \\$TMUX_PANE'" + # FIXME need to handle directory with double-quotes + tmux split-window (__fzf_tmux_height) "cd \"$PWD\";fish -c 'fzf_key_bindings; __fzf_ctrl_t_tmux \\$TMUX_PANE'" else __fzf_list | fzf -m > $TMPDIR/fzf.result and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape) diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index 84ba7302..6eb80839 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -22,7 +22,7 @@ if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then else height="-l $height" fi - tmux split-window $height "zsh -c 'source ~/.fzf.zsh; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"'" + tmux split-window $height "cd $(printf %q "$PWD");zsh -c 'source ~/.fzf.zsh; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"'" } else fzf-file-widget() {