From 51abd7557995e220d5edecfc50519c3ca260fd52 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Sat, 25 Apr 2015 01:43:59 +0200 Subject: [PATCH] zsh: key bindings --- .zsh/00_basic.zsh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.zsh/00_basic.zsh b/.zsh/00_basic.zsh index 2f86b82..d09ebfa 100644 --- a/.zsh/00_basic.zsh +++ b/.zsh/00_basic.zsh @@ -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