Last active
April 1, 2023 05:12
-
-
Save mentalisttraceur/3b084f9d4a7101700190892b6e77270a to your computer and use it in GitHub Desktop.
zsh fix standard unbound keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bindkey '^H' backward-delete-char | |
bindkey '^?' backward-delete-char | |
for keymap in emacs viins vicmd | |
do | |
bindkey -M $keymap '^[[H' vi-beginning-of-line | |
bindkey -M $keymap '^[[F' vi-end-of-line | |
bindkey -M $keymap '^[[5~' beginning-of-buffer | |
bindkey -M $keymap '^[[6~' end-of-buffer | |
done | |
zle -N beginning-of-buffer | |
zle -N end-of-buffer | |
function beginning-of-buffer() | |
{ | |
case $LBUFFER in *$'\n'*) | |
zle beginning-of-buffer-or-history | |
return | |
esac | |
zle beginning-of-line | |
} | |
function end-of-buffer() | |
{ | |
case $RBUFFER in *$'\n'*) | |
zle end-of-buffer-or-history | |
return | |
esac | |
zle end-of-line | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This adds standard behavior to some keys that zsh leaves unbound by default: