Rohan Lekhwani
Rohan Lekhwani

Reputation: 500

How to know which ZSH configuration framework is installed?

I'm trying to automate installing a ZSH plugin depending on which configuration framework the user is running (For example - prezto or oh-my-zsh) since the install location of the plugin changes with the change in config framework.

For example, for oh-my-zsh the plugins must be installed in ~/.oh-my-zsh/custom/plugins folder whereas in prezto they must be installed in the ~/.prezto/modules folder.

Is there a way I could determine the configuration framework or a workaround to install the plugin in both these cases? Thanks in advance.

Upvotes: 1

Views: 311

Answers (1)

chepner
chepner

Reputation: 531165

Regardless of the framework in use, the location of the plugins is configurable by the user, so detecting a framework only lets you predict the default location of the plugin directory, not the directory actually in use.

Just use an environment variable like PLUGINDIR in your installer, and let the user be responsible for setting its value to ~/.oh-my-zsh/custom/plugins or ~/.prezto/modules or ~/.config/zsh/oh-my-zsh-plugs, etc., as appropriate.

Upvotes: 1

Related Questions