zsh-users
 help / color / mirror / code / Atom feed
* color change depending on vi mode
@ 2006-02-07 10:05 Miek Gieben
  0 siblings, 0 replies; only message in thread
From: Miek Gieben @ 2006-02-07 10:05 UTC (permalink / raw)
  To: zsh users

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-07 10:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07 10:05 color change depending on vi mode Miek Gieben

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).