Fixed the default keymap selection.
This commit is contained in:
parent
c2ab0d83dc
commit
2594270fdf
23
keyboard.zsh
23
keyboard.zsh
|
@ -54,18 +54,8 @@ keyinfo=(
|
||||||
'BackTab' "$terminfo[kcbt]"
|
'BackTab' "$terminfo[kcbt]"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Use Emacs bindings by default.
|
zstyle -s ':omz:editor' keymap 'keymap'
|
||||||
if ! zstyle -m ':omz:editor' keymap ' *'; then
|
if [[ "$keymap" == (emacs|) ]]; 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.
|
# Use Emacs key bindings.
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
|
@ -120,9 +110,7 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then
|
||||||
[[ -n "$keyinfo[Control]" ]] && \
|
[[ -n "$keyinfo[Control]" ]] && \
|
||||||
bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward
|
bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward
|
||||||
fi
|
fi
|
||||||
fi
|
elif [[ "$keymap" == vi ]]; then
|
||||||
|
|
||||||
if zstyle -m ':omz:editor' keymap 'vi'; then
|
|
||||||
# Use vi key bindings.
|
# Use vi key bindings.
|
||||||
bindkey -v
|
bindkey -v
|
||||||
|
|
||||||
|
@ -245,7 +233,12 @@ if 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: invalid keymap: $keymap" >&2
|
||||||
|
unset keymap
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
unset keymap
|
||||||
|
|
||||||
# The next key bindings are for both Emacs and Vi.
|
# The next key bindings are for both Emacs and Vi.
|
||||||
[[ -n "$keyinfo[Home]" ]] && \
|
[[ -n "$keyinfo[Home]" ]] && \
|
||||||
|
|
Loading…
Reference in a new issue