Skip to content
Myr

Apply fzf-tmux to key bindings (#203)

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

Note that CTRL-T on bash is still using the old trick of send-keys.

authored by Junegunn Choi · committed by Junegunn Choi · parent 651a8f8 · Browse files · 3 files+31 added−57 removed
This commit

State

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

Diff stats

3 files+31 added−57 removed

  • other:+31 added−57 removed

3 files+31 added−57 removed

modified:shell/key-bindings.bash+17 added-13 removed
modified:shell/key-bindings.fish+7 added-24 removed
24 unmodified lines
25 end26 end2728 function __fzf_ctrl_t29 if [ -n "$TMUX_PANE" -a "$FZF_TMUX" != "0" ]30 # FIXME need to handle directory with double-quotes31 tmux split-window (__fzf_tmux_height) "cd \"$PWD\";fish -c 'fzf_key_bindings; __fzf_ctrl_t_tmux \\$TMUX_PANE'"32 else33 __fzf_list | fzf -m > $TMPDIR/fzf.result34 and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)35 commandline -f repaint29 __fzf_list | fzf-tmux (__fzf_tmux_height) -m > $TMPDIR/fzf.result30 and commandline -i (cat $TMPDIR/fzf.result | __fzf_escape)31 commandline -f repaint36 rm -f $TMPDIR/fzf.result37 end38 end3940 function __fzf_ctrl_t_tmux41 __fzf_list | fzf -m > $TMPDIR/fzf.result42 and tmux send-keys -t $argv[1] (cat $TMPDIR/fzf.result | __fzf_escape)32 rm -f $TMPDIR/fzf.result33 end3435 function __fzf_ctrl_r47 history | fzf +s +m --tiebreak=index --toggle-sort=ctrl-r > $TMPDIR/fzf.result36 history | fzf-tmux (__fzf_tmux_height) +s +m --tiebreak=index --toggle-sort=ctrl-r > $TMPDIR/fzf.result37 and commandline (cat $TMPDIR/fzf.result)38 commandline -f repaint39 rm -f $TMPDIR/fzf.result40 end4142 function __fzf_alt_c43 # Fish hangs if the command before pipe redirects (2> /dev/null)55 __fzf_list_dir | fzf +m > $TMPDIR/fzf.result44 __fzf_list_dir | fzf-tmux (__fzf_tmux_height) +m > $TMPDIR/fzf.result45 [ (cat $TMPDIR/fzf.result | wc -l) -gt 0 ]46 and cd (cat $TMPDIR/fzf.result)47 commandline -f repaint48 rm -f $TMPDIR/fzf.result49 end5051 function __fzf_tmux_height52 if set -q FZF_TMUX_HEIGHT64 set height $FZF_TMUX_HEIGHT53 echo "-d$FZF_TMUX_HEIGHT"54 else66 set height 40%55 echo "-d40%"56 end68 if echo $height | \grep -q -E '%$'69 echo "-p "(echo $height | sed 's/%$//')70 else71 echo "-l $height"72 end73 set -e height57 end5859 bind \ct '__fzf_ctrl_t'60 bind \cr '__fzf_ctrl_r'
3 unmodified lines
modified:shell/key-bindings.zsh+7 added-20 removed