mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-16 10:15:09 +00:00
Merge pull request #35 from junegunn/fix-tmux-on-linux
Fix #34: tmux integration on Linux
This commit is contained in:
commit
d83febea46
16
install
16
install
@ -100,7 +100,7 @@ EOF
|
|||||||
# ------------
|
# ------------
|
||||||
if [[ $- =~ i ]]; then
|
if [[ $- =~ i ]]; then
|
||||||
|
|
||||||
read -r -d '' __fsel <<'EOF'
|
__fsel() {
|
||||||
find * -path '*/\.*' -prune \
|
find * -path '*/\.*' -prune \
|
||||||
-o -type f -print \
|
-o -type f -print \
|
||||||
-o -type d -print \
|
-o -type d -print \
|
||||||
@ -108,10 +108,6 @@ read -r -d '' __fsel <<'EOF'
|
|||||||
printf '%q ' "$item"
|
printf '%q ' "$item"
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
EOF
|
|
||||||
|
|
||||||
__fsel() {
|
|
||||||
eval "$__fsel"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__fsel_tmux() {
|
__fsel_tmux() {
|
||||||
@ -122,7 +118,7 @@ __fsel_tmux() {
|
|||||||
else
|
else
|
||||||
height="-l $height"
|
height="-l $height"
|
||||||
fi
|
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() {
|
__fcd() {
|
||||||
@ -177,7 +173,7 @@ EOFZF
|
|||||||
# Key bindings
|
# Key bindings
|
||||||
# ------------
|
# ------------
|
||||||
# CTRL-T - Paste the selected file path(s) into the command line
|
# CTRL-T - Paste the selected file path(s) into the command line
|
||||||
read -r -d '' __fsel <<'EOF'
|
__fsel() {
|
||||||
find * -path '*/\.*' -prune \
|
find * -path '*/\.*' -prune \
|
||||||
-o -type f -print \
|
-o -type f -print \
|
||||||
-o -type d -print \
|
-o -type d -print \
|
||||||
@ -185,7 +181,7 @@ read -r -d '' __fsel <<'EOF'
|
|||||||
printf '%q ' "$item"
|
printf '%q ' "$item"
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
EOF
|
}
|
||||||
|
|
||||||
if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
|
if [ -n "$TMUX_PANE" -a ${FZF_TMUX:-1} -ne 0 -a ${LINES:-40} -gt 15 ]; then
|
||||||
fzf-file-widget() {
|
fzf-file-widget() {
|
||||||
@ -196,11 +192,11 @@ 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 "tmux send-keys -t $TMUX_PANE \"\$($__fsel)\""
|
tmux split-window $height "source ~/.fzf.zsh; tmux send-keys -t $TMUX_PANE \"\$(__fsel)\""
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fzf-file-widget() {
|
fzf-file-widget() {
|
||||||
LBUFFER="${LBUFFER%% #}$(eval "$__fsel")"
|
LBUFFER="${LBUFFER%% #}$(__fsel)"
|
||||||
zle redisplay
|
zle redisplay
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user