summaryrefslogtreecommitdiff
path: root/zscripts/vicursor.zsh
blob: 3e4320d07af0394353560d1200fdeaf77c5a6bcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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