[input] check for null bindkey values
Only bind keys if length of var > 0 Hopefully these are the only keys that will require this testing. If anyone encounters issues like issue #17 with additional keys, please create an issue. Closes #17
This commit is contained in:
parent
d13614e3bb
commit
aef41e25c5
1 changed files with 16 additions and 5 deletions
|
@ -43,8 +43,9 @@ key_info=(
|
|||
'BackTab' "${terminfo[kcbt]}"
|
||||
)
|
||||
|
||||
local key
|
||||
# Bind the keys
|
||||
|
||||
local key
|
||||
for key in "${(s: :)key_info[ControlLeft]}"; do
|
||||
bindkey ${key} backward-word
|
||||
done
|
||||
|
@ -52,10 +53,18 @@ for key in "${(s: :)key_info[ControlRight]}"; do
|
|||
bindkey ${key} forward-word
|
||||
done
|
||||
|
||||
if [[ -n "${key_info[Home]}" ]]; then
|
||||
bindkey "${key_info[Home]}" beginning-of-line
|
||||
bindkey "${key_info[End]}" end-of-line
|
||||
fi
|
||||
|
||||
if [[ -n "${key_info[End]}" ]]; then
|
||||
bindkey "${key_info[End]}" end-of-line
|
||||
fi
|
||||
|
||||
if [[ -n "${key_info[Insert]}" ]]; then
|
||||
bindkey "${key_info[Insert]}" overwrite-mode
|
||||
fi
|
||||
|
||||
bindkey "${key_info[Delete]}" delete-char
|
||||
bindkey "${key_info[Backspace]}" backward-delete-char
|
||||
|
||||
|
@ -69,7 +78,9 @@ bindkey ' ' magic-space
|
|||
bindkey "${key_info[Control]}L" clear-screen
|
||||
|
||||
# Bind Shift + Tab to go to the previous menu item.
|
||||
if [[ -n "${key_info[BackTab]}" ]]; then
|
||||
bindkey "${key_info[BackTab]}" reverse-menu-complete
|
||||
fi
|
||||
|
||||
# Put into application mode and validate ${terminfo}
|
||||
zle-line-init() {
|
||||
|
|
Loading…
Reference in a new issue