3

I used Bash Shell for a long time and recently switched to ZSH because of the greatness of the project O-My-Zsh.

I have no problems how to use the zsh but setuping the local environment. I am currently using the dotfiles structure from Peepcode screencast, illustrate file-tree below:

Map .bash_profile to .zshrc file, map .zshrc file to the ~/bin/dotfile/zshrc file, zshrc file just load 3 files which is environment, alias, config. ( Those 3 files are the logic separation of the .zshrc file )

That is my setup. It is currently working the way it should. I could use alias which I set in alias file, etc.

Here is my question, the project O-My-Zsh needs the config file like loading the .oh-my-zsh folder and .oh-my-zsh.sh files. It is working if I put .oh-my-zsh config setting in the ~/.zshrc file. Since I mapped .zshrc to another place, how could I still refer to source the O-My-Zsh themes, plugins, settings? How should I source the ~/.oh-my-zsh folder in the clean way?

John Watts
  • 8,717
  • 1
  • 31
  • 35
MMA
  • 525
  • 2
  • 10
  • 19

1 Answers1

0

I think I understand your question, and my current setup may be similar:

In an effort to make setup and sync between various machines, I have moved all of my dotfiles to Dropbox (in a folder called .zsh). A symlink connects Dropbox/.zsh/.zshrc to ~/.zshrc, and Dropbox/.zsh/.zshrc sources all of my various config files, like so:

# 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

Similarly, $ZDOTDIR/oh-my-zsh_opts.zsh defines all of my Oh-my-zsh options:

# 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
Dustin Wheeler
  • 314
  • 2
  • 14