Use the emacs keymap by default.
Since keymaps emacs and viins are aliases to main, it is not necessary to define emacs keys twice.
This commit is contained in:
parent
e7c72ac02a
commit
ad731e4830
18
keyboard.zsh
18
keyboard.zsh
@ -54,6 +54,17 @@ keyinfo=(
|
|||||||
'BackTab' "$terminfo[kcbt]"
|
'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
|
if zstyle -m ':omz:editor' keymap 'emacs'; then
|
||||||
# Use Emacs key bindings.
|
# Use Emacs key bindings.
|
||||||
bindkey -e
|
bindkey -e
|
||||||
@ -109,7 +120,9 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then
|
|||||||
[[ -n "$keyinfo[Control]" ]] && \
|
[[ -n "$keyinfo[Control]" ]] && \
|
||||||
bindkey "$keyinfo[Control]s" history-incremental-search-forward
|
bindkey "$keyinfo[Control]s" history-incremental-search-forward
|
||||||
fi
|
fi
|
||||||
elif zstyle -m ':omz:editor' keymap 'vi'; then
|
fi
|
||||||
|
|
||||||
|
if zstyle -m ':omz:editor' keymap 'vi'; then
|
||||||
# Use vi key bindings.
|
# Use vi key bindings.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
|
||||||
@ -232,9 +245,6 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then
|
|||||||
[[ -n "$keyinfo[Control]" ]] && \
|
[[ -n "$keyinfo[Control]" ]] && \
|
||||||
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward
|
bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# The next key bindings are for both Emacs and Vi.
|
# The next key bindings are for both Emacs and Vi.
|
||||||
|
Reference in New Issue
Block a user