Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How do *you* sync your zsh config files?
- X-seq: zsh-users 2295
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: How do *you* sync your zsh config files?
- Date: Sat, 10 Apr 1999 22:06:33 -0700
- In-reply-to: <199904102357.TAA03805@ocalhost>
- In-reply-to: <19990410213242.A22352@xxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <199904102357.TAA03805@ocalhost> <19990410213242.A22352@xxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author