From 546a3158849b0ef7c627b44246728ab0f3d67ccd Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 1 Apr 2014 08:49:49 +0000 Subject: [PATCH] Fix #34: tmux integration on Linux --- install | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/install b/install index 963d441..48808dd 100755 --- a/install +++ b/install @@ -100,7 +100,7 @@ EOF # ------------ if [[ $- =~ i ]]; then -read -r -d '' __fsel <<'EOF' +__fsel() { find * -path '*/\.*' -prune \ -o -type f -print \ -o -type d -print \ @@ -108,10 +108,6 @@ read -r -d '' __fsel <<'EOF' printf '%q ' "$item" done echo -EOF - -__fsel() { - eval "$__fsel" } __fsel_tmux() { @@ -122,7 +118,7 @@ __fsel_tmux() { else height="-l $height" fi - tmux split-window $height "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\"" + tmux split-window $height "bash -ci 'source ~/.fzf.bash; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"'" } __fcd() { @@ -177,7 +173,7 @@ EOFZF # Key bindings # ------------ # CTRL-T - Paste the selected file path(s) into the command line -read -r -d '' __fsel <<'EOF' +__fsel() { find * -path '*/\.*' -prune \ -o -type f -print \ -o -type d -print \ @@ -185,7 +181,7 @@ read -r -d '' __fsel <<'EOF' printf '%q ' "$item" done echo -EOF +} if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then fzf-file-widget() { @@ -196,11 +192,11 @@ 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 "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\"" + tmux split-window $height "source ~/.fzf.zsh; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\"" } else fzf-file-widget() { - LBUFFER="${LBUFFER%% #}$(eval "$__fsel")" + LBUFFER="${LBUFFER%% #}$(__fsel)" zle redisplay } fi