Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Xterm and CURSOR (INS && OVERRIDE)



On Aug 3,  6:49am, heiko_elger@xxxxxxxxxx wrote:
} Subject: Xterm and CURSOR (INS && OVERRIDE)
}
} Is it possible to send an escape sequence when pressing the INS key to change 
} the cursor in the XTERM (AIXTERM), e.x. INSERT MODE --> full cursor, OVERRIDE 
} MODE small cursor.

In 3.1.4, this should do it; you may need to swap vs and ve, or use some
other termcap sequence, to get the cursor you want in each case:

	INSkey='\e[2~'	# The sequence sent by the INS key

	function overwrite_change_cursor {
	    bindkey "$INSkey" insert_change_cursor
	    zle overwrite-mode
	    echotc vs
	}

	function insert_change_cursor {
	    bindkey "$INSkey" overwrite_change_cursor
	    zle overwrite-mode
	    echotc ve
	}

	zle -N overwrite_change_cursor overwrite_change_cursor
	zle -N insert_change_cursor insert_change_cursor

	function precmd {
	    if [[ -o overstrike ]]
	    then
		echotc vs
		bindkey "$INSkey" insert_change_cursor
	    else
		echotc ve
		bindkey "$INSkey" overwrite_change_cursor
	    fi
	}

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author