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

color change depending on vi mode



Hello,

In respons to: http://www.zsh.org/mla/users/2006/msg00042.html
I've tweaked the vi-showmode file a little and I thought I might
share this. I've only changed to top of the file if someone
wants to receive the whole of this, please contact me off-list.

regards,

# [00:32|miekg@elektron ~]
#       ^ this pipe is changed when in normal/cmd mode
# otherwise the | is plain

go_up_left() {
   builtin echotc UP 1
   builtin echotc LEFT $COLUMNS
}

go_down_left() {
   builtin echotc DOWN 1
   builtin echotc LEFT $COLUMNS
}

show_mode() {
   local x
   local pos=6
   x=$CURSOR
   # we do the vi thing in reverse, highlight something when
   # in cmd mode otherwise nothing
   case $1 in
        "NORMAL")
        go_up_left
        builtin echotc RIGHT $pos
        echo -n $'\e[0;37;44m'"|"$'\e[0m'
        CURSOR=$x
        go_down_left
        builtin echotc RIGHT $((x + 2)) # prompt
        ;;
        "INSERT")
        go_up_left
        builtin echotc RIGHT $pos
        echo -n "|"
        CURSOR=$x
        go_down_left
        builtin echotc RIGHT $((x + 2)) # prompt
        ;;
   esac
}

--
grtz,
  - Miek

  http://www.miek.nl              http://www.nlnetlabs.nl
  PGP: 6A3C F450 6D4E 7C6B C23C  F982 258B 85CF 3880 D0F6

Attachment: signature.asc
Description: Digital signature



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