Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are only certain plugins in zsh working while others aren't?

This is my full .zshrc:

export ZSH="/Users/butters/.oh-my-zsh"

source $ZSH/oh-my-zsh.sh
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh

plugins=(
    git
    bundler
    dotenv
    osx
    zake
    zsh-syntax-highlighting
    zsh-autosuggestions

)

It seems that only when source $ZSH/oh-my-zsh.sh is placed above the rest, my custom plugins work but all the other plugins such as osx stop working. When I placed it below the rest, osx works but zsh-syntax-highlighting and zsh-autosuggestions stop working.

like image 410
thatsalva Avatar asked Oct 24 '25 11:10

thatsalva


1 Answers

There are three problems in your setup:

  • plugins is an array used by $ZSH/oh-my-zsh.sh. You need to initialize the former before calling the latter. Just initializing plugins by itself doesn't do anything special in plain Zsh (apart from creating a plain old array).
  • zsh-syntax-highlighting and zsh-autosuggestions mention explicitly in their documentation that they should be sourced after any other plugins.
  • If you're going to manually source a plugin, then you do not need to add it to Oh-My-Zsh's plugins array.

So, therefore, for your setup, this is the correct way to do things:

ZSH=~/.oh-my-zsh
plugins=(
    git
    bundler
    dotenv
    osx
    zake
)
source $ZSH/oh-my-zsh.sh

source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
like image 81
Marlon Richert Avatar answered Oct 27 '25 01:10

Marlon Richert