Where to place Aliases when you have oh-my-zsh installed

Scott Whittaker over at scottwhittaker.net posted the exact information I was looking for.

I recently installed zsh and oh-my-zsh on one of my Macs, and was looking for where to put an alias. I looked in ~/.zshrc, and saw that it noted that if I was running oh-my-zsh, I should place the alias in $ZSH_CUSTOM, which, on my machine is a directory located at /Users/kgreenwell/.oh-my-zsh/custom (you can check this on your own machine with ‘echo $ZSH_CUSTOM’).

Which is fine, but then it left the question: “What should the file inside $ZSH_CUSTOM holding the aliases be called?” Scott’s post answers this quite nicely:

You can call the file anything you like as long as the file extension is .zsh and the file is immediately under the .oh-my-zsh/custom directory, for example .oh-my-zsh/custom/my-aliases.zsh. I found the answer to this in this thread.

He also goes on to note that you can create as many .zsh files in this directory as you’d like, and they’ll all get read, e.g. project1.zsh, project2.zsh, etc. The $ZSH_CUSTOM directory also contains an example.zsh file that gives an idea of what you can do with your .zsh files here. Very handy.

Thank you Scott, for spelling it all out so clearly!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.