How can I fix not working oh-my-zsh plugins - zsh

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?

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

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!

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.

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.

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.

In my case,I forgot to add custom plugin name to .zshrc file:
plugins=(customPluginName)
And reload .zshrc:
source ~/.zshrc

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.

If your .zshrc has this at the top
export ZSH="~/.oh-my-zsh"
try to changing it to:
export ZSH="$HOME/.oh-my-zsh"

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

Related

How to solve zsh compinit: insecure directories issue on MacOS (other solutions failed)

I'm aware there are many copies of this question here, but all of their answers recommend adding
ZSH_DISABLE_COMPFIX="true"
to the top of my ~/.zshrc file. I have done this and still every time I open zsh I am greeted with
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
It seems that others asking this question didn't have the quotes around the true in the first sample, but I have added that. I have also run
source ~/.zshrc
Which as far as I can tell reloads the zshrc configuration. This still gives me the above warning. I'm not sure if any of these details could be relevant but I'll include them:
This is a new zsh installation on an M1 Macbook running Big Sur
I also have Oh My Zsh installed on top of zsh
I earlier ran several export commands to set my nvm directory but I don't think that would be relevant
Any idea how to resolve this permissions issue? Thanks
Edit:
compaudit returns
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
Also, here are the other nonstandard entries in my ~/.zshrc file (in order, but there is some built-in stuff inbetween):
ZSH_DISABLE_COMPFIX="true"
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
export PATH=$HOME/bin:/usr/local/bin:$PATH
plugins=(git)
source $ZSH/oh-my-zsh.sh
zstyle :compinstall filename '/Users/jonahsaltzman/.zshrc'
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
autoload -Uz compinit
compinit
First of all, one problem here is that you’re running compinit twice: Once through OMZ (Oh My Zsh) – when you do source $ZSH/oh-my-zsh.sh – and once manually. You have two options to fix this:
If you want to keep using OMZ, then you should remove the bottom 3 lines from your .zshrc file.
If you want to stop using OMZ, then instead, you should remove both plugins=(git) and source $ZSH/oh-my-zsh.sh
Secondly, note that $ZSH_DISABLE_COMPFIX is specific to OMZ and is not used by compinit itself. It has no effect when you call compinit manually. You can remove it from your .zshrc
Finally, compinit doesn’t show that warning for nothing. Rather than suppress it, you should instead do chmod g-w,o-w on the directories listed by compaudit. That will fix the problem and make the warning go away.
You want to use:
compinit -u
To disable the annoying permissions test. It doesn't add any security on macOS. See the documentation at zshcompsys(1).

Plugin not found even though not specified anywhere

So I just moved to iTerm2 and zsh, along with OMZ. I am getting this error constantly when opening up a new terminal session:
[oh-my-zsh] plugin 'hub' not found
[oh-my-zsh] plugin 'colored-man-page' not found
Now, even uninstalling and installing OMZ I get this. I am not sure where this plugin is called but my zshrc file contains:
plugins=(git wd last-working-dir)
export ZSH=/Users/doron.katz/.local/share/oh-my-zsh
source $ZSH/oh-my-zsh.sh
source /Users/doron.katz/.local/share/oh-my-zsh/plugins/colored-man-page/colored-man-pages.plugin.zsh
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"export PATH="/usr/local/sbin:$PATH"
POWERLEVEL9K_MODE='nerdfont-complete'
source ~/powerlevel9k/powerlevel9k.zsh-theme
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs newline status)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
I have even added source /Users/doron.katz/.local/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh.
The folder exists, but not sure who is calling that plugin anyway.. THe same for HUB.
Please help!

oh-my-zsh not fully loading - have to source .zshrc

https://streamable.com/07mqf
I have a video showing have it have to do to get this to work.
I have tried based on suggestions in stackoverflow to move the source $ZSH/oh-my-zsh.sh after the POWERLEVEL9k command line parameters. This did not work and even when I load the source file would not show the line as it should.
Here is my config file.
https://hastebin.com/otolobihuw.makefile
Try sourcing the p9k theme file after setting all the p9k variables. You need to move
source /usr/share/zsh-theme-powerlevel9k/powerlevel9k.zsh-theme
to the end of your zshrc file.
I'm also not really sure what conflicts there may or may not be with having an ohmyzsh theme set in addition to sourcing p9k, but if it works okay for you after manually sourcing your zshrc again then moving the loading of the theme to after all the theme settings should be sufficient.
I was answered in another forum. This resolved my issue I just moved the powerlevel9k to the bottom of my .zshrc file.

Configure atom package options from command line?

I'm writing a shell script I can run on a new machine to install my apps, set preferences, arrange dock, and add homebrew packages, and I'd like to be able to configure atom packages within the script instead of manually. Is this possible?
Edit: Also I'd like to change the theme from command line, is that possible?
cd ~/.atom
touch init.coffee
echo "atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])" >> init.coffee
Atom configuration settings are stored as CSON text in config.cson in the .atom directory. So, for example, if you ran
atom.config.set('core.themes', ['THEME_HERE', 'SYNTAX_THEME_HERE'])
from inside Atom, in the config.cson file, you would see:
"*":
core:
themes: [
"THEME_HERE"
"SYNTAX_THEME_HERE"
]
So, you can write directly to this file from your shell script to configure Atom. You can also change config.cson to config.json and use JSON (instead of CSON) to configure the editor, which can make it easier to use things like jq to work with the file.

How do I find where ElasticSearch is installing my plugins?

I have installed elasticsearch with brew install elasticsearch. My plugins seem to reside in /usr/local/Cellar/elasticsearch/0.19.8/plugins. With cat $( which plugin ) I see a ES_HOME variable that contains the correct path.
Is there a way to ask elastic for ES_HOME or the plugins directory?
EDIT
What I am looking for is the directory used by the plugin executable to install the plugins when I do plugin -install something. I want to use that path in a script to fire up elastic search.
To find your elasticsearch home directory & install plugin(s) follow these steps below.
Locate your home directory ( Look for Settings -> Path -> Home for value )
$ curl "localhost:9200/_nodes/settings?pretty=true"
Goto Location (Example settings.path.home value: /usr/local/Cellar/elasticsearch/1.5.0)
$ cd /usr/local/Cellar/elasticsearch/1.5.0
Install Plugin (Example plugin: mobz/elasticsearch-head)
$ bin/plugin -install mobz/elasticsearch-head
I used this command:
$ curl "localhost:9200/_nodes?pretty=true&settings=true"
Check next setting: nodes - settings - path - plugins and use it as your plugins directory.
I had the same problem as you and I was able to locate the ES_HOME directory by following
#imotiv's suggestion.
Simply call PATH_TO_SERVER:9200/_cluster/nodes?settings=true&pretty=true
Therein you'll see the path.home entry. That is your ES working directory.
Once you locate your ElasticSearch home folder, in my case /usr/share/elasticsearch, cd down to that location.
Once there, you could simply run bin/plugin -install elasticsearch/elasticsearch-analysis-phonetic/1.3.0 and it will automatically do the rest for you.
Hope this helps.
Not totally sure what you are trying to achieve, but hopefully this will help. There are a couple of way to find the plugins directory for elasticsearch. You can set plugins: TRACE in the logging.yml file, it will cause elasticsearch to log the full path of plugins that it's loading. You can also execute
$ curl "localhost:9200/_cluster/nodes?settings=true&pretty=true"
to check the current settings. Elasticsearch is using location specified in the path.plugins settings to load plugins. If path.plugins is not set, it will use plugins directory in the directory specified by the path.home setting.

Resources