1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-24 23:00:09 +00:00

Better research history with arrow keys

This change enables UP-arrow and DOWN-arrow full-line history completion.
For example, if you write `git clone` and press UP:

- Before this change,
  it will use the last command that starts with `git`.

- After this change,
  it will use the last command that starts with `git clone`.
This commit is contained in:
desrum_m 2015-02-22 23:07:51 +01:00 committed by Marc Cornellà
parent 273063ad59
commit 95aa9bd97b

View file

@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
fi fi
# start typing + [Up-Arrow] - fuzzy find history forward
if [[ "${terminfo[kcuu1]}" != "" ]]; then if [[ "${terminfo[kcuu1]}" != "" ]]; then
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
fi fi
# start typing + [Down-Arrow] - fuzzy find history backward
if [[ "${terminfo[kcud1]}" != "" ]]; then if [[ "${terminfo[kcud1]}" != "" ]]; then
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
fi fi
if [[ "${terminfo[khome]}" != "" ]]; then if [[ "${terminfo[khome]}" != "" ]]; then