Add stterm key codes
authorMikael Berthe <mikael@lilotux.net>
Wed, 10 Nov 2021 10:45:00 +0100
changeset 53 4767c5a8b1f9
parent 52 1f3d221e1770
child 54 c8054d1073d3
Add stterm key codes
zshrc.d/20-prompt.zrc
zshrc.d/60-vi-showmode.zrc
--- a/zshrc.d/20-prompt.zrc	Sat Oct 02 10:49:57 2021 +0200
+++ b/zshrc.d/20-prompt.zrc	Wed Nov 10 10:45:00 2021 +0100
@@ -4,6 +4,7 @@
 # Enable my Vim-like mode for supported terms
 if [[ "$TERM" == rxvt* ||
       "$TERM" == xterm* ||
+      "$TERM" == st-* ||
       "$TERM" == screen* ||
       "$TERM" == tmux* ]]
 then
--- a/zshrc.d/60-vi-showmode.zrc	Sat Oct 02 10:49:57 2021 +0200
+++ b/zshrc.d/60-vi-showmode.zrc	Wed Nov 10 10:45:00 2021 +0100
@@ -272,6 +272,15 @@
   bindkey -M vicmd '^[[1~'  beginning-of-line   # Home
   bindkey -M viins '^[[4~'  end-of-line         # End
   bindkey -M vicmd '^[[4~'  end-of-line         # End
+elif [[ $TERM == st || $TERM == st-* ]]; then
+    bindkey -M viins '^[[H'  beginning-of-line
+    bindkey -M vicmd '^[[H'  beginning-of-line
+    bindkey -M viins '^[[4~' end-of-line    # End with stterm
+    bindkey -M vicmd '^[[4~' end-of-line    # End with stterm
+    bindkey -M viins '^[[P'  delete-char    # Del with stterm
+    bindkey -M vicmd '^[[P'  delete-char    # Del with stterm
+    bindkey -M viins '^[[4h' vi-replace     # Ins with stterm
+    bindkey -M vicmd '^[[4h' vi-insert
 fi
 
 # Edit the command line using your usual editor.