diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fd89e5..c3399fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ CHANGELOG ========= +0.9.9 +----- + +### New features + +- Added `--tiebreak` option (#191) +- Added `--no-hscroll` option (#193) + 0.9.8 ----- diff --git a/install b/install index c47b6ec..c27470c 100755 --- a/install +++ b/install @@ -1,6 +1,6 @@ #!/usr/bin/env bash -version=0.9.8 +version=0.9.9 cd $(dirname $BASH_SOURCE) fzf_base=$(pwd) diff --git a/shell/completion.bash b/shell/completion.bash index 04287a6..62dc140 100644 --- a/shell/completion.bash +++ b/shell/completion.bash @@ -16,9 +16,10 @@ _fzf_orig_completion_filter() { } _fzf_opts_completion() { - local cur opts + local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" opts=" -x --extended -e --extended-exact @@ -27,20 +28,31 @@ _fzf_opts_completion() { -d --delimiter +s --no-sort --tac + --tiebreak -m --multi --no-mouse +c --no-color +2 --no-256 --black --reverse + --no-hscroll --prompt -q --query -1 --select-1 -0 --exit-0 -f --filter --print-query + --expect + --toggle-sort --sync" + case "${prev}" in + --tiebreak) + COMPREPLY=( $(compgen -W "length begin end index" -- ${cur}) ) + return 0 + ;; + esac + if [[ ${cur} =~ ^-|\+ ]]; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index d7f0903..d983bb1 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -44,7 +44,7 @@ if [ -z "$(set -o | \grep '^vi.*on')" ]; then fi # CTRL-R - Paste the selected command from history into the command line - bind '"\C-r": " \C-e\C-u$(HISTTIMEFORMAT= history | fzf +s --tac +m -n2..,.. --toggle-sort=ctrl-r | sed \"s/ *[0-9]* *//\")\e\C-e\er"' + bind '"\C-r": " \C-e\C-u$(HISTTIMEFORMAT= history | fzf +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r | sed \"s/ *[0-9]* *//\")\e\C-e\er"' # ALT-C - cd into the selected directory bind '"\ec": " \C-e\C-u$(__fcd)\e\C-e\er\C-m"' @@ -62,7 +62,7 @@ else bind -m vi-command '"\C-t": "i\C-t"' # CTRL-R - Paste the selected command from history into the command line - bind '"\C-r": "\eddi$(HISTTIMEFORMAT= history | fzf +s --tac +m -n2..,.. | sed \"s/ *[0-9]* *//\")\C-x\C-e\e$a\C-x\C-r"' + bind '"\C-r": "\eddi$(HISTTIMEFORMAT= history | fzf +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r | sed \"s/ *[0-9]* *//\")\C-x\C-e\e$a\C-x\C-r"' bind -m vi-command '"\C-r": "i\C-r"' # ALT-C - cd into the selected directory diff --git a/shell/key-bindings.fish b/shell/key-bindings.fish index 6e9efa4..f5f79c4 100644 --- a/shell/key-bindings.fish +++ b/shell/key-bindings.fish @@ -44,7 +44,7 @@ function fzf_key_bindings end function __fzf_ctrl_r - history | fzf +s +m --toggle-sort=ctrl-r > $TMPDIR/fzf.result + history | fzf +s +m --tiebreak=index --toggle-sort=ctrl-r > $TMPDIR/fzf.result and commandline (cat $TMPDIR/fzf.result) commandline -f repaint rm -f $TMPDIR/fzf.result diff --git a/shell/key-bindings.zsh b/shell/key-bindings.zsh index 4780658..2bf42fa 100644 --- a/shell/key-bindings.zsh +++ b/shell/key-bindings.zsh @@ -45,7 +45,7 @@ bindkey '\ec' fzf-cd-widget # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { local selected - if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. --toggle-sort=ctrl-r -q "$LBUFFER"); then + if selected=$(fc -l 1 | fzf +s --tac +m -n2..,.. --tiebreak=index --toggle-sort=ctrl-r -q "$LBUFFER"); then num=$(echo "$selected" | head -1 | awk '{print $1}' | sed 's/[^0-9]//g') LBUFFER=!$num zle expand-history diff --git a/src/constants.go b/src/constants.go index 36804d0..3c7f76c 100644 --- a/src/constants.go +++ b/src/constants.go @@ -5,7 +5,7 @@ import ( ) // Current version -const Version = "0.9.8" +const Version = "0.9.9" // fzf events const (