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

3
我长期使用Bash Shell,最近因为O-My-Zsh项目的伟大之处而转换到ZSH。我没有使用zsh遇到什么问题,但是设置本地环境有些麻烦。我目前正在使用Peepcode screencast 的dotfiles结构,并将.bash_profile映射到.zshrc文件,将.zshrc文件映射到~/bin/dotfile/zshrc文件,zshrc文件只加载三个文件:环境、别名和配置(这三个文件是.zshrc文件的逻辑分离)。那就是我的设置。它目前正常工作,我可以使用在别名文件中设置的别名等。
我的问题在于,项目O-My-Zsh需要像载入.oh-my-zsh文件夹和.oh-my-zsh.sh文件这样的配置文件。如果我在~/.zshrc文件中放置.oh-my-zsh配置设置,它可以工作。由于我将.zshrc映射到另一个位置,我该如何引用O-My-Zsh的主题、插件和设置?我应该以什么方式干净地源化~/.oh-my-zsh文件夹?
1个回答

0

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

为了使各个机器之间的设置和同步更加容易,我已将所有点文件移动到Dropbox中(在名为.zsh的文件夹中)。符号链接将Dropbox/.zsh/.zshrc连接到~/.zshrc,并且Dropbox/.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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接