diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2014-08-17 00:29:57 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2014-08-17 00:29:57 +0900 |
commit | d5e7303a25e50054e8925d9e11487f053ec9ca0c (patch) | |
tree | 526e6bc869f3a4da467cc3acce09a70bbda0f0e7 /install | |
parent | 2924fd3e2361347dfa9f7357bb12a550ef336a86 (diff) |
Change --nth option for CTRL-R key binding (#90)
Remove `1` from --nth option. With the change you can no more use `$`
anchor to match the tail of a command index. But it makes search
around 15% faster.
jg@jg:~> time cat history | fzf +s -n..,1,2.. -f fzf > /dev/nul
real 0m2.929s
user 0m2.766s
sys 0m0.154s
jg@jg:~> time cat history | fzf +s -n2..,.. -f fzf > /dev/null
real 0m2.535s
user 0m2.422s
sys 0m0.112s
Diffstat (limited to 'install')
-rwxr-xr-x | install | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -144,7 +144,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 +m -n..,1,2.. | sed \"s/ *[0-9]* *//\")\e\C-e\er"' + bind '"\C-r": " \C-e\C-u$(HISTTIMEFORMAT= history | fzf +s +m -n2..,.. | 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"' @@ -162,7 +162,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 +m -n..,1,2.. | sed \"s/ *[0-9]* *//\")\C-x\C-e\e$a\C-x\C-r"' + bind '"\C-r": "\eddi$(HISTTIMEFORMAT= history | fzf +s +m -n2..,.. | 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 @@ -223,7 +223,7 @@ bindkey '\ec' fzf-cd-widget # CTRL-R - Paste the selected command from history into the command line fzf-history-widget() { - LBUFFER=$(fc -l 1 | fzf +s +m -n..,1,2.. | sed "s/ *[0-9*]* *//") + LBUFFER=$(fc -l 1 | fzf +s +m -n2..,.. | sed "s/ *[0-9*]* *//") zle redisplay } zle -N fzf-history-widget |