8

I am trying to use the aliases defined in my ~/.aliases file in my zsh with oh-my-zsh installation. The documentation suggested that aliases/functions/ etc. should go in .oh-my-zsh/custom/ as files with a .zsh extension.

I can make a file of aliases there using the keyword "alias" as normal. However, when I try making a file with the line "source ~/.aliases" -- this does not work.

What is the best way to go about this? Should I ditch the recommendation to use the oh-my-zsh/custom/ folder and instead source from .zshrc ?

0

2 Answers 2

4

You should just symlink your main file in the custom dir.

ln -s ~/.aliases ~/.oh-my-zsh/custom/aliases.zsh
8

My understanding is that you are trying to add your custom file aliases.zsh to the directory .oh-my-zsh/custom/

I just did this and tried using one of the aliases I defined in the file and it worked. Just make sure you restart your terminal's session and have the correct alias formatting alias zshconfig="mate ~/.zshrc"

2
  • I was trying to make an aliases.zsh file that consisted of a single line "source ~/.aliases"
    – Elfen Dew
    May 24, 2018 at 4:16
  • 2
    I want to keep my alias dotfile ~/.aliases and have zsh source this file. I could only accomplish this by adding "source ~/.aliases" to the .zshrc file, but I was trying to follow the recommended format for adding custom aliases with oh-my-zsh. The reason I was doing it this way is because I wanted a single .aliases file independent of what shell I'm using.
    – Elfen Dew
    May 24, 2018 at 4:21

You must log in to answer this question.

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