Make sure to start tmux pane from the current directory (#143)

- fzf-tmux
- CTRL-T of bash/zsh/fish
    - fish implementation may not work if the path contains
      double-quote characters (FIXME)
This commit is contained in:
Junegunn Choi 2015-03-13 22:46:53 +09:00
parent 4977174def
commit c04e8de9b0
4 changed files with 5 additions and 4 deletions

View File

@ -115,7 +115,7 @@ mkfifo $fifo2
mkfifo $fifo3 mkfifo $fifo3
if [ -n "$term" -o -t 0 ]; then if [ -n "$term" -o -t 0 ]; then
tmux set-window-option -q synchronize-panes off \;\ 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 else
mkfifo $fifo1 mkfifo $fifo1
tmux set-window-option -q synchronize-panes off \;\ tmux set-window-option -q synchronize-panes off \;\

View File

@ -20,7 +20,7 @@ __fsel_tmux() {
else else
height="-l $height" height="-l $height"
fi 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() { __fcd() {

View File

@ -27,7 +27,8 @@ function fzf_key_bindings
function __fzf_ctrl_t function __fzf_ctrl_t
if [ -n "$TMUX_PANE" -a "$FZF_TMUX" != "0" ] 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 else
__fzf_list | fzf -m > $TMPDIR/fzf.result __fzf_list | fzf -m > $TMPDIR/fzf.result
and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape) and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)

View File

@ -22,7 +22,7 @@ if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
else else
height="-l $height" height="-l $height"
fi 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 else
fzf-file-widget() { fzf-file-widget() {