Created
August 16, 2019 18:44
-
-
Save grateful-dev/9c0f094d3f0fd7e2960dc2007aabd708 to your computer and use it in GitHub Desktop.
zsh - set up/down arrows to show only local history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up/down arrows to use local history | |
bindkey "${key[Up]}" up-line-or-local-history | |
bindkey "${key[Down]}" down-line-or-local-history | |
up-line-or-local-history() { | |
zle set-local-history 1 | |
zle up-line-or-history | |
zle set-local-history 0 | |
} | |
zle -N up-line-or-local-history | |
down-line-or-local-history() { | |
zle set-local-history 1 | |
zle down-line-or-history | |
zle set-local-history 0 | |
} | |
zle -N down-line-or-local-history | |
# Set CTRL + up/down arrows to use global history (same as up/down does by default) | |
bindkey "^[[1;5A" up-line-or-history # [CTRL] + Cursor up | |
bindkey "^[[1;5B" down-line-or-history # [CTRL] + Cursor down |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment