How can I fix not working oh-my-zsh plugins
Asked Answered
P

15

32

I've just discovered oh-my-zsh, but I can't get it to work. While themes work just perfectly, plugins do not. I have some plugins selected, eg. macports, but neither I get port command completion nor do appropriate aliases work. Here's my ~/.zshrc:

# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
export ZSH_THEME="steeef"

# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# export DISABLE_AUTO_TITLE="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git osx github macports textmate svn)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...
export
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/opt/local/bin:/opt/local/sbin

textmate and osx plugins also do not seem to work. zsh complains about unknown command and stops. git and svn have some basic completion but I'm not sure whether it's done by plugin or just a normal zsh completion. Do I have to export something to use those plugins? Or if not, what to do to have that fixed?

Perineum answered 23/7, 2011 at 14:15 Comment(4)
how did you conclude they're not working? can you paste zsh errors here?Menashem
the errors are just a normal output like "command not found" when typing command that should be available.Perineum
can you paste the path you ended up using that worked for you? I'm having the same issue and it would be really helpfulQuiddity
Sorry, it was 2 years ago, I have changed my system and no longer use oh-my-zsh because of poor performance compared to properly configured bash.Perineum
S
16

I got bitten by this.

What happened is you did a manual install and the instructions for the manual install don't mention that you need to set the PATH yourself.

So you end up with the default PATH. The source for the automatic setup code copies your current path and appends it to the .zshrc, which isn't enough if you depend on non-standard PATH entries (e.g. you run Homebrew on a Mac).

So the fix is simple:

Fire up your old shell and its configuration file and then copy and paste the value of $PATH into the top of your ~/.zshrc file.

Ciao!

Sooty answered 22/11, 2011 at 8:57 Comment(1)
Do you know why this would cause your plugins not to work (what does zsh need on the path?) I cannot seem to get mine to work (on arch linux).Moshemoshell
A
66

Make sure that you define your plugins variable before you initialize zsh:

plugins=(git wd)
export ZSH=/home/<user>/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
Astridastride answered 11/3, 2016 at 0:6 Comment(5)
With me the problem was that: I had plugins bar after ZSH lin:Guerrilla
for me the solution was to move source $ZSH/oh-my-zsh.sh to the end of .zshrc, after all of my user configs.Crosscurrent
on further investigation the issue looks to be having source $ZSH/oh-my-zsh.sh before setting vi mode on with bindkey -v and remapping some zsh shortcuts and some keys in vi mode, otherwise plugins work as normal. the issue is that if you source after, vi mode stops working. the OMZ plugin in question is fzf.Crosscurrent
I had # before plugins :DBenitez
In my case it was export ZSH=$HOME/.oh-my-zsh which solved the problem thanks!Mog
S
16

I got bitten by this.

What happened is you did a manual install and the instructions for the manual install don't mention that you need to set the PATH yourself.

So you end up with the default PATH. The source for the automatic setup code copies your current path and appends it to the .zshrc, which isn't enough if you depend on non-standard PATH entries (e.g. you run Homebrew on a Mac).

So the fix is simple:

Fire up your old shell and its configuration file and then copy and paste the value of $PATH into the top of your ~/.zshrc file.

Ciao!

Sooty answered 22/11, 2011 at 8:57 Comment(1)
Do you know why this would cause your plugins not to work (what does zsh need on the path?) I cannot seem to get mine to work (on arch linux).Moshemoshell
B
4

I had the same problem just now! There was a package called grml-zsh-config installed in my Archlinux. I removed this package and oh-my-zsh themes started to work.

Burkes answered 14/1, 2014 at 22:0 Comment(0)
D
4

In my case, in ~/.zshrc I had repeated plugins variable

plugins=(git)
.
.
.
plugins=(git autojump zsh-syntax-highlighting zsh-autosuggestions)

Check to see if this is the case with you because with this only your git plugin will be used.

Remove the first plugins variable and it should work.

Downwards answered 25/7, 2021 at 9:10 Comment(0)
M
1

Try manually source your plugins like this:

source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Full .zshrc example:

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)

plugins=(zsh-autosuggestions)

source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
Mittel answered 17/5, 2022 at 7:43 Comment(0)
N
0

I was running into this with the kubectl plugin.

Looking at the contents of ~/.oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh I realized I didn't have the same content as what was on the github repo. Manually updating the file with the contents from the oh-my-zsh repo helped and the plugin started to work. Guess I had to update my oh-my-zsh installation to get the latest plugin content but this worked for me.

Nunciata answered 28/8, 2019 at 16:7 Comment(0)
B
0

In my case,I forgot to add custom plugin name to .zshrc file:

plugins=(customPluginName)

And reload .zshrc:

source ~/.zshrc
Body answered 24/2, 2020 at 10:40 Comment(0)
B
0

make sure the folders of the plugins are located in the ~/.oh-my-zsh/custom/plugins folder. I will advise you are on this directory when you git clone the plugins.
Secondly ensure that you seperate the list of plugins in the ~/.zshrc file with a single space NOT comma.

.
.
.
plugin = (git zsh-syntax-highlighting)

.
.
.

So in the above example, two plugins are added there: git and zsh-syntax-highlighting.

Bebeeru answered 27/1, 2022 at 3:50 Comment(0)
M
0

If your .zshrc has this at the top

export ZSH="~/.oh-my-zsh"

try to changing it to:

export ZSH="$HOME/.oh-my-zsh"
Mog answered 24/2, 2022 at 17:16 Comment(0)
N
0

After installing the custom plugins manually, moving them to the $ZSH_CUSTOM/plugins/ location solved the issue.

Nematic answered 29/3, 2023 at 7:10 Comment(0)
B
0

i have the same problem,when i writen:

plugins=(git node)

it didn't work

so i installed node again and add path to PATH

export PATH="/opt/homebrew/opt/node@18/bin:$PATH"
Botryoidal answered 4/5, 2023 at 2:49 Comment(0)
W
0

Make sure that cli tools/commands referred by plugins are already installed. For example, it will fail if you include kubectl plugin while you didn't install kubectl beforehand

Wingback answered 8/11, 2023 at 14:50 Comment(0)
D
0

Many of the plugins are dependent on certain binaries existing and will silently fail to install if that binary is not found on the $PATH.

Ex: the kubectl plugin requires kubectl to be installed - the plugin script just bails and doesn't even install the aliases if it can't find the command on the $PATH.

This check is at the start of many such plugins

if (( ! $+commands[kubectl] )); then
  return
fi

Note: This means you need to initialize brew before any plugins based on binaries that are installed via brew will work.

I found that putting the brew plugin at the start of the list seems to work as well as oh-my-zsh seems to initialize the plugins in order. Your results may vary.

This works (kubectl aliases are installed):

plugins=(brew kubectl)

source $ZSH/oh-my-zsh.sh

This does not work (kubectl aliases are not installed):

plugins=(kubectl brew)

source $ZSH/oh-my-zsh.sh
Delphiadelphic answered 27/1 at 0:56 Comment(0)
T
0

The plugin copydir was replaced ,the new one is called copy path.replace ment from the source

Tish answered 3/5 at 2:57 Comment(1)
Nothing on this thread mentions copydir, so more context and explanation is needed. Even if it did, though, this is commentary, not an answer.Rodneyrodolfo
C
0

Considering all the answers here, also make sure that you have defined the plugins correctly. I had it misconfigured like this,

plugins=(git)
.....
plugins=(git custom-plugin)

what you can do is,

plugins=(git custom-plugin)
Christenson answered 6/7 at 3:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.