Nicholas Marriott <nicholas.marri...@gmail.com> wrote:
> Does rxvt support these sequences? I don't think screen does. Probably
> best only to check for xterm.

I have code in my zsh configuration to set the cursor color based on
whether it's in viins or vicmd mode. Of the terminals I'm like to
encounter on machines I use day-to-day, only tmux doesn't support cursor
color changes. Logic to set the commands below.

--Ben

_zle_ins=""
_zle_cmd=""

() {
    local _zle_ins_color
    local _zle_cmd_color

    _zle_ins_color="white"
    _zle_cmd_color="magenta"

    if [ "$TERM" = "rxvt-unicode" ] || [ "$TERM" = "rxvt-256color" ] || [ 
"$TERM" = "xterm" ] || [ "$TERM" = "xterm-256color" ]; then
        _zle_ins="\033]12;$_zle_ins_color\007"
        _zle_cmd="\033]12;$_zle_cmd_color\007"
    elif [ "$TERM" = "screen" ] || [ "$TERM" = "screen-256color" ] || [ "$TERM" 
= "screen.linux" ]; then
        if [ -z "$TMUX" ]; then
            _zle_ins="\033P\033]12;$_zle_ins_color\007\033\\"
            _zle_cmd="\033P\033]12;$_zle_cmd_color\007\033\\"
        fi
    fi
}

zle-keymap-select () {
    if [ $KEYMAP = vicmd ]; then
        echo -ne $_zle_cmd
    else
        echo -ne $_zle_ins
    fi
}
zle -N zle-keymap-select

zle-line-init () {
    echo -ne $_zle_ins
}
zle -N zle-line-init


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to