diff options
author | desrum_m <martin.desrumaux@epitech.eu> | 2015-02-22 23:07:51 +0100 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2015-12-14 01:08:55 +0100 |
commit | 95aa9bd97b9fb2a57f355178b2c5f01eb72ad0b6 (patch) | |
tree | 013a0afdb69918dbb9b2737cf6f2f4aae4628d4f /lib/key-bindings.zsh | |
parent | 273063ad59a9ce125349100647204ef42ad83e1c (diff) | |
download | zsh-95aa9bd97b9fb2a57f355178b2c5f01eb72ad0b6.tar.gz zsh-95aa9bd97b9fb2a57f355178b2c5f01eb72ad0b6.tar.bz2 zsh-95aa9bd97b9fb2a57f355178b2c5f01eb72ad0b6.zip |
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`.
Diffstat (limited to 'lib/key-bindings.zsh')
-rw-r--r-- | lib/key-bindings.zsh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index eb2b58058..0e056dc72 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history fi +# start typing + [Up-Arrow] - fuzzy find history forward 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 +# start typing + [Down-Arrow] - fuzzy find history backward 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 if [[ "${terminfo[khome]}" != "" ]]; then |