|
|
|
@ -45,6 +45,10 @@ if [[ "$TERM" == 'dumb' ]]; then
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Options
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Beep on error in line editor.
|
|
|
|
|
setopt BEEP
|
|
|
|
|
|
|
|
|
@ -52,6 +56,10 @@ setopt BEEP
|
|
|
|
|
autoload -Uz edit-command-line
|
|
|
|
|
zle -N edit-command-line
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Variables
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Use human-friendly identifiers.
|
|
|
|
|
zmodload zsh/terminfo
|
|
|
|
|
typeset -gA key_info
|
|
|
|
@ -93,6 +101,10 @@ for key in "$key_info[@]"; do
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Functions
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Displays editor information.
|
|
|
|
|
function editor-info {
|
|
|
|
|
# Clean up previous $editor_info.
|
|
|
|
@ -191,7 +203,10 @@ zle -N prepend-sudo
|
|
|
|
|
# Reset to default key bindings.
|
|
|
|
|
bindkey -d
|
|
|
|
|
|
|
|
|
|
# Emacs key bindings.
|
|
|
|
|
#
|
|
|
|
|
# Emacs Key Bindings
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
for key ("$key_info[Escape]"{B,b}) bindkey -M emacs "$key" emacs-backward-word
|
|
|
|
|
for key ("$key_info[Escape]"{F,f}) bindkey -M emacs "$key" emacs-forward-word
|
|
|
|
|
bindkey -M emacs "$key_info[Escape]$key_info[Left]" emacs-backward-word
|
|
|
|
@ -220,7 +235,9 @@ if (( $+widgets[history-incremental-pattern-search-backward] )); then
|
|
|
|
|
history-incremental-pattern-search-forward
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Vi key bindings.
|
|
|
|
|
#
|
|
|
|
|
# Vi Key Bindings
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Edit command in an external editor.
|
|
|
|
|
bindkey -M vicmd "v" edit-command-line
|
|
|
|
@ -241,7 +258,10 @@ else
|
|
|
|
|
bindkey -M vicmd "/" history-incremental-search-forward
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Emacs and Vi key bindings.
|
|
|
|
|
#
|
|
|
|
|
# Emacs and Vi Key Bindings
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
for keymap in 'emacs' 'viins'; do
|
|
|
|
|
bindkey -M "$keymap" "$key_info[Home]" beginning-of-line
|
|
|
|
|
bindkey -M "$keymap" "$key_info[End]" end-of-line
|
|
|
|
@ -295,6 +315,10 @@ if zstyle -t ':omz:module:editor' dot-expansion; then
|
|
|
|
|
bindkey -M isearch . self-insert 2> /dev/null
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Layout
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# Set the key layout.
|
|
|
|
|
zstyle -s ':omz:module:editor' keymap 'keymap'
|
|
|
|
|
if [[ "$keymap" == (emacs|) ]]; then
|
|
|
|
|