Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

... Where is the ZSH_CUSTOM folder located? #4865

Closed
koesherbacon opened this issue Feb 21, 2016 · 17 comments
Closed

... Where is the ZSH_CUSTOM folder located? #4865

koesherbacon opened this issue Feb 21, 2016 · 17 comments

Comments

@koesherbacon
Copy link

koesherbacon commented Feb 21, 2016

This is probably me just being a bonehead, but where can I find the ZSH_CUSTOM folder so I can put my custom aliases in there as instructed in the .zshrc file?

Thanks a lot! I love your shell!!

@apjanke
Copy link
Contributor

apjanke commented Feb 21, 2016

By default, it is at $ZSH/custom; that is, the custom directory under your oh-my-zsh installation, which is at ~/.oh-my-zsh by default.

If you want to use a different location, you can set $ZSH_CUSTOM to a different path in your ~/.zshrc before loading oh-my-zsh.

@JohnMaguire
Copy link

JohnMaguire commented Feb 21, 2016

echo $ZSH_CUSTOM

@ndeoligence
Copy link

ndeoligence commented Jun 27, 2018

One more thing...
What must I name my aliases file within $ZSH_CUSTOM/ ?

@mcornella
Copy link
Member

mcornella commented Jun 28, 2018

Any file ending in .zsh immediately under $ZSH_CUSTOM (that is, not inside a folder) will be sourced, so you can name it anything. For example:

# works
$ZSH_CUSTOM/aliases.zsh
# doesn't work
$ZSH_CUSTOM/aliases/git.zsh

@ferrao
Copy link

ferrao commented Feb 28, 2019

Any file ending in .zsh immediately under $ZSH_CUSTOM (that is, not inside a folder) will be sourced, so you can name it anything. For example:

Would be great to have this documented somewhere, it took me a while to find this issue, was naming it .zshrc and zshrc, but nothing was working ;)

@ghost
Copy link

ghost commented Mar 23, 2019

Any file ending in .zsh immediately under $ZSH_CUSTOM (that is, not inside a folder) will be sourced, so you can name it anything. For example:

# works
$ZSH_CUSTOM/aliases.zsh
# doesn't work
$ZSH_CUSTOM/aliases/git.zsh

That's kind of inconvenient and a depart from the way that $HOME/.oh-my-zsh/plugins is with individual directories per plugin

I want to put mine in $HOME/.config/ohmyzsh/custom/plugins

The particular plugin I'm wanting to add is solarized-man.

The thing is it's a git submodule (inside my dotfile manager yadm) so the '.zsh' file needs to actually be in a "solarized-man" directory inside the plugins directory external to ~/.oh-my-zsh as that is also a submodule, and you can't have a submodule in a submodule in the master git repository.

$ ls -a $HOME/.config/ohmyzsh/custom/plugins/solarized-man/ 
.  ..  .git  LICENSE  README.md  solarized-man.plugin.zsh

If there's some way to do this?

Currently this doesn't work for me in my .zshrc

# Would you like to use another custom folder than $ZSH/custom?
ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom/plugins/

# 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)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git svn solarized-man)

I am seeing 'Warning: plugin solarized-man not found'

@mcornella
Copy link
Member

mcornella commented Mar 23, 2019

The $ZSH_CUSTOM variable should point at the root of the custom folder, not the plugins folder. So:

ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom

@ghost
Copy link

ghost commented Mar 23, 2019

Okay, if I have this in my zshrc:

# Would you like to use another custom folder than $ZSH/custom?
ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom

ie:

$ echo $ZSH_CUSTOM
/home/tya99/.config/ohmyzsh/custom

The issue is my plugin isn't being detected in:

/home/tya99/.config/ohmyzsh
└── custom
    └── plugins
        └── solarized-man
            ├── .git
            ├── LICENSE
            ├── README.md
            └── solarized-man.plugin.zsh

3 directories, 4 files

How might I go about allowing detection of this?

@ghost
Copy link

ghost commented Mar 24, 2019

The $ZSH_CUSTOM variable should point at the root of the custom folder, not the plugins folder. So:

ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom

Hmm. that didn't work for me, it seemed if I didn't specify the plugins directory, the plugin wasn't detected, even when i symlinked it to the current directory ie;

/home/tya99/.config/ohmyzsh
└── custom
    └── plugins
        ├── solarized-man
        │   ├── .git
        │   ├── LICENSE
        │   ├── README.md
        │   └── solarized-man.plugin.zsh
        └── solarized-man.plugin.zsh -> solarized-man/solarized-man.plugin.zsh

3 directories, 5 files

@mcornella
Copy link
Member

mcornella commented Mar 24, 2019

The init script looks at $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh, so ZSH_CUSTOM should be pointed at the custom directory. The symlink isn't necessary. If that doesn't work, maybe there are some changes to the OMZ repository or you don't have the latest update, but I guess that's not the case if you're getting a warning: plugin not found error.

Run zsh -xvic 'exit' &> ~/omz-debug.log and post the generated file so I can take a look.

@ghost
Copy link

ghost commented Mar 24, 2019

The plugin not found error was resolved when I removed it from plugins=(git svn), i think it was probably looking in ~/.oh-my-zsh/plugins/

The plugin is only found if I have the symlink not in the plugins directory ie:

lrwxrwxrwx 1 tya99 tya99 81 Mar 25 05:03 /home/tya99/.config/ohmyzsh/custom/solarized-man.plugin.zsh -> /home/tya99/.config/ohmyzsh/custom/plugins/solarized-man/solarized-man.plugin.zsh

I've put the omz-debug.log (REDACTED) is up.

What I am wondering is if I need to do what @apjanke suggested on IRC:

2019-03-25 21:26:56 apjanke tya99:

Maybe what you'll need to do is set $ZSH_CUSTOM to $HOME/.config/ohmyzsh/custom, write your own custom-plugin-loader.zsh, stick that in your $HOME/.config/ohymyzsh/custom directory, and have it locate your custom/plugins directory and load all the plugins from there.

@mcornella
Copy link
Member

mcornella commented Mar 24, 2019

The debug log doesn't show the problem because you took out solarized-man from the plugins array. Try again with it this time, and also redefine ZSH_CUSTOM so that it doesn't end with a trailing slash. In my system the trailing slash wasn't a problem, but maybe in Solaris is? Just to check.

@ghost
Copy link

ghost commented Mar 24, 2019

In my system the trailing slash wasn't a problem, but maybe in Solaris is? Just to check.

I'm on Linux, specifically Archlinux. Solarized is just the colorscheme.

Seems to be working now. I did just update ohmyzsh.

@@ -43,13 +43,13 @@ ZSH_THEME="risto"
 # HIST_STAMPS="mm/dd/yyyy"
 
 # Would you like to use another custom folder than $ZSH/custom?
-ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom/
+ZSH_CUSTOM=$HOME/.config/ohmyzsh/custom
 
 # 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)
 # Add wisely, as too many plugins slow down shell startup.
-plugins=(git svn)
+plugins=(git svn solarized-man)

I could have sworn I tried this earlier and it didn't. No symlink needed either.

/home/tya99/.config/ohmyzsh
└── custom
    └── plugins
        └── solarized-man
            ├── .git
            ├── LICENSE
            ├── README.md
            └── solarized-man.plugin.zsh

3 directories, 4 files

Thanks!

@mcornella
Copy link
Member

mcornella commented Mar 24, 2019

Oh I saw something about Solaris in the log, I guess I confused it with the OMZ code. Glad it's working now!

LucasLarson added a commit to LucasLarson/dotfiles that referenced this issue Mar 7, 2020
I created an `aliases.zsh` file in the `$ZSH_CUSTOM` directory (`~/.oh-my-zsh/custom` here) via @mcornella ohmyzsh/ohmyzsh#4865 (comment).
@lucawrabetz
Copy link

lucawrabetz commented Oct 6, 2020

New to oh-my-zsh and zsh. I added an alias to a file $ZSH_CUSTOM/aliases.zsh i created, restarted my terminal, and the alias was not working. Alias was added as:
alias python = "python3"

Does anything need to be sourced manually, I thought this would work as a permanent alias?

@mcornella
Copy link
Member

mcornella commented Oct 6, 2020

The equal sign needs to not have spaces around it. So:

alias python="python3"

@lucawrabetz
Copy link

lucawrabetz commented Oct 6, 2020

The equal sign needs to not have spaces around it. So:

alias python="python3"

Thank you! Problem solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants