Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Submitting vcs_info function
- X-seq: zsh-workers 25699
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: Submitting vcs_info function
- Date: Sun, 21 Sep 2008 03:00:01 -0700
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=kpGDjuOZdoOg93C54x2ho8kr5z5gHGghap6pR43YqfnBQ7te5OPTkGaMFUYxZk8OcLB6sUjskzjjoYP9eUQ5wv6jLbN/Dm+WNOXPEebYJ+z1yH2wNaXFEbTu8I4HE99Af1jxqVF0NiDGxZVKAvrUwuFZP7/tBM5AMCGvLaRG5KY=;
- In-reply-to: <20080921093958.GA34405@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-workers <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20080917201859.GU2182@xxxxxxxxxxxxxxx> <20080917203242.GV2182@xxxxxxxxxxxxxxx> <20080921091111.GA26463@xxxxxxxx> <20080921093958.GA34405@xxxxxxxxxxxxxxxxxxxx>
On 2008-09-21 at 02:39 -0700, Phil Pennock wrote:
> Reports screen WINDOW, SHLVL, previous command exit status (including
> signal name if sig-exit), count of backgrounded jobs, repository
> information plus the usual bits. Has some automatic screen titling
> stuff in the prompt too.
Anyone have any recommendations for using zstyle with prompts?
I've gone for:
:prompt:<theme>:<$TERM>:<colour|mono>
in the absence of any better ideas. This removes a TODO from the file,
to move the employer logic out into a style.
I sometimes make an effort to sync my configs a bit between the setups
and it's useful to have the employer in my prompt; or at least, at
3.30am after the pager goes off and before coffee, I tend to think so.
Besides, I use a really-cheesy multi-coloured tag reminiscent of my
employer's logo, which makes people groan. :)
----------------------------8< cut here >8------------------------------
--- posted-prompt Sun Sep 21 02:55:21 2008
+++ prompt_pdp-vcs_setup Sun Sep 21 02:52:38 2008
@@ -1,7 +1,7 @@
# Phil's prompt setup for zsh
#
# $HeadURL: https://svn.spodhuis.org/ksvn/spodhuis-tools/zsh/site-functions/prompt_pdp-vcs_setup $
-# $Id: prompt_pdp-vcs_setup 239 2008-09-20 21:37:30Z xxx@xxxxxxxxxxxx $
+# $Id: prompt_pdp-vcs_setup 240 2008-09-21 09:52:38Z xxx@xxxxxxxxxxxx $
#
# Installs somewhere in fpath; typically one of:
# /usr/globnix/share/zsh/site-functions/prompt_pdp-vcs_setup
@@ -90,7 +90,7 @@
function prompt_pdp-vcs_setup {
local -h name root host mach line time level error jobc pathdisp vcs
local -h p1 prefix='' trunclen=40
- local -h employer
+ local -h employer employer_domain
local -h docolour=:
[[ $1 == update ]] && docolour=false
@@ -131,8 +131,13 @@
zstyle ':vcs_info:*' formats %b %s
zstyle ':vcs_info:*' actionformats "%b|%a" %s
-# Employer-dependent $HOST check elided from post
+ local style_ctx=":prompt:pdp-vcs:$TERM:"
+ $docolour && style_ctx+=colour || style_ctx+=mono
employer=''
+ zstyle -s "$style_ctx" employer-domain employer_domain
+ if [[ -n $employer_domain && $HOST == *.$employer_domain ]]; then
+ zstyle -s "$style_ctx" employer-prompt employer
+ fi
root="$(prompt_pdp-vcs_hl root %n)"
name="$(prompt_pdp-vcs_hl name "%(#.${root}.%n)")"
----------------------------8< cut here >8------------------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author