mirror of
https://github.com/zsh-users/zsh-history-substring-search.git
synced 2026-11-11 11:41:49 -05:00
GH-53: configure arrow keys for iTerm2 with cuu/d1
This commit is contained in:
@@ -35,21 +35,29 @@ Usage
|
|||||||
|
|
||||||
2. Bind keyboard shortcuts to this script's functions:
|
2. Bind keyboard shortcuts to this script's functions:
|
||||||
|
|
||||||
# bind UP and DOWN arrow keys
|
## Arrow Keys ###########################################
|
||||||
|
|
||||||
|
# OPTION 1: for most systems
|
||||||
zmodload zsh/terminfo
|
zmodload zsh/terminfo
|
||||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||||
|
|
||||||
# bind UP and DOWN arrow keys (compatibility fallback
|
# OPTION 2: for iTerm2 running on Apple MacBook laptops
|
||||||
# for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users)
|
zmodload zsh/terminfo
|
||||||
|
bindkey "$terminfo[cuu1]" history-substring-search-up
|
||||||
|
bindkey "$terminfo[cud1]" history-substring-search-down
|
||||||
|
|
||||||
|
# OPTION 3: for Ubuntu 12.04, Fedora 21, and MacOSX 10.9
|
||||||
bindkey '^[[A' history-substring-search-up
|
bindkey '^[[A' history-substring-search-up
|
||||||
bindkey '^[[B' history-substring-search-down
|
bindkey '^[[B' history-substring-search-down
|
||||||
|
|
||||||
# bind P and N for EMACS mode
|
## EMACS mode ###########################################
|
||||||
|
|
||||||
bindkey -M emacs '^P' history-substring-search-up
|
bindkey -M emacs '^P' history-substring-search-up
|
||||||
bindkey -M emacs '^N' history-substring-search-down
|
bindkey -M emacs '^N' history-substring-search-down
|
||||||
|
|
||||||
# bind k and j for VI mode
|
## VI mode ##############################################
|
||||||
|
|
||||||
bindkey -M vicmd 'k' history-substring-search-up
|
bindkey -M vicmd 'k' history-substring-search-up
|
||||||
bindkey -M vicmd 'j' history-substring-search-down
|
bindkey -M vicmd 'j' history-substring-search-down
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user