diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2017-01-08 01:30:31 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-01-08 02:09:56 +0900 |
| commit | 1448d631a7c72905f62dbb343a8f231a1c3cc52c (patch) | |
| tree | 05abfedd2a0777c2640c8259267d3ad855879dfe /shell/key-bindings.zsh | |
| parent | fd137a9e875ba1fd9feed4903e102951f8098c33 (diff) | |
| download | fzf-1448d631a7c72905f62dbb343a8f231a1c3cc52c.tar.gz | |
Add --height option
Diffstat (limited to 'shell/key-bindings.zsh')
| -rw-r--r-- | shell/key-bindings.zsh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index fed01532..7e24d92a 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -17,8 +17,14 @@ __fsel() { return $ret } +__fzf_use_tmux__() { + [ -n "$TMUX_PANE" ] && [ "${FZF_TMUX:-0}" != 0 ] && [ ${LINES:-40} -gt 15 ] +} + __fzfcmd() { - [ ${FZF_TMUX:-1} -eq 1 ] && echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || echo "fzf" + __fzf_use_tmux__ && + echo "fzf-tmux -d${FZF_TMUX_HEIGHT:-40%}" || + echo "fzf --height ${FZF_TMUX_HEIGHT:-40%} --reverse" } fzf-file-widget() { @@ -49,7 +55,7 @@ bindkey '\ec' fzf-cd-widget fzf-history-widget() { local selected num setopt localoptions noglobsubst pipefail 2> /dev/null - selected=( $(fc -l 1 | eval "$(__fzfcmd) +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS -q ${(q)LBUFFER}") ) + selected=( $(fc -l 1 | eval "$(__fzfcmd) +s --tac --no-reverse +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r $FZF_CTRL_R_OPTS -q ${(q)LBUFFER}") ) local ret=$? if [ -n "$selected" ]; then num=$selected[1] |
