zsh-users
 help / color / mirror / code / Atom feed
From: Miek Gieben <miek@miek.nl>
To: zsh users <zsh-users@sunsite.dk>
Subject: color change depending on vi mode
Date: Tue, 7 Feb 2006 11:05:28 +0100	[thread overview]
Message-ID: <20060207100528.GB30436@miek.nl> (raw)

[-- 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 --]

                 reply	other threads:[~2006-02-07 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060207100528.GB30436@miek.nl \
    --to=miek@miek.nl \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).