Skip to content

Instantly share code, notes, and snippets.

@Kaylebor
Created October 26, 2019 10:42
Show Gist options
  • Save Kaylebor/1fedc917dc3d2637b60e442454f6a576 to your computer and use it in GitHub Desktop.
Save Kaylebor/1fedc917dc3d2637b60e442454f6a576 to your computer and use it in GitHub Desktop.
Fix for several key combinations on zsh
case "${TERM}" in
cons25*|linux) # plain BSD/Linux console
bindkey '\e[H' beginning-of-line # home
bindkey '\e[F' end-of-line # end
bindkey '\e[5~' delete-char # delete
bindkey '[D' emacs-backward-word # esc left
bindkey '[C' emacs-forward-word # esc right
;;
*rxvt*) # rxvt derivatives
bindkey '\e[3~' delete-char # delete
bindkey '\eOc' forward-word # ctrl right
bindkey '\eOd' backward-word # ctrl left
# workaround for screen + urxvt
bindkey '\e[7~' beginning-of-line # home
bindkey '\e[8~' end-of-line # end
bindkey '^[[1~' beginning-of-line # home
bindkey '^[[4~' end-of-line # end
;;
*xterm*) # xterm derivatives
bindkey '\e[H' beginning-of-line # home
bindkey '\e[F' end-of-line # end
bindkey '\e[3~' delete-char # delete
bindkey '\e[1;5C' forward-word # ctrl right
bindkey '\e[1;5D' backward-word # ctrl left
# workaround for screen + xterm
bindkey '\e[1~' beginning-of-line # home
bindkey '\e[4~' end-of-line # end
;;
screen)
bindkey '^[[1~' beginning-of-line # home
bindkey '^[[4~' end-of-line # end
bindkey '\e[3~' delete-char # delete
bindkey '\eOc' forward-word # ctrl right
bindkey '\eOd' backward-word # ctrl left
bindkey '^[[1;5C' forward-word # ctrl right
bindkey '^[[1;5D' backward-word # ctrl left
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment