Browse Source

editor: Fix Home and End in vicmd mode

Fixes #1160
master
Kaleb Elwert 7 years ago
parent
commit
79927ac73a
  1. 14
      modules/editor/init.zsh

14
modules/editor/init.zsh

@ -322,18 +322,24 @@ for keymap in $unbound_keys; do
bindkey -M viins "${keymap}" _prezto-zle-noop bindkey -M viins "${keymap}" _prezto-zle-noop
bindkey -M vicmd "${keymap}" _prezto-zle-noop bindkey -M vicmd "${keymap}" _prezto-zle-noop
done done
# Ctrl + Left and Ctrl + Right bindings to forward/backward word
# Keybinds for all keymaps
for keymap in 'emacs' 'viins' 'vicmd'; do
bindkey -M "$keymap" "$key_info[Home]" beginning-of-line
bindkey -M "$keymap" "$key_info[End]" end-of-line
done
# Keybinds for all vi keymaps
for keymap in viins vicmd; do for keymap in viins vicmd; do
# Ctrl + Left and Ctrl + Right bindings to forward/backward word
for key in "${(s: :)key_info[ControlLeft]}" for key in "${(s: :)key_info[ControlLeft]}"
bindkey -M "$keymap" "$key" vi-backward-word bindkey -M "$keymap" "$key" vi-backward-word
for key in "${(s: :)key_info[ControlRight]}" for key in "${(s: :)key_info[ControlRight]}"
bindkey -M "$keymap" "$key" vi-forward-word bindkey -M "$keymap" "$key" vi-forward-word
done done
# Keybinds for emacs and vi insert mode
for keymap in 'emacs' 'viins'; do for keymap in 'emacs' 'viins'; do
bindkey -M "$keymap" "$key_info[Home]" beginning-of-line
bindkey -M "$keymap" "$key_info[End]" end-of-line
bindkey -M "$keymap" "$key_info[Insert]" overwrite-mode bindkey -M "$keymap" "$key_info[Insert]" overwrite-mode
bindkey -M "$keymap" "$key_info[Delete]" delete-char bindkey -M "$keymap" "$key_info[Delete]" delete-char
bindkey -M "$keymap" "$key_info[Backspace]" backward-delete-char bindkey -M "$keymap" "$key_info[Backspace]" backward-delete-char

Loading…
Cancel
Save