Skip to content

Plugins

Pascal Zarrad edited this page Apr 27, 2025 · 7 revisions

Plugins are the opposite of templates - they provide rich functionality by allowing the extension of psh. They enable the possibility to built complex logic (or even call external scripts like a python helper script) to generate something that is system specific (like find something and put the path of it into the .zshrc).

For example, plugins are used by psh to apply all the Antidote plugins.

Creating a plugin

To create a plugin, you have to add a create a yourplugin.sh in the plugins folder of psh. You should add a bash shebang at the top of the plugin's script. Also it is recommended to add a header that contains all information about the plugin. From there, you're free to use anything that bash can do. The API can help you to interact with the .zhsrc.

#!/bin/bash

#==================================================================
# Script Name   : psh-node-installer
# Description	: Enables oh-my-zsh's node and npm plugin
# Args          : -
# Author       	: Pascal Zarrad
# Email         : P.Zarrad@outlook.de
#==================================================================

apply_ohmyzsh_plugin "node"
apply_ohmyzsh_plugin "npm"
apply_ohmyzsh_plugin "bower"
apply_ohmyzsh_plugin "grunt"
apply_ohmyzsh_plugin "bundler"

For example, the plugin that adds extensions that are useful for working with NodeJS.

API

psh comes with some API functions to simplify the creation of plugins. All custom functions/commands can be found in the below table.

Command Function
write_zshrc Write some content to the .zshrc
write_antidote_plugins_list Write some content to the antidote plugins list
apply_plugin Add a plugin to the antidote plugins list
apply_plugin_version Add a plugin in a specific version to the antidote plugins list
apply_ohmyzsh_plugin Add an Oh My ZSH plugin to load to the antidote plugins list
apply_ohmyzsh_theme Add a theme from Oh My ZSH to load to the plugins list
Clone this wiki locally