[fzf-tmux] Fall back to plain fzf when split failed
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent 8fbed2b · Browse files · 6 files·+7 added−8 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+7 added−8 removed
- tests:+0 added−1 removed
- other:+7 added−7 removed
Provenance
- Commit
540bfd7- Tree
1c46146- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
8fbed2b
6 files changed+7 added−8 removed
modified:bin/fzf-tmux+3 added-3 removed
128 unmodified lines129 esac130 [[ -n "$skip" ]] && args+=("$arg")131 done132 133-if [[ -z "$TMUX" || "$opt" =~ ^-h && "$columns" -le 40 || ! "$opt" =~ ^-h && "$lines" -le 15 ]]; then133+if [[ -z "$TMUX" ]]; then134 "$fzf" "${args[@]}"135 exit $?136 fi137 83 unmodified lines221 cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf222 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\223 set-window-option remain-on-exit off \;\224 split-window $opt "${tmux_args[@]}" "$envs bash -c 'cd $(printf %q "$PWD"); exec -a fzf bash $argsf'" $swap \225- > /dev/null 2>&1225+ > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }226 else227 mkfifo $fifo1228 cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf229 TMUX=$(echo $TMUX | cut -d , -f 1,2) tmux set-window-option synchronize-panes off \;\230 set-window-option remain-on-exit off \;\231 split-window $opt "${tmux_args[@]}" "$envs bash -c 'exec -a fzf bash $argsf'" $swap \232- > /dev/null 2>&1232+ > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }233 cat <&0 > $fifo1 &234 fi235 cat $fifo2236 exit "$(cat $fifo3)"modified:shell/completion.bash+1 added-1 removed
35 unmodified lines36 37 __fzf_comprun() {38 if [ "$(type -t _fzf_comprun 2>&1)" = function ]; then39 _fzf_comprun "$@"40- elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then40+ elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then41 shift42 fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- "$@"43 else44 shift321 unmodified linesmodified:shell/completion.zsh+1 added-1 removed
97 unmodified lines98 99 __fzf_comprun() {100 if [[ "$(type _fzf_comprun 2>&1)" =~ function ]]; then101 _fzf_comprun "$@"102- elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then102+ elif [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "$FZF_TMUX_OPTS" ]; }; then103 shift104 fzf-tmux ${(Q)${(Z+n+)FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}}} -- "$@"105 else106 shift207 unmodified linesmodified:shell/key-bindings.bash+1 added-1 removed
25 unmodified lines2627282930303132333462 unmodified lines25 unmodified lines
if [[ $- =~ i ]]; then
__fzfcmd() { [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] || [ -n "$FZF_TMUX_OPTS" ]; } && [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "$FZF_TMUX_OPTS" ]; } && echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"}
fzf-file-widget() {62 unmodified linesmodified:shell/key-bindings.zsh+1 added-1 removed
52 unmodified lines53 return $ret54 }55 56 __fzfcmd() {57- [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] || [ -n "$FZF_TMUX_OPTS" ]; } &&57+ [ -n "$TMUX_PANE" ] && { [ "${FZF_TMUX:-0}" != 0 ] || [ -n "$FZF_TMUX_OPTS" ]; } &&58 echo "fzf-tmux ${FZF_TMUX_OPTS:--d${FZF_TMUX_HEIGHT:-40%}} -- " || echo "fzf"59 }60 61 fzf-file-widget() {60 unmodified linesmodified:test/test_go.rb-1 removed
2034 unmodified lines2035 tmux.until { |lines| lines[-1].include? 'unset FZFFOOBAR' }2036 tmux.send_keys 'C-c'2037 2038 # FZF_TMUX=12039- skip 'screen size too small' if `tput lines`.to_i < 152039 new_shell2040 tmux.focus2041 tmux.send_keys 'unset FZFFOOBR**', :Tab2042 tmux.until { |lines| lines.match_count == 1 }171 unmodified lines