.dotfiles/.config/zsh/input.zsh
2024-06-23 11:51:38 +02:00

36 lines
1.3 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
# Up/Down
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 -- "${terminfo[kcud1]}" down-line-or-beginning-search
# 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
(( "${+terminfo[kDC5]}" )) && bindkey -- "${terminfo[kDC5]}" kill-word
# Ctrl-RightArrow/LeftArrow
(( "${+terminfo[kRIT5]}" )) && bindkey -- "${terminfo[kRIT5]}" forward-word
(( "${+terminfo[kLFT5]}" )) && bindkey -- "${terminfo[kLFT5]}" 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