mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Better research history with arrow keys
This commit is contained in:
parent
677acc3a8c
commit
410d03d27f
2 changed files with 31 additions and 19 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
Modified version to get a better research history (with arrow-keys) with oh-my-zsh.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,16 @@
|
||||||
|
|
||||||
# Make sure that the terminal is in application mode when zle is active, since
|
# Make sure that the terminal is in application mode when zle is active, since
|
||||||
# only then values from $terminfo are valid
|
# only then values from $terminfo are valid
|
||||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
#if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||||
function zle-line-init() {
|
# function zle-line-init() {
|
||||||
echoti smkx
|
# echoti smkx
|
||||||
}
|
# }
|
||||||
function zle-line-finish() {
|
# function zle-line-finish() {
|
||||||
echoti rmkx
|
# echoti rmkx
|
||||||
}
|
# }
|
||||||
zle -N zle-line-init
|
# zle -N zle-line-init
|
||||||
zle -N zle-line-finish
|
# zle -N zle-line-finish
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
bindkey -e # Use emacs key bindings
|
bindkey -e # Use emacs key bindings
|
||||||
|
|
||||||
|
|
@ -23,16 +23,26 @@ bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backwa
|
||||||
if [[ "${terminfo[kpp]}" != "" ]]; then
|
if [[ "${terminfo[kpp]}" != "" ]]; then
|
||||||
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
|
||||||
fi
|
fi
|
||||||
if [[ "${terminfo[knp]}" != "" ]]; then
|
|
||||||
bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
# New functionality !
|
||||||
bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
autoload -U up-line-or-beginning-search
|
||||||
fi
|
autoload -U down-line-or-beginning-search
|
||||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
zle -N up-line-or-beginning-search
|
||||||
bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
zle -N down-line-or-beginning-search
|
||||||
fi
|
bindkey "^[[A" up-line-or-beginning-search # Up
|
||||||
|
bindkey "^[[B" down-line-or-beginning-search # Down
|
||||||
|
# End of new functionality
|
||||||
|
|
||||||
|
#if [[ "${terminfo[knp]}" != "" ]]; then
|
||||||
|
# bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
|
||||||
|
#fi
|
||||||
|
#
|
||||||
|
#if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||||
|
# bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward
|
||||||
|
#fi
|
||||||
|
#if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||||
|
# bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward
|
||||||
|
#fi
|
||||||
|
|
||||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue