ohmyzsh: Warning: plugin zsh-syntax-highlighting not found

mac 10.14.3

Just updated to the latest oh-my-zsh by pulling master and am getting the following warning now when starting a new shell.

     Warning: plugin zsh-syntax-highlighting not found
     Warning: plugin zsh-autosuggestions not found

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 97
  • Comments: 21 (4 by maintainers)

Most upvoted comments

I solve it by the command :

‘’’ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ‘’’

on-my-zsh check if the plugin is exit at ‘$base_dir/plugins/$name/$name.plugin.zsh’ or ‘$base_dir/plugins/$name/_$name’ , so the plugin should be at this path .

As described in #7690 users may have ZSH plugins installed by other tools (e.g. Homebrew) and are not sourced in $ZSH/plugins. These should not be referenced inside plugins=(…) within the .zshrc

To be fair zsh-users has proper installation instructions depending on OS for each of those plugins…

You need to follow your preferred options for your OS / package manager etc.

For me,

Reason:

  1. zsh-syntax-highlighting was installed by other tools (for me, homebrew), so there is not ‘zsh-syntax-highlighting’ folder in path ‘~/.oh-my-zsh/custom/plugins/’ or other path like that.

  2. There is a line plugins=(git zsh-syntax-highlighting) in ~/.zshrc, so when terminal starts, it searches for ‘zsh-syntax-highlighting’ in path as described above.

Solution:

As I have tested, both are OK, and you can choose one of them

  1. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

  2. Remove the line plugins=(git zsh-syntax-highlighting) in ~/.zshrc

Notes:

Solution 2 is elegant and recommended, because solution 1 means that you install the plugin twice, one by homebrew, and one by manually

autosuggestions

我在插件列表中 去掉 autosuggestions和zsh-syntax-highlighting,但是结果也是可以使用的.不解~~~

I think as long as you add

source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

somewhere in your zshrc file you’ll be good to go. The INSTALL doc should cover that. Better ask over there next time though.

I solve it by the command :

‘’’ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ‘’’

on-my-zsh check if the plugin is exit at ‘$base_dir/plugins/$name/$name.plugin.zsh’ or ‘$base_dir/plugins/$name/_$name’ , so the plugin should be at this path .

Thanks! It’s working.

I use the second method mentioned above, and it solve my issue. Remove the line plugins=(git zsh-syntax-highlighting) in ~/.zshrc The only difference is that there are several plugins inside the (), I only remove zsh-syntax-highlighting, but keep the other plugins. Here is the detailed step in the terminal in case anyone want to know how to do:

  1. vim ~/.zshrc
  2. inside vim, press i , enter insert mode
  3. remove zsh-syntax-highlighting from the plugins
  4. enter Esc
  5. enter :wq to save and escape from vim Now you can open a new terminal use command + T, and the annoying warning is not showing anymore.

If you used brew to install zsh-syntax-highlighting, you need to open the $HOME/.zshenv file, remove the lines related to zsh-syntax-highlighting, and then restart your terminal, which can be configured in $HOME/.zshrc file 😭

I think as long as you add

source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

somewhere in your zshrc file you’ll be good to go. The INSTALL doc should cover that. Better ask over there next time though.

Thanks & yes, this works. But being able to just include this with the other plugins and thus using the normal syntax would be nice. 🤷‍♂️

Having the same problem here on my Raspberry Pi 4. After sudo apt-get install zsh-syntax-highlighting I found that the package was not installed in my .oh-my-zsh/custom/plugins folder but instead here:

pi@raspberrypi  ~  dpkg -L zsh-syntax-highlighting
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/zsh-syntax-highlighting
/usr/share/doc/zsh-syntax-highlighting/README.Debian
/usr/share/doc/zsh-syntax-highlighting/README.md
/usr/share/doc/zsh-syntax-highlighting/all.md.gz
/usr/share/doc/zsh-syntax-highlighting/changelog.Debian.gz
/usr/share/doc/zsh-syntax-highlighting/changelog.gz
/usr/share/doc/zsh-syntax-highlighting/copyright
/usr/share/doc/zsh-syntax-highlighting/highlighters
/usr/share/doc/zsh-syntax-highlighting/highlighters/brackets.md
/usr/share/doc/zsh-syntax-highlighting/highlighters/cursor.md
/usr/share/doc/zsh-syntax-highlighting/highlighters/line.md
/usr/share/doc/zsh-syntax-highlighting/highlighters/main.md
/usr/share/doc/zsh-syntax-highlighting/highlighters/pattern.md
/usr/share/doc/zsh-syntax-highlighting/highlighters/root.md
/usr/share/doc/zsh-syntax-highlighting/highlighters.md
/usr/share/zsh-syntax-highlighting
/usr/share/zsh-syntax-highlighting/.revision-hash
/usr/share/zsh-syntax-highlighting/.version
/usr/share/zsh-syntax-highlighting/highlighters
/usr/share/zsh-syntax-highlighting/highlighters/brackets
/usr/share/zsh-syntax-highlighting/highlighters/brackets/brackets-highlighter.zsh
/usr/share/zsh-syntax-highlighting/highlighters/cursor
/usr/share/zsh-syntax-highlighting/highlighters/cursor/cursor-highlighter.zsh
/usr/share/zsh-syntax-highlighting/highlighters/line
/usr/share/zsh-syntax-highlighting/highlighters/line/line-highlighter.zsh
/usr/share/zsh-syntax-highlighting/highlighters/main
/usr/share/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh
/usr/share/zsh-syntax-highlighting/highlighters/pattern
/usr/share/zsh-syntax-highlighting/highlighters/pattern/pattern-highlighter.zsh
/usr/share/zsh-syntax-highlighting/highlighters/root
/usr/share/zsh-syntax-highlighting/highlighters/root/root-highlighter.zsh
/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Now, should I manually move/copy that over to the correct location in my ~/.oh-my-zsh folder or is there a correct way to install such a plugin?

Later, I guess I’ll come back and watch this post.

You can remove the plugin from the oh-my-zsh plugin.

In case of me, I installed the plugins using zplug, but in oh-my-zsh, I could not find the plugins installed with zplug and I got an error.

So I removed the oh-my-zsh plugin entry from .zsh.

https://github.com/ujuc/dotrc/commit/e2537072f7ee3fec4cd3c49afc3a06f0c60a3be1