zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-users@sunsite.auc.dk
Subject: Re: How do *you* sync your zsh config files?
Date: Sat, 10 Apr 1999 22:06:33 -0700	[thread overview]
Message-ID: <990410220633.ZM16632@candle.brasslantern.com> (raw)
In-Reply-To: <199904102357.TAA03805@ocalhost>
In-Reply-To: <19990410213242.A22352@vt.edu>

On Apr 10,  7:57pm, Timothy J Luoma wrote:
} Subject: How do *you* sync your zsh config files?
}
} Anyone else in this situation:
} 
} I use zsh on 6 different accounts on 4 different machines (4 different  
} versions of zsh, 3 different OSes)

I have been in that situation in the past, though the number of different
zsh versions is now down to 3 (only 2 if you don't count 3.1.5, which I
only use part of the time at home) and the number of different OSs has
effectively dwindled to 2 (I now use Linux nearly everywhere, though the
distribution and libc vary).

} Does anyone else have advice on trying to keep these 4 separate accounts  
} somewhat in sync, so I don't have to re-write every new function over and  
} over again?

The one-word answer is "ediff".  The three-word answer is "ediff and
ange-ftp".

The considerably more complicated answer is that I long ago added to the
top of my .zshenv the lines:

---
# Set variables sanely for assorted versions
: ${VERSION:="$ZSH_NAME $ZSH_VERSION"}
: ${MACHTYPE:+${HOSTTYPE::=$MACHTYPE-$OSTYPE}}
: ${MACHTYPE:=${HOSTTYPE%%-*}}
: ${OSTYPE:=${HOSTTYPE#*-}}

case "$VERSION" in
# A several-way switch for various flavors of zsh
esac
---

And then later on I have other case statements that switch on $HOSTTYPE
or whatever.  I also have several case statements on $VERSION in my
~/.zshrc file.  My init files probably produce approximately the same
interactive environment (modulo completely missing features in older
ones) in any zsh from 2.0 through 3.1.5, though it's been a long time
since I actually started up anything older than 2.3.

(The reason I assign VERSION from ZSH_NAME and ZSH_VERSION, rather than
the other way around, is because all my init scripts were first written
for the older versions of zsh that didn't have the ZSH_ parameters, and
I was too lazy to fix all the references.)

I also make a lot of use of autoloaded functions.  I haven't created a
new alias in years, except to prefix some function name with "noglob"
or some trick like that.  I've occasionally considered making $fpath be
operating-system-dependent, but I no longer use enough different OSs
to mess with it just now.

} I'm constantly finding that I've added an alias on one account and want to  
} use it on the others, but the machines are not such that I could make them  
} identical (at least two different $USERNAMEs, and on 2 of the machines I  
} don't have root access....

I presume that $USERNAME is interesting because you're using some kind of
remote shell?

Set up a lookup table of usernames for yourself.  In 3.1.5, you can use an
associative array; in earlier versions, you can fake it.  Suppose you have
accounts on the machines "marble" "granite" and "shale".

    typeset -A usernames 2>&/dev/null
    # Have to do this in two steps because bad typeset options cause
    # the whole command line to abort in some versions of zsh
    [[ $? -eq 0 ]] || {
	usernames=()
	marble=1
	granite=2
	shale=3
    }
    usernames[marble]=luomat
    usernames[granite]=timjl
    usernames[shale]=tjlists

Now you can do stuff like this:

    rsh() {
	local command=rsh
	if [[ $OSTYPE:l == hp* ]]
	then
	    command=remsh
	fi
	command $command -l ${usernames[$1]:-$USERNAME} "$@"
    }

Of course, you may have to do more complicated things if the command wants
the host name to precede the -l option or whatever ...

} I once tried a 'zlocal' file that I would keep all my local configurations,  
} and keep everything else current, but that didn't work.

I used to do that with csh.  I agree that it doesn't work very well.

On Apr 10,  9:32pm, Michael Barnes wrote:
} Subject: Re: How do *you* sync your zsh config files?
}
} Great question, as I am in a very similar situation as to the number of
} accounts and OSes (4 OSes, and numberous accounts).  I've been thinking
} for a long time about doing it over cvs since I do cvs for development

If you keep all your dot-files in a subdirectory (then either symlink to
them from your home dir or point ZDOTDIR at it), there's a package called
"remsync" that does a pretty good job of tracking changes to a directory
tree, allowing you to e-mail minimal changes back and forth.  But it's
not very good for merging -- for that you could pick a host where you do
have access to CVS, and use remsync to keep your other zdotdirs in sync
with with a sandbox (or possibly a couple of sandboxes) on that host.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-04-11  5:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-10 23:57 Timothy J Luoma
1999-04-11  1:32 ` Michael Barnes
1999-04-11  5:06   ` Bart Schaefer [this message]
1999-04-12  7:40   ` David Kågedal
1999-04-15 19:22 ` Adam Spiers
1999-04-16  4:45   ` Timothy J Luoma
1999-04-12 14:03 Jay Sekora

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=990410220633.ZM16632@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.auc.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).