zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: do you use separate .zshenv and .zshrc files?
Date: Sat, 28 Apr 2012 16:03:34 -0700	[thread overview]
Message-ID: <120428160334.ZM15454@torch.brasslantern.com> (raw)
In-Reply-To: <4B2741961D3F4053AD4A3F6A195E2371@gmail.com>

On Apr 28,  3:07pm, TJ Luoma wrote:
}
} ISTM that it would be easier to just keep everything in one file and
} separate the login stuff using the `if` statement above.
}
} Are there any drawbacks to that method?

In addition to the items other have mentioned ...

If you have a lot of configuration it may take somewhat longer to parse
and execute the one big file when all that's going to happen is that a
large part of it will be skipped.  Remember that an "if" is a compound
statement which has to all be read into memory to be sure it parses
correctly before any of it can be executed (or discarded, if the
condition is false).  So a giant "if [[ -o interactive ]]; ..." may
needlessly consume memory and time.

I have a multi-file configuration which consists of

$HOME/.zshenv which sets ZDOTDIR to point at

a directory checked out of a source code repository which contains the
actual initialization files.

Within that directory are subdirectories for each host or host type
for which there is a customized config.  I symlink one of those to
"local" and then in (for example) $ZDOTDIR/.zshrc I will have

	desire $ZDOTDIR/local/termsetup

where "desire" is a function defined early like

	desire() { [[ -O $1 ]] && source $1 }

so I don't have to care if a particular local configuration is missing.


  parent reply	other threads:[~2012-04-28 23:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 19:07 TJ Luoma
2012-04-28 20:54 ` Benjamin R. Haskell
2012-04-28 21:01   ` Benjamin R. Haskell
2012-04-28 21:57   ` TJ Luoma
2012-04-28 22:25     ` Benjamin R. Haskell
2012-04-28 23:03 ` Bart Schaefer [this message]
2012-04-28 23:19   ` TJ Luoma

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=120428160334.ZM15454@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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).