summaryrefslogtreecommitdiff
path: root/zscripts/vicursor.zsh
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2024-10-18 21:52:28 -0500
committerTim Keller <tjk@tjkeller.xyz>2024-10-18 21:52:28 -0500
commit2dc486fb891e65658dff83ab34ca8878756a6a90 (patch)
tree03b39eb93f38534ab0972beadb770fecbd2243b8 /zscripts/vicursor.zsh
downloadzsh-2dc486fb891e65658dff83ab34ca8878756a6a90.tar.xz
zsh-2dc486fb891e65658dff83ab34ca8878756a6a90.zip
initial commit
Diffstat (limited to 'zscripts/vicursor.zsh')
-rwxr-xr-xzscripts/vicursor.zsh21
1 files changed, 21 insertions, 0 deletions
diff --git a/zscripts/vicursor.zsh b/zscripts/vicursor.zsh
new file mode 100755
index 0000000..3e4320d
--- /dev/null
+++ b/zscripts/vicursor.zsh
@@ -0,0 +1,21 @@
+#!/usr/bin/env zsh
+
+# Change cursor shape for different vi modes
+# Copied from LARBS
+if [ -n "$DISPLAY" ]; then
+ function zle-keymap-select () {
+ case $KEYMAP in
+ vicmd) echo -n '\e[1 q';; # block
+ viins|main) echo -n '\e[5 q';; # beam
+ esac
+ }
+ zle -N zle-keymap-select
+ zle-line-init() {
+ #zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
+ echo -n "\e[5 q"
+ }
+ zle -N zle-line-init
+ echo -n '\e[5 q' # Use beam shape cursor on startup
+ preexec() { echo -n '\e[5 q' ;} # Use beam shape cursor for each new prompt
+fi
+