dotter/zsh/20_keybind.zsh
2021-12-27 23:01:23 +08:00

52 lines
1.6 KiB
Bash

# Vim-like keybind as default
bindkey -v
autoload -U edit-command-line
zle -N edit-command-line
bindkey ',' autosuggest-accept
bindkey -M viins '^X^E' edit-command-line
# Add emacs-like keybind to viins mode
bindkey -M viins '^F' forward-char
bindkey -M viins '^B' backward-char
# bindkey -M viins '^P' up-line-or-history
# bindkey -M viins '^N' down-line-or-history
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 '\er' history-incremental-pattern-search-forward
bindkey -M viins '^Y' yank
bindkey -M viins '^W' backward-kill-word
bindkey -M viins '^U' backward-kill-line
bindkey -M viins '^H' backward-delete-char
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^G' send-break
bindkey -M viins '^D' delete-char-or-list
bindkey -M vicmd '^A' beginning-of-line
bindkey -M vicmd '^E' end-of-line
bindkey -M vicmd '^K' kill-line
# bindkey -M vicmd '^P' up-line-or-history
# bindkey -M vicmd '^N' down-line-or-history
bindkey -M vicmd '^Y' yank
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 'gg' beginning-of-line
bindkey -M vicmd 'G' end-of-line
if is-at-least 5.0.8; then
autoload -Uz surround
zle -N delete-surround surround
zle -N change-surround surround
zle -N add-surround surround
bindkey -a cs change-surround
bindkey -a ds delete-surround
bindkey -a ys add-surround
bindkey -a S add-surround
fi