zshrc.d/10-default-bindings.zrc
author Mikael Berthe <mikael@lilotux.net>
Fri, 10 Jul 2020 09:42:03 +0200
changeset 45 c8b92fa96f48
parent 30 e26330cd408f
child 47 f25fda256b1d
permissions -rw-r--r--
Update key bindings Fix some key bindings, remove binary escape bytes from key bindings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
# Emacs mode bindings
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
bindkey -e
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
#bindkey '^Q'    quoted-insert
45
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
     7
bindkey '^[[2~' overwrite-mode                    # Ins
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
     8
bindkey '^[[3~' delete-char                       # Suppr
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
     9
bindkey '^[[5~' history-beginning-search-backward # PgUp
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    10
bindkey '^[[6~' history-beginning-search-forward  # PgDn
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
bindkey '^[^I'  reverse-menu-complete             # ESC-Tab
30
e26330cd408f Use copy-prev-shell-word instead of copy-prev-word
Mikael Berthe <mikael@lilotux.net>
parents: 13
diff changeset
    12
bindkey '^Xc'   copy-prev-shell-word
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
bindkey '^Xf'   _correct_filename
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
bindkey '^Xm'   _most_recent_file
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
45
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    16
bindkey -s '' '^[/'
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    17
bindkey -s '' '^[,'
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
# Sur la console
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
if [[ "$TERM" == "console" || "$TERM" == "vt100" ]]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
  bindkey '^[[1~' beginning-of-line       # Home
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
  bindkey '^[[4~' end-of-line             # End
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
fi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    25
# Dans un xterm term=linux
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
if [[ -z ${TERM:#linux*} || -z ${TERM:#screen} ]]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    27
  bindkey '^[[H'  beginning-of-line       # Home
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
  bindkey '^[[F'  end-of-line             # End
45
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    29
  bindkey '^[[1~'  beginning-of-line       # Home
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    30
  bindkey '^[[4~'  end-of-line             # End
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    31
fi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    32
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    33
# Dans un xterm
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    34
if [[ -z ${TERM:#xterm*} ]]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    35
  bindkey '^[[H'  beginning-of-line       # Home
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    36
  bindkey '^[[F'  end-of-line             # End
45
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    37
  bindkey '^[[1~'  beginning-of-line       # Home
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    38
  bindkey '^[[4~'  end-of-line             # End
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    39
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    40
  # Sur un xterm, on differencie backspace et delete (?).
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    41
  bindkey '^H'  backward-delete-char    # Backspace
c8b92fa96f48 Update key bindings
Mikael Berthe <mikael@lilotux.net>
parents: 30
diff changeset
    42
  bindkey '^?'  backward-delete-char    # Backspace
13
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    43
fi
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    44
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    45
# Dans un rxvt
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    46
if [[ -z ${TERM:#rxvt*} ]]; then
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    47
  bindkey '^[[7~' beginning-of-line       # Home
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    48
  bindkey '^[[8~' end-of-line             # End
e1da4a7a9e92 More modularization
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    49
fi