61 lines
1.6 KiB
Bash
61 lines
1.6 KiB
Bash
# vim: ft=zsh
|
|
|
|
bindkey -v
|
|
|
|
# General movement
|
|
# Taken from http://wiki.archlinux.org/index.php/Zsh and Ubuntu's inputrc
|
|
bindkey "\e[1~" beginning-of-line
|
|
bindkey "\e[4~" end-of-line
|
|
bindkey "\e[5~" beginning-of-history
|
|
bindkey "\e[6~" end-of-history
|
|
bindkey "\e[3~" delete-char
|
|
bindkey "\e[2~" quoted-insert
|
|
bindkey "\e[1;5C" forward-word
|
|
bindkey "\e[1;5D" backward-word
|
|
bindkey "\e[5C" forward-word
|
|
bindkey "\eOc" emacs-forward-word
|
|
bindkey "\e[5D" backward-word
|
|
bindkey "\eOd" emacs-backward-word
|
|
bindkey "\e\e[C" forward-word
|
|
bindkey "\e\e[D" backward-word
|
|
|
|
bindkey ' ' magic-space # do history expansion on space
|
|
|
|
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
|
|
bindkey "\eOH" beginning-of-line
|
|
bindkey "\eOF" end-of-line
|
|
# for freebsd console
|
|
bindkey "\e[H" beginning-of-line
|
|
bindkey "\e[F" end-of-line
|
|
|
|
# Tab completion
|
|
expand-or-complete-with-indicator() {
|
|
print -Pn "%{%F{red}...%f%}"
|
|
zle expand-or-complete
|
|
zle redisplay
|
|
}
|
|
zle -N expand-or-complete-with-indicator
|
|
bindkey "^I" expand-or-complete-with-indicator
|
|
|
|
bindkey "^r" history-incremental-search-backward
|
|
bindkey "\e[Z" reverse-menu-complete # shift-tab to reverse menu
|
|
|
|
# Up/down arrow.
|
|
# I want shared history for ^R, but I don't want another shell's activity to
|
|
# mess with up/down. This does that.
|
|
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
|
|
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
|
|
|
|
bindkey "\e[A" up-line-or-local-history
|
|
bindkey "\e[B" down-line-or-local-history
|