ZSH和Oh-My-Zsh本地环境映射?

时间:2012-07-03 20:01:04

标签: zsh .bash-profile zshrc

我使用了Bash Shell很长一段时间,并且由于项目O-My-Zsh非常棒,最近切换到了ZSH。

我没有问题如何使用zsh但是设置本地环境。我目前正在使用Peepcode截屏视频中的dotfiles结构,说明下面的文件树:

将.bash_profile映射到.zshrc文件,将.zshrc文件映射到〜/ bin / dotfile / zshrc文件,zshrc文件只加载3个文件,即环境,别名,配置。 (这3个文件是.zshrc文件的逻辑分隔)

这是我的设置。它目前正在以它应有的方式运作。我可以使用我在别名文件中设置的别名等。

这是我的问题,项目O-My-Zsh需要配置文件,例如加载.oh-my-zsh文件夹和.oh-my-zsh.sh文件。如果我把.oh-my-zsh配置设置放在〜/ .zshrc文件中,它就可以了。由于我将.zshrc映射到另一个地方,我怎么还能引用O-My-Zsh主题,插件,设置来源?我应该如何以干净的方式获取〜/ .oh-my-zsh文件夹?

1 个答案:

答案 0 :(得分:0)

我想我理解你的问题,而我目前的设置可能类似:

为了在各种机器之间进行设置和同步,我已将所有的dotfiles移动到Dropbox(在名为.zsh的文件夹中)。符号链接会将Dropbox/.zsh/.zshrc连接到~/.zshrcDropbox/.zsh/.zshrc会将所有各种配置文件都包含在内,如下所示:

# Set so that all other sourced files can be found.
export ZDOTDIR="$HOME/Dropbox/.zsh"

source $ZDOTDIR/checks.zsh
# source $ZDOTDIR/colors.zsh
source $ZDOTDIR/exports.zsh
source $ZDOTDIR/oh-my-zsh_opts.zsh
source $ZDOTDIR/setopt.zsh
source $ZDOTDIR/pyopts.zsh
source $ZDOTDIR/prompt.zsh
source $ZDOTDIR/completion.zsh
source $ZDOTDIR/aliases.zsh
source $ZDOTDIR/bindkeys.zsh
source $ZDOTDIR/functions.zsh
# source $ZDOTDIR/zsh_hooks.zsh

同样,$ZDOTDIR/oh-my-zsh_opts.zsh定义了我的所有Oh-my-zsh选项:

# Path to your oh-my-zsh configuration.
ZSH=$ZDOTDIR/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="af-magic"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(battery colored-man colorize cp extract frontend git pip python pyenv\
 virtualenv)


if [[ $IS_MAC -eq 1 ]]; then
    plugins=($plugins brew brew-cask osx textmate)
fi

if [[ $IS_LINUX -eq 1 ]]; then
    plugins=($plugins)
fi

if [[ $HAS_APT -eq 1 ]]; then
    plugins=($plugins debian)
fi

if [[ $HAS_YUM -eq 1 ]]; then
    plugins=($plugins yum)
fi  

source $ZSH/oh-my-zsh.sh
相关问题