ohmyzsh/custom/fix-keybindings.zsh
2011-12-30 23:08:37 +01:00

26 lines
641 B
Bash

# bash like history search
# PGUP, PGDN, HOME, END
bindtc ()
{
setopt localoptions
local keyval=$(echotc "$1" 2>&-)
[[ $keyval == "no" ]] && keyval=""
bindkey "${keyval:-$2}" "$3"
}
# Bindings for PGUP, PGDN, HOME, END
bindtc kP "^[[I" history-beginning-search-backward
bindtc kN "^[[G" history-beginning-search-forward
bindtc kh "^[[7~" beginning-of-line
bindtc kH "^[[8~" end-of-line
# Bindings for UP, DOWN, LEFT, RIGHT
bindtc ku "^[[A" up-line-or-history
bindtc kd "^[[B" down-line-or-history
bindtc kr "^[[C" forward-char
bindtc kl "^[[D" backward-char
# make del behave
bindkey "^[[3~" delete-char