Browse Source

Use the emacs keymap by default.

Since keymaps emacs and viins are aliases to main, it is not necessary
to define emacs keys twice.
master
Sorin Ionescu 13 years ago
parent
commit
ad731e4830
  1. 18
      keyboard.zsh

18
keyboard.zsh

@ -54,6 +54,17 @@ keyinfo=( @@ -54,6 +54,17 @@ keyinfo=(
'BackTab' "$terminfo[kcbt]"
)
# Use Emacs bindings by default.
if ! zstyle -m ':omz:editor' keymap ' *'; then
zstyle ':omz:editor' keymap 'emacs'
fi
# Stop binding on an invalid keymap.
if ! zstyle -m ':omz:editor' keymap 'emacs|vi'; then
print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2
return 1
fi
if zstyle -m ':omz:editor' keymap 'emacs'; then
# Use Emacs key bindings.
bindkey -e
@ -109,7 +120,9 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then @@ -109,7 +120,9 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then
[[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]s" history-incremental-search-forward
fi
elif zstyle -m ':omz:editor' keymap 'vi'; then
fi
if zstyle -m ':omz:editor' keymap 'vi'; then
# Use vi key bindings.
bindkey -v
@ -232,9 +245,6 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then @@ -232,9 +245,6 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then
[[ -n "$keyinfo[Control]" ]] && \
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward
fi
else
print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2
return 1
fi
# The next key bindings are for both Emacs and Vi.

Loading…
Cancel
Save