From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14064 invoked by alias); 19 Apr 2012 21:03:30 -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: 17018 Received: (qmail 14426 invoked from network); 19 Apr 2012 21:03: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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at internecto.net designates 176.9.245.29 as permitted sender) X-Virus-Scanned: Debian amavisd-new at mx1.internecto.net Date: Thu, 19 Apr 2012 23:03:11 +0000 From: Mark To: zsh-users@zsh.org Subject: Loading functions Message-ID: <20120419230311.18b75bf0@internecto.net> Organization: Internecto SIS X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello again fellow zshians, For a particular git repository I created some helper functions. Usually I cd to the gitroot and then I load these functions (and env variables) by sourcing './zsh.env.' Often I forget to source the file and I also just dislike to source it manually. I probably got irritated by this irritating pattern of first forgetting to source the file, then forgetting to preface it with it's path by typing ". zsh.env" and only then getting it right by typing ". ./zsh.env". After being properly annoyed in today's fourth or fifth terminal screen i started to search for alternative ways. At first I thought I could execute some script instead of sourcing it. But I couldn't find ways in which my shell would remember specified functions after the script had been executed. Is this even possible? Then I realised that ideally my shell would "do something" (e.g. automatically load functions, set env vars) when I go into a directory or any subdirectory and "undo" it (unload these functions, unset the variables) upon leaving the directory. Which ultimately leads to my next question: can zsh be instructed to have a particular environment that is local to certain directories? Thank you, -Mark.