Add zshenv file
From the [Zsh manual](http://zsh.sourceforge.net/Intro/intro_3.html): > '.zshenv' is sourced on all invocations of the shell, unless the -f option is > set. It should contain commands to set the command search path, plus other > important environment variables. `.zshenv' should not contain commands that > produce output or assume the shell is attached to a tty. Why is this important? [Alfred](http://www.alfredapp.com/) workflows run in non-interactive shells. When the `$PATH` is set, or `rbenv` is initialized, in `zshrc` instead of `zshenv`, those workflows will not use the correct Ruby version and might not have access to certain bin files, such as those from `$HOME/.bin/` or Homebrew.
This commit is contained in:
parent
975cf7bc72
commit
6a1bd18a1f
3 changed files with 25 additions and 15 deletions
|
@ -52,6 +52,7 @@ Put your customizations in dotfiles appended with `.local`:
|
|||
* `~/.tmux.conf.local`
|
||||
* `~/.vimrc.local`
|
||||
* `~/.vimrc.bundles.local`
|
||||
* `~/.zshenv.local`
|
||||
* `~/.zshrc.local`
|
||||
* `~/.zsh/configs/*`
|
||||
|
||||
|
@ -70,6 +71,13 @@ Your `~/.gitconfig.local` might look like this:
|
|||
name = Dan Croak
|
||||
email = dan@thoughtbot.com
|
||||
|
||||
Your `~/.zshenv.local` might look like this:
|
||||
|
||||
# load pyenv if available
|
||||
if which pyenv &>/dev/null ; then
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
|
||||
Your `~/.zshrc.local` might look like this:
|
||||
|
||||
# recommended by brew doctor
|
||||
|
|
17
zshenv
Normal file
17
zshenv
Normal file
|
@ -0,0 +1,17 @@
|
|||
# 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/bin:$PATH"
|
||||
|
||||
# load rbenv if available
|
||||
if which 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
15
zshrc
|
@ -57,21 +57,6 @@ bindkey "^Y" accept-and-hold
|
|||
bindkey "^N" insert-last-word
|
||||
bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"
|
||||
|
||||
# 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/bin:$PATH"
|
||||
|
||||
# load rbenv if available
|
||||
if which 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"
|
||||
|
||||
# aliases
|
||||
[[ -f ~/.aliases ]] && source ~/.aliases
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue