zshrc.d/10-default-bindings.zrc
author Mikael Berthe <mikael@lilotux.net>
Sun, 02 May 2021 12:58:39 +0200
changeset 48 604330c024f4
parent 47 f25fda256b1d
child 50 87b60a3c90ae
permissions -rw-r--r--
Fix key bindings with screen TERM


# Emacs mode bindings

bindkey -e

#bindkey '^Q'    quoted-insert
bindkey '^[[2~' overwrite-mode                    # Ins
bindkey '^[[3~' delete-char                       # Suppr
bindkey '^[[5~' history-beginning-search-backward # PgUp
bindkey '^[[6~' history-beginning-search-forward  # PgDn
bindkey '^[^I'  reverse-menu-complete             # ESC-Tab
bindkey '^Xc'   copy-prev-shell-word
bindkey '^Xf'   _correct_filename
bindkey '^Xm'   _most_recent_file

bindkey -s '' '^[/'
bindkey -s '' '^[,'

if [[ $TERM == "console" || $TERM == "vt100" || $TERM == linux* ||
      $TERM == xterm* || $TERM == screen* || $TERM == tmux* ]]
then
  bindkey '^[[1~' beginning-of-line       # Home
  bindkey '^[[4~' end-of-line             # End
fi

# Dans un xterm term=linux
if [[ $TERM == linux* ]]; then
  bindkey '^[[H'  beginning-of-line       # Home
  bindkey '^[[F'  end-of-line             # End
fi

# Dans un xterm
if [[ -z ${TERM:#xterm*} ]]; then
  bindkey '^[[H'  beginning-of-line       # Home
  bindkey '^[[F'  end-of-line             # End

  # Sur un xterm, on differencie backspace et delete (?).
  bindkey '^H'  backward-delete-char    # Backspace
  bindkey '^?'  backward-delete-char    # Backspace
fi

# Dans un rxvt
if [[ -z ${TERM:#rxvt*} ]]; then
  bindkey '^[[7~' beginning-of-line       # Home
  bindkey '^[[8~' end-of-line             # End
fi