.dotfiles/.config/zsh/input.zsh

42 lines
1.4 KiB
Bash

if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() { echoti smkx }; zle -N zle-line-init
function zle-line-finish() { echoti rmkx }; zle -N zle-line-finish
fi
# PageUp/PageDown
(( ${+terminfo[kpp]} )) && bindkey -- "${terminfo[kpp]}" up-line-or-history
(( ${+terminfo[knp]} )) && bindkey -- "${terminfo[knp]}" down-line-or-history
# Up/Down
if (( ${+terminfo[kcuu1]} )) && (( ${+terminfo[kcud1]} )); then
autoload -Uz up-line-or-beginning-search; zle -N up-line-or-beginning-search
autoload -Uz down-line-or-beginning-search; zle -N down-line-or-beginning-search
bindkey -- "${terminfo[kcuu1]}" up-line-or-beginning-search
bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search
fi
# Home/End
(( ${+terminfo[khome]} )) && bindkey -- "${terminfo[khome]}" beginning-of-line
(( ${+terminfo[kend]} )) && bindkey -- "${terminfo[kend]}" end-of-line
# Shift-Tab
(( ${+terminfo[kcbt]} )) && bindkey -- "${terminfo[kcbt]}" reverse-menu-complete
# Delete
(( ${+terminfo[kdch1]} )) && bindkey -- "${terminfo[kdch1]}" delete-char
# Ctrl-Delete
bindkey -- '^[[3;5~' kill-word
# Ctrl-RightArrow/LeftArrow
bindkey -- '^[[1;5C' forward-word
bindkey -- '^[[1;5D' backward-word
# Space - don't do history expansion
bindkey ' ' magic-space
# VV in vi mode to edit cmd
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey -M vicmd 'vv' edit-command-line