3

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 ?

  • 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 Dec 13 '16 at 9:22
2

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...

  • umm... there is no ~/.zshenv file/directory in my zsh installation. Should I create it ? – shirish Dec 13 '16 at 19:51
  • I read the link you shared. While it tells the purpose it doesn't tell how to use it. – shirish Dec 13 '16 at 20:03
  • Such is life... – jasonwryan Dec 13 '16 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 Dec 13 '16 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.