Skip to content
Myr

[fish] Add --nth 2..,.. to allow anchored search against command

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 49b4962 · Browse files · 1 file+6 added−5 removed
This commit

State

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

Diff stats

1 file+6 added−5 removed

  • other:+6 added−5 removed

1 file+6 added−5 removed

modified:shell/key-bindings.fish+6 added-5 removed
57 unmodified lines
5859 function fzf-history-widget -d "Show command history"60 test -n "$FZF_TMUX_HEIGHT"; or set FZF_TMUX_HEIGHT 40%61 begin62 set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")63 set -lx FZF_DEFAULT_OPTS_FILE ''6462 set -l FISH_MAJOR (echo $version | cut -f1 -d.)63 set -l FISH_MINOR (echo $version | cut -f2 -d.)6465 # history's -z flag is needed for multi-line support.66 # history's -z flag was added in fish 2.4.0, so don't use it for versions67 # before 2.4.0.68 if [ "$FISH_MAJOR" -gt 2 -o \( "$FISH_MAJOR" -eq 2 -a "$FISH_MINOR" -ge 4 \) ];72 if type -q perl73 history -z --reverse | perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | perl -pe 's/^\d*\t//' | read -lz result69 if type -P perl > /dev/null 2>&170 set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")71 set -lx FZF_DEFAULT_OPTS_FILE ''72 history -z --reverse | command perl -0 -pe 's/^/$.\t/g; s/\n/\n\t/gm' | eval (__fzfcmd) --tac --read0 --print0 -q '(commandline)' | command perl -pe 's/^\d*\t//' | read -lz result73 and commandline -- $result74 else75 set -lx FZF_DEFAULT_OPTS (__fzf_defaults "" "--scheme=history --bind=ctrl-r:toggle-sort --highlight-line $FZF_CTRL_R_OPTS +m")76 set -lx FZF_DEFAULT_OPTS_FILE ''77 history -z | eval (__fzfcmd) --read0 --print0 -q '(commandline)' | read -lz result78 and commandline -- $result79 end80 else
112 unmodified lines