Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Please implement auto-handling of ${HOME}/.zsh/
- X-seq: zsh-users 17725
- From: Axel Beckert <abe@xxxxxxxxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Re: Please implement auto-handling of ${HOME}/.zsh/
- Date: Thu, 21 Mar 2013 09:17:17 +0100
- Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAAAAAC3mUtaAAAABGdBTUEAALGPC/xhBQAAADh0RVh0U29mdHdhcmUAWFYgVmVyc2lvbiAzLjEwYSAgUmV2OiAxMi8yOS85NCAoUE5HIHBhdGNoIDEuMindFS5JAAACGElEQVQ4jXXQMU8UYRDG8f8shNjdDH4AbpfGDjAWlKiJiZ0ajL1aGCvsNCbGaCGG1koLaztaTYz6ATy+gOyehYmF3MxVxgg3FnDsHcTpJr/M+8w7Rf6nCsaVTTDqxbg9hoOXmw83H71+Eyfg4E1d7/Z2fG9rGkZbTQiu+K+3U/C+76lmkvAhJuDndnoAiftou4V84okAGclop4U/jYACZDTxrYWP0gkxVfAm/W//GLZpxIzwIN0Hn8dw0B+IWkZmQmRsj2HfhwokEklHfNCCiQCRgAR7YyhQVRVTCKCzP4Y5zBBE0t0zY3Q8oQaBqqAMlVEcgVQd9706zGirAFium8HXumlMIeMwqQCInju+2+uB6MRENupdpMt8pRlHZyuAW0F+Mb6XSIVqtxjD+iVmVqqystLEzFTGT92YqRaXpNT5eTVjeJhbALPnrTxLUZUKZsgxcNm64hAOYisT/xhF+oKTGU5RegtC3Rt6eEDi/QnIevdTx9Md2EMmYBRmCQR1026FCGQQJJExsRUqgkMGaWSbwYLnoO4T6VgpbQbdELPMBAHWWrhYrcxXnYgAsatPWygkFCBD4K62MAsOTqA6szYRPpsu6e6Y8mPiVrBMNuGIMrgwBUu4p2DgG1Ownu6hpuTv7hScefHAzAC/yRRw5U5pALMbJ4AUALvHSZhxgHPXTsHcdWD1GadAHr9avP+c0wCr7263Df8ASLwXWHWs+KIAAAAHdElNRQfYBQEBODPr
- In-reply-to: <CANPayMSTpxe7WGa3pkKWPQB6qDZvYdsDF5dRcDT23LAW5mzwkw@mail.gmail.com> <20130320205509.GD89285@phisen.local> <130320224152.ZM22924@torch.brasslantern.com> <ED2B935DE024BE43B79F5C1268FCE9EB58E59561@PRN-MBX01-2.TheFacebook.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: DeuxChevaux.org -- The Citroën 2CV Database
Hi,
On Wed, Mar 20, 2013 at 07:16:39PM +0000, Larry Schrof wrote:
> I have been dying for this for many years. I have a ton of zsh configs,
> so I like to organize them in ~/.zsh/,
Same here.
> but here's the problem.
I actually don't see it as problem, though. Works fine here with a
minimal implementation. Nevertheless I'd be happy to see this being
part of zsh officially to reduce dot file clutter in my ~/ and to make
the zsh config more VCS-suitable.
> First, I have to create a symlink ~/.zshenv and point it to ~/.zsh/.zshenv
Same here, except that I use ~/.zsh/zshenv and hence have a symlink
.zsh/.zshrc → .zsh/zshrc.
> Then, as the first thing to do in ~/.zsh/.zshenv, I have to do:
> export ZDOTDIR=${HOME}/.zsh
Dito.
> This is janky and is messier than it needs to be.
IMHO that's a very small "workaround". Could be way messier.
> It would be awesome if something like the following happened. Forgive me
> if the implementation is flawed; just note the spirit of my suggestion.
>
> - Before zsh begins to process the first user-based config file
> (I believe ~/.zshenv), look for the existence of ~/.zsh/ (a directory).
> - If this directory does not exist, proceed normally. (Start reading
> ~/.zshenv)
> - If this directory DOES exist:
> ---> Automatically set ZDOTDIR to ${HOME}/.zsh/
> ---> Ignore any ~/.zsh* files (If the user is using ~/.zsh/ it's their job
Why not concatenating them? That's what I'd have expected in a first
run. Then, after some thinking, I see that your suggestion potentially
makes sense, too.
Anyway, +1 for the basic idea.
On Wed, Mar 20, 2013 at 10:41:52PM -0700, Bart Schaefer wrote:
> } First, I have to create a symlink ~/.zshenv and point it to ~/.zsh/.zshenv
> } Then, as the first thing to do in ~/.zsh/.zshenv, I have to do:
> } export ZDOTDIR=${HOME}/.zsh
>
> Why not create a ~/.zshenv that does
>
> export ZDOTDIR=${HOME}/.zsh
> source $ZDOTDIR/.zshenv
>
> and forget about the symlinks?
Because you than have to create that file and store its content
elsewhere. But you need to have that file around anyway for that, so
symlinking seems the easier variant, at least if you have ~/.zsh/
under version control.
> Like TJ, I have a common set of config files stored on the web. (Not
> in Dropbox, in a source repository from which I check out to ~/.zsh,
> but it's the same idea.) One of the files in that repository is a
> script called ".installer" which writes something much like the above
> into ~/.zshenv (with a warning if that would clobber an existing file,
> etc.). I haven't yet needed to, but I've considered having .installer
> also write bash init files that exec zsh if zsh is not in /etc/shells.
I use .$DOTDIR/bin/setup-symlinks.sh for that purpose in a bunch of
gitified dotdirs (including my .xsession), but that's more or less the
same (with the exception that I prefer symlinks, of course).
> So on any new host, I just check out the .zsh directory, run .installer,
> resolve a conflict if it reports one, and I'm done.
git clone … + .$DOTDIR/bin/setup-symlinks.sh
(Plan is to use mr in the future to clone all relevant dot dirs at
once the way RichiH does..)
On Wed, Mar 20, 2013 at 04:55:09PM -0400, Paul Hoffman wrote:
> Interesting, but some people (well, *I*) have already organized their
> ~/.zsh/* differently and this change would break things.
Well, yeah, me, too, because I use ~/.zsh/zshenv and ~/.zsh/zshrc
because I dislike dot files inside dot dirs. But then again, I'd still
happy if that would become an official zsh feature and I'd change my
setup for that.
> I hope it isn't -- IMNSHO janky is better than something that might
> break things and that would complicate the already complicated startup
> process (and add to its long and complicated documentation).
I think it's worth it. And automatically setting $ZDOTDIR isn't very
complicated, neither to implement nor to document. The only more
complicated thing would be that, if $ZDOTDIR is set, it would look for
$ZDOTDIR/zshenv and $ZDOTDIR/zshrc, too (or only, see below).
On Wed, Mar 20, 2013 at 08:54:22PM +0100, Moritz Bunkus wrote:
> I'd love to have this, but two things that could be made even better
> in my opinion:
>
> 1. Check $XDG_CONFIG_HOME/zsh as well as ~/.zsh. The former is from
> the XDG Base Directory Specification[1] which I'd love to see zsh
> follow. $XDG_CONFIG_HOME defaults to ~/.config if unset.
Good idea! +1
> 2. If one of those directories exists then look for $that_dir/zshenv
> and not $that_dir/.zshenv. Hiding the files only makes sense for
> $HOME, not for a sub-directory. Same should be true for
> $that_dir/zshrc and the other files.
Yeah, that's my preference, too.
> So my proposal would be:
>
> - Look for an existing directory $XDG_CONFIG_HOME/zsh (if
> $XDG_CONFIG_HOME is unset assume default $HOME/.config) or $HOME/.zsh
> - If that directory exists set ZDOTDIR to it and read configuration
> files from that directory. The files are not prefixed with .
> - If that directory does not exist then proceed as before: read
> configuration files from $HOME, the files are prefixed with .
+1 for having it work that way.
Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | abe@xxxxxxxxxxxxxxx (Mail)
X See http://www.asciiribbon.org/ | abe@xxxxxxxxx (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author