git.fiddlerwoaroof.com
zsh/zsh_plugins/dependencies/key-bindings.zsh
eb308c57
 set -o vi
8ba81c71
 bindkey -v
 
 # We want the up + down arrows to do completion
 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
3745c88f
 
 bindkey -M vicmd '?' history-incremental-search-backward
 bindkey -M vicmd '/' history-incremental-search-forward
 
8ba81c71
 bindkey -M viins "^[[A" up-line-or-beginning-search # Up
 bindkey -M vicmd "^[[A" up-line-or-beginning-search # Up
 bindkey -M viins "^[[B" down-line-or-beginning-search # Down
 bindkey -M vicmd "^[[B" down-line-or-beginning-search # Down
3745c88f
 
8ba81c71
 bindkey -M vicmd "k" up-line-or-beginning-search # Up
 bindkey -M vicmd "j" down-line-or-beginning-search # Down
 
eb308c57
 bindkey -M vicmd '?' history-incremental-search-backward
8ba81c71
 bindkey -M viins '^X^e' edit-command-line
3745c88f
 bindkey -M vicmd '^X^e' edit-command-line
8ba81c71
 bindkey -M viins '^I' complete-word
eb308c57
 bindkey -M viins '^Oc' _correct_word
 bindkey -M viins '^O?' _complete_debug
525ac7de
 bindkey -M viins '^_' run-help
 bindkey -M vicmd '^_' run-help
eb308c57
 
 # detecting the terminal to get the keybindings right
 # TODO: check if obsoleted by other things
 if [[ -z $BINDKEYS ]]; then
     # echo 'defining bindkeys in zshrc'
     BINDKEYS=${TERM%-256color}
     BINDKEYS=${BINDKEYS%-noit}
 fi
 
 if [[ $BINDKEYS == "screen" ]]; then
     bindkey '' backward-word
     bindkey '' forward-word
     bindkey '[1~' beginning-of-line
     bindkey '[4~' end-of-line
 else
     bindkey -M viins '' backward-word
     # bindkey '' backward-word
     bindkey -M viins '' forward-word
     # bindkey '' forward-word
     bindkey -M viins 'OH' beginning-of-line
     bindkey -M viins 'OF' end-of-line
 fi
 bindkey '[3~' delete-char
 
3745c88f
 export KEYTIMEOUT=1
 
525ac7de
 autoload -Uz surround
 zle -N delete-surround surround
 zle -N add-surround surround
 zle -N change-surround surround
 bindkey -a cs change-surround
 bindkey -a ds delete-surround
 bindkey -a ys add-surround
 bindkey -M visual S add-surround