# HG changeset patch # User Mikael Berthe # Date 1594366923 -7200 # Node ID c8b92fa96f48d3b9b3801ae3fb3de9a15561a4ec # Parent 157f894ef9f762629731d803f8be602e5553fe45 Update key bindings Fix some key bindings, remove binary escape bytes from key bindings. diff -r 157f894ef9f7 -r c8b92fa96f48 zshenv --- a/zshenv Mon Mar 02 13:16:10 2020 +0100 +++ b/zshenv Fri Jul 10 09:42:03 2020 +0200 @@ -26,7 +26,7 @@ # Options de 'less' export LESS="-Mi" # Ouvre les fichiers compressés -eval $(lesspipe) +#eval $(lesspipe) # Pager export PAGER=less diff -r 157f894ef9f7 -r c8b92fa96f48 zshrc.d/10-default-bindings.zrc --- a/zshrc.d/10-default-bindings.zrc Mon Mar 02 13:16:10 2020 +0100 +++ b/zshrc.d/10-default-bindings.zrc Fri Jul 10 09:42:03 2020 +0200 @@ -4,17 +4,17 @@ 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 '^[[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 '' ',' +bindkey -s '' '^[/' +bindkey -s '' '^[,' # Sur la console if [[ "$TERM" == "console" || "$TERM" == "vt100" ]]; then @@ -26,16 +26,20 @@ if [[ -z ${TERM:#linux*} || -z ${TERM:#screen} ]]; then bindkey '^[[H' beginning-of-line # Home bindkey '^[[F' end-of-line # End - bindkey '[1~' beginning-of-line # Home - bindkey '[4~' end-of-line # End + bindkey '^[[1~' beginning-of-line # Home + bindkey '^[[4~' 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 - bindkey '[1~' beginning-of-line # Home - bindkey '[4~' end-of-line # End + bindkey '^[[1~' beginning-of-line # Home + bindkey '^[[4~' 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 @@ -43,10 +47,3 @@ bindkey '^[[7~' beginning-of-line # Home bindkey '^[[8~' end-of-line # End fi - -# Sur un xterm, on differencie backspace et delete (?). -if [[ -z ${TERM:#xterm*} ]] -then - bindkey '^H' backward-delete-char # Backspace - bindkey '^?' backward-delete-char # Backspace -fi diff -r 157f894ef9f7 -r c8b92fa96f48 zshrc.d/60-vi-showmode.zrc --- a/zshrc.d/60-vi-showmode.zrc Mon Mar 02 13:16:10 2020 +0100 +++ b/zshrc.d/60-vi-showmode.zrc Fri Jul 10 09:42:03 2020 +0200 @@ -195,7 +195,7 @@ builtin zle .vi-cmd-mode } zle -N vi-cmd-mode -bindkey -M viins "" vi-cmd-mode +bindkey -M viins "^[" vi-cmd-mode ### vi-oper-swap-case @@ -206,25 +206,24 @@ ### characters on the current line. ### -bindkey -M vicmd "g~" vi-oper-swap-case +# Specific to command mode +bindkey -M vicmd "g~" vi-oper-swap-case bindkey -M vicmd 'guw' down-case-word bindkey -M vicmd 'gUw' up-case-word - -bindkey -M vicmd "[2~" vi-insert +bindkey -M vicmd "^[[2~" vi-insert bindkey -M vicmd 'q' push-line -bindkey -M vicmd '[5~' history-beginning-search-backward # PgUp -bindkey -M vicmd '[6~' history-beginning-search-forward # PgDn -bindkey -M viins '[5~' history-beginning-search-backward # PgUp -bindkey -M viins '[6~' history-beginning-search-forward # PgDn -bindkey -M viins '[7~' beginning-of-line -bindkey -M viins '[8~' end-of-line +# Specific to insert mode bindkey -M viins '^A' beginning-of-line bindkey -M viins '^E' end-of-line -bindkey -M viins '[3~' delete-char -bindkey -M viins '' up-line-or-history -bindkey -M viins '' down-line-or-history + +bindkey -M viins '^[[5~' history-beginning-search-backward # PgUp +bindkey -M viins '^[[6~' history-beginning-search-forward # PgDn + +bindkey -M viins '^[[A' up-line-or-history +bindkey -M viins '^[[B' down-line-or-history + bindkey -M viins '^Xc' copy-prev-shell-word bindkey -M viins '^Xf' _correct_filename bindkey -M viins '^_' undo @@ -236,6 +235,20 @@ bindkey -M viins '^P' _history-complete-older bindkey -M viins '^N' _history-complete-newer +# Both modes +bindkey -M viins '^[[7~' beginning-of-line +bindkey -M vicmd '^[[7~' beginning-of-line +bindkey -M viins '^[[8~' end-of-line +bindkey -M vicmd '^[[8~' end-of-line + +bindkey -M viins '^[[H' beginning-of-line +bindkey -M vicmd '^[[H' beginning-of-line +bindkey -M viins '^[[F' end-of-line +bindkey -M vicmd '^[[F' end-of-line + +bindkey -M viins '^[[3~' delete-char +bindkey -M vicmd '^[[3~' delete-char + bindkey -M viins -s '^X^H' 'hash -r\n' # These bindings depend on the ftzle script @@ -244,8 +257,10 @@ if [[ -z ${TERM:#screen} ]]; then - bindkey -M viins '[1~' beginning-of-line # Home - bindkey -M viins '[4~' end-of-line # End + bindkey -M viins '^[[1~' beginning-of-line # Home + bindkey -M vicmd '^[[1~' beginning-of-line # Home + bindkey -M viins '^[[4~' end-of-line # End + bindkey -M vicmd '^[[4~' end-of-line # End fi # Edit the command line using your usual editor.