dotar/zsh/key-bindings.zsh
2017-04-09 03:28:56 +08:00

64 lines
2.4 KiB
Bash

# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins
# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets
bindkey -v # Use vi key bindings
# VI MODE KEYBINDINGS (ins mode)
bindkey -M viins '^a' beginning-of-line
bindkey -M viins '^e' end-of-line
# bindkey -M viins '^k' kill-line
bindkey -M viins '^r' history-incremental-pattern-search-backward
bindkey -M viins '^s' history-incremental-pattern-search-forward
bindkey -M viins '^p' up-line-or-history
bindkey -M viins '^n' down-line-or-history
bindkey -M viins '^y' yank
bindkey -M viins '^f' forward-char
bindkey -M viins '^b' backward-char
bindkey -M viins '^w' backward-kill-word
bindkey -M viins '^u' backward-kill-line
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^_' undo
bindkey -M viins '^x^r' redisplay
bindkey -M viins '\eOH' beginning-of-line # Home
bindkey -M viins '\eOF' end-of-line # End
bindkey -M viins '\e[2~' overwrite-mode # Insert
bindkey -M viins '\ef' forward-word # Alt-f
bindkey -M viins '\eb' backward-word # Alt-b
bindkey -M viins '\ed' kill-word # Alt-d
# VI MODE KEYBINDINGS (cmd mode)
bindkey -M vicmd '^a' beginning-of-line
bindkey -M vicmd '^e' end-of-line
# bindkey -M vicmd '^k' kill-line
bindkey -M vicmd '^r' history-incremental-pattern-search-backward
bindkey -M vicmd '^s' history-incremental-pattern-search-forward
bindkey -M vicmd '^p' up-line-or-history
bindkey -M vicmd '^n' down-line-or-history
bindkey -M vicmd '^y' yank
bindkey -M vicmd '^f' forward-char
bindkey -M vicmd '^b' backward-char
bindkey -M vicmd '^w' backward-kill-word
bindkey -M vicmd '^u' backward-kill-line
bindkey -M vicmd '/' vi-history-search-forward
bindkey -M vicmd '?' vi-history-search-backward
bindkey -M vicmd '^_' undo
bindkey -M vicmd '\ef' forward-word # Alt-f
bindkey -M vicmd '\eb' backward-word # Alt-b
bindkey -M vicmd '\ed' kill-word # Alt-d
bindkey -M vicmd '\e[5~' history-beginning-search-backward # PageUp
bindkey -M vicmd '\e[6~' history-beginning-search-forward # PageDown
# emacs style
bindkey '^a' beginning-of-line
bindkey '^e' end-of-line
# Make numpad enter work
bindkey -s "^[Op" "0"
bindkey -s "^[Ol" "."
bindkey -s "^[OM" "^M"