about summary refs log tree commit diff
path: root/.config/zsh/vi-mode.zsh
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-10-06 20:07:18 -0500
committerStarfall <us@starfall.systems>2021-10-06 20:10:54 -0500
commit4b389e7edc4c5457cb87cf4c7ab42483f386cb68 (patch)
tree309c6d8f57f82e558c27e5772faef463e4e3b1d7 /.config/zsh/vi-mode.zsh
parent948dd9523f5370e7a9d233d849a4ebf51a1f7ed1 (diff)
zsh: move completions, history, and vi mode to their own files
Diffstat (limited to '.config/zsh/vi-mode.zsh')
-rw-r--r--.config/zsh/vi-mode.zsh18
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/zsh/vi-mode.zsh b/.config/zsh/vi-mode.zsh
new file mode 100644
index 0000000..f0529f9
--- /dev/null
+++ b/.config/zsh/vi-mode.zsh
@@ -0,0 +1,18 @@
+# vi mode
+bindkey -v
+# make backspace and delete behave like vim
+bindkey -M viins '^?' backward-delete-char
+bindkey -M viins '^H' backward-delete-char
+bindkey -M viins '^[[3~' delete-char
+# display block cursor in normal mode
+function zle-keymap-select zle-line-init zle-line-finish {
+	case $KEYMAP in
+		vicmd)      echo -ne "\e[2 q";;
+		viins|main) echo -ne "\e[6 q";;
+	esac
+	zle reset-prompt
+	zle -R
+}
+zle -N zle-keymap-select
+zle -N zle-line-init
+zle -N zle-line-finish