about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/glittershark/system/home/modules/zshrc33
1 files changed, 27 insertions, 6 deletions
diff --git a/users/glittershark/system/home/modules/zshrc b/users/glittershark/system/home/modules/zshrc
index cca822c4ce..a12173d684 100644
--- a/users/glittershark/system/home/modules/zshrc
+++ b/users/glittershark/system/home/modules/zshrc
@@ -236,9 +236,6 @@ function dbp () {
 
 # }}}
 
-# Vagrant {{{
-# }}}
-
 # Twitter! {{{
 
 
@@ -264,9 +261,6 @@ gnc() {
 }
 # }}}
 
-# Systemd aliases {{{
-# }}}
-
 # Misc aliases {{{
 
 function fw() { # fix white
@@ -303,4 +297,31 @@ export GREP_OPTIONS=
     # glittershark/firefox
 # }}}
 
+# Change cursor shape on insert/normal mode {{{
+# (https://unix.stackexchange.com/q/433273/64261)
+
+KEYTIMEOUT=5
+
+_fix_cursor() {
+   echo -ne '\e[5 q'
+}
+
+precmd_functions+=(_fix_cursor)
+
+function zle-keymap-select {
+  if [[ ${KEYMAP} == vicmd ]] ||
+       [[ $1 = 'block' ]]; then
+  echo -ne '\e[1 q'
+
+  elif [[ ${KEYMAP} == main ]] ||
+         [[ ${KEYMAP} == viins ]] ||
+         [[ ${KEYMAP} = '' ]] ||
+         [[ $1 = 'beam' ]]; then
+  echo -ne '\e[5 q'
+  fi
+}
+zle -N zle-keymap-select
+
+# }}}
+
 [ -f ./.localrc ] && source ./.localrc