zsh: key bindings

This commit is contained in:
Mathieu Maret 2015-04-25 01:43:59 +02:00
parent be1ace2461
commit 51abd75579
1 changed files with 21 additions and 3 deletions

View File

@ -1,3 +1,5 @@
#man zshzle
#man zshcontrib
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=10000
@ -15,12 +17,28 @@ setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space # ignore line starting by a space
#setopt share_history # share command history data
#Doing this, only past commands beginning with the current input would've been shown.
bindkey "^[[A" history-search-backward
bindkey "^[[B" history-search-forward
# Use 'cat -v' to obtain the keycodes
bindkey "\C-b" backward-word ## ctrl-b
bindkey "\C-f" forward-word ## ctrl-f
bindkey "^[[3~" delete-char ## Del
bindkey "^[[7~" beginning-of-line ## Home
bindkey "^[[8~" end-of-line ## End
bindkey " " magic-space ## do history expansion on space (after ! or ^)
bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word
#History on Key Up/Down
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "^[[A" up-line-or-beginning-search # Up
bindkey "^[[B" down-line-or-beginning-search # Down
#bindkey "^[[A" history-search-backward
#bindkey "^[[B" history-search-forward
#bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
#bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
unsetopt beep
#force emacs binding for tmux && screen
bindkey -e