Skip to content
Myr

Merge pull request #433 from pokey/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Support fzf-tmux when zoomed

authored by Junegunn Choi · committed by Junegunn Choi · parents a1db64e, d513a21 · Browse files · 2 files+19 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−7 removed

  • other:+19 added−7 removed

2 files+19 added−7 removed

modified:bin/fzf-tmux+17 added-1 removed
80 unmodified lines
81 esac82 shift83done8485if [ -z "$TMUX_PANE" ] || tmux list-panes -F '#F' | grep -q Z; then85if [ -z "$TMUX_PANE" ]; then86 fzf "${args[@]}"87 exit $?88fi8990# Handle zoomed tmux pane by moving it to a temp window91if tmux list-panes -F '#F' | grep -q Z; then92 zoomed=193 original_window=$(tmux display-message -p "#{window_id}")94 tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - \\\\; do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'")95 tmux swap-pane -t $tmp_window \; select-window -t $tmp_window96fi9798set -e99100# Clean up named pipes on exit101id=$RANDOM
2 unmodified lines
104fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"105fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"106cleanup() {107 rm -f $argsf $fifo1 $fifo2 $fifo3108109 # Remove temp window if we were zoomed110 if [ -n "$zoomed" ]; then111 tmux swap-pane -t $original_window \; \112 select-window -t $original_window \; \113 kill-window -t $tmp_window \; \114 resize-pane -Z115 fi116}117trap cleanup EXIT SIGINT SIGTERM118119fail() {
35 unmodified lines
modified:plugin/fzf.vim+2 added-6 removed
50 unmodified lines
51 endif52 return s:exec53endfunction5455function! s:tmux_not_zoomed()56 return system('tmux list-panes -F "#F"') !~# 'Z'57endfunction5855function! s:tmux_enabled()56 if has('gui_running')57 return 058 endif5960 if exists('s:tmux')65 return s:tmux && s:tmux_not_zoomed()61 return s:tmux62 endif6364 let s:tmux = 065 if exists('$TMUX') && executable(s:fzf_tmux)66 let output = system('tmux -V')67 let s:tmux = !v:shell_error && output >= 'tmux 1.7'68 endif73 return s:tmux && s:tmux_not_zoomed()69 return s:tmux70endfunction7172function! s:shellesc(arg)73 return '"'.substitute(a:arg, '"', '\\"', 'g').'"'
370 unmodified lines