diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-22 00:55:39 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-04-22 00:55:39 +0900 |
| commit | 06b4f7568084358fce6927c3bedc6816159607f0 (patch) | |
| tree | 881781e6f767022f673c90f5731bb0513897ffb2 /shell/key-bindings.bash | |
| parent | 318edc8c352250be04a9c2d15f5854084671c3df (diff) | |
| download | fzf-06b4f7568084358fce6927c3bedc6816159607f0.tar.gz | |
Fix broken FZF_TMUX switch and update test cases (#203)
Diffstat (limited to 'shell/key-bindings.bash')
| -rw-r--r-- | shell/key-bindings.bash | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index dfa9bf6e..362e4428 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -12,6 +12,10 @@ __fzf_select__() { if [[ $- =~ i ]]; then +__fzfcmd() { + [ ${FZF_TMUX:-1} -eq 1 ] && echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || echo "fzf" +} + __fzf_select_tmux__() { local height height=${FZF_TMUX_HEIGHT:-40%} @@ -26,11 +30,11 @@ __fzf_select_tmux__() { __fzf_cd__() { local dir dir=$(command find -L ${1:-.} \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \ - -o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf-tmux -d${FZF_TMUX_HEIGHT:-40%} +m) && printf 'cd %q' "$dir" + -o -type d -print 2> /dev/null | sed 1d | cut -b3- | $(__fzfcmd) +m) && printf 'cd %q' "$dir" } __fzf_history__() { - HISTTIMEFORMAT= history | fzf-tmux -d${FZF_TMUX_HEIGHT:-40%} +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r | sed "s/ *[0-9]* *//" + HISTTIMEFORMAT= history | $(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r | sed "s/ *[0-9]* *//" } __use_tmux=0 |
