4

I use/enjoy zsh and have used oh-my-zsh in couple. While it's all nice and cool, I do get irritated that I have to constantly update the oh-my-zsh script every 15 days/month .

Now I have put zsh as a prompt on another machine. Now the good thing about my oh-my-zsh is that instead of putting everything in .zshrc which when you install .zsh does, it does it in multiple directories with .zsh extension.

While I do not want to go that whole hog, is there a way I can put multiple *.zsh files under say ~/.zsh/ and strive to have a similar working environment.

Can this work or am I missing something ?

Running zsh on debian 64-bit.

Update - There are only two files which can be in my zsh installation -

think-debian% pwd
/home/shirish

think-debian% ls .z
.zcompdump  .zshrc

Any ideas ?

1
  • 2
    could you put that in a way I could understand instead of just giving a script. What is the script trying to achieve and what I should be doing. Please put it as an answer.
    – shirish
    Commented Dec 13, 2016 at 9:22

1 Answer 1

3

You can set your Zsh dotfiles directory with the ZDOTDIR environment variable; just add it to your ~/.zshenv:

ZDOTDIR="${ZDOTDIR:-$HOME/.zsh}"

Then, source any files in that directory that are named *.zsh from your ~/.zsh/zshrc:

if [[ -d "$ZDOTDIR" ]]; then
  for file in "$ZDOTDIR"/*.zsh; do
    source "$file"
  done
fi

For bonus points, uninstall Oh-My-Zsh and enjoy Zsh as it was intended, a powerful and flexible alternative to Bash, not a bloated ratmangle...

6
  • umm... there is no ~/.zshenv file/directory in my zsh installation. Should I create it ?
    – shirish
    Commented Dec 13, 2016 at 19:51
  • zsh.sourceforge.net/Intro/intro_3.html
    – jasonwryan
    Commented Dec 13, 2016 at 20:00
  • I read the link you shared. While it tells the purpose it doesn't tell how to use it.
    – shirish
    Commented Dec 13, 2016 at 20:03
  • Such is life...
    – jasonwryan
    Commented Dec 13, 2016 at 20:06
  • have updated my question with what files are viewable. This installation is a clean zsh installation, no oh-my-zsh at all in this installation.
    – shirish
    Commented Dec 13, 2016 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .