From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19890 invoked by alias); 21 Mar 2013 08:26:24 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17725 Received: (qmail 8856 invoked from network); 21 Mar 2013 08:26:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,FAKE_REPLY_C autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at sym2.noone.org does not designate permitted sender hosts) Date: Thu, 21 Mar 2013 09:17:17 +0100 From: Axel Beckert To: "zsh-users@zsh.org" Subject: Re: Please implement auto-handling of ${HOME}/.zsh/ Message-ID: <20130321081717.GI28221@sym.noone.org> Mail-Followup-To: "zsh-users@zsh.org" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20130320205509.GD89285@phisen.local> <130320224152.ZM22924@torch.brasslantern.com> X-Operating-System: Linux 2.6.32-5-xen-amd64 X-Machine: sym2 x86_64 X-Editor: GNU Emacs 23.2.1 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 Organization: DeuxChevaux.org -- The =?iso-8859-1?Q?Citr?= =?iso-8859-1?B?b+tu?= 2CV Database User-Agent: Mutt/1.5.20 (2009-06-14) 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@deuxchevaux.org (Mail) X See http://www.asciiribbon.org/ | abe@noone.org (Mail+Jabber) / \ I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)