Move EDITOR and PATH tweaks from .zshenv to .zshrc

Making tweaks such as setting EDITOR or changing PATH only makes sense
for interactive shells, e.g. those that open in your Terminal window or
when you log in to a server. Non-interactive shells (such as those
started by running `zsh myscript.zsh` or any executable with `zsh`
shebang) should instead inherit those values from the environment.

Furthermore, changing PATH in `~/.zshenv` is not advised since stock
OS X `/etc/zprofile` will reoder PATH by means of `path_helper`, so it's
better to make any additional PATH manipulation in `~/.zprofile` or
`~/.zshrc`.
This commit is contained in:
Mislav Marohnić 2015-10-04 18:39:28 +02:00 committed by Geoff Harcourt
parent f159f1a326
commit febd718efe
2 changed files with 15 additions and 15 deletions

15
zshenv
View file

@ -1,17 +1,2 @@
# use vim as the visual editor
export VISUAL=vim
export EDITOR=$VISUAL
# ensure dotfiles bin directory is loaded first
export PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load rbenv if available
if command -v rbenv &>/dev/null ; then
eval "$(rbenv init - --no-rehash)"
fi
# mkdir .git/safe in the root of repositories you trust
export PATH=".git/safe/../../bin:$PATH"
# Local config
[[ -f ~/.zshenv.local ]] && source ~/.zshenv.local

15
zshrc
View file

@ -1,3 +1,18 @@
# use vim as the visual editor
export VISUAL=vim
export EDITOR=$VISUAL
# ensure dotfiles bin directory is loaded first
export PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load rbenv if available
if command -v rbenv >/dev/null; then
eval "$(rbenv init - --no-rehash)"
fi
# mkdir .git/safe in the root of repositories you trust
export PATH=".git/safe/../../bin:$PATH"
# modify the prompt to contain git branch name if applicable
git_prompt_info() {
current_branch=$(git current-branch 2> /dev/null)