Fastest, configurable and extensible zsh plugin manager
Zpm is a plugin manager for ZSH who combines the imperative and declarative approach. At first run, zpm will do complex logic and generate cache, after that will be used cache only, so it makes this framework to be very fast.
```sh zsh -i -c exit 0.00s user 0.00s system 102% cpu 0.006 total zsh -i -c exit 0.01s user 0.00s system 101% cpu 0.006 total zsh -i -c exit 0.00s user 0.01s system 99% cpu 0.006 total zsh -i -c exit 0.01s user 0.00s system 102% cpu 0.007 total zsh -i -c exit 0.00s user 0.00s system 100% cpu 0.007 total zsh -i -c exit 0.01s user 0.00s system 100% cpu 0.007 total zsh -i -c exit 0.00s user 0.00s system 101% cpu 0.007 total zsh -i -c exit 0.00s user 0.00s system 100% cpu 0.006 total zsh -i -c exit 0.00s user 0.00s system 101% cpu 0.007 total zsh -i -c exit 0.00s user 0.00s system 100% cpu 0.008 total ```
```sh zsh -i -c exit 0.14s user 0.05s system 85% cpu 0.219 total zsh -i -c exit 0.14s user 0.05s system 43% cpu 0.436 total zsh -i -c exit 0.14s user 0.05s system 58% cpu 0.325 total zsh -i -c exit 0.12s user 0.07s system 90% cpu 0.206 total zsh -i -c exit 0.15s user 0.05s system 84% cpu 0.231 total zsh -i -c exit 0.15s user 0.04s system 46% cpu 0.407 total zsh -i -c exit 0.13s user 0.06s system 62% cpu 0.306 total zsh -i -c exit 0.11s user 0.08s system 83% cpu 0.227 total zsh -i -c exit 0.14s user 0.05s system 47% cpu 0.403 total zsh -i -c exit 0.11s user 0.08s system 62% cpu 0.307 total ```
```sh zsh -i -c exit 0.09s user 0.03s system 83% cpu 0.144 total zsh -i -c exit 0.10s user 0.02s system 29% cpu 0.412 total zsh -i -c exit 0.10s user 0.02s system 69% cpu 0.173 total zsh -i -c exit 0.10s user 0.03s system 73% cpu 0.165 total zsh -i -c exit 0.10s user 0.02s system 81% cpu 0.150 total zsh -i -c exit 0.10s user 0.02s system 71% cpu 0.170 total zsh -i -c exit 0.10s user 0.02s system 85% cpu 0.141 total zsh -i -c exit 0.10s user 0.02s system 42% cpu 0.283 total zsh -i -c exit 0.11s user 0.02s system 68% cpu 0.176 total zsh -i -c exit 0.10s user 0.02s system 75% cpu 0.161 total ```
```sh zpm-zsh/helpers zpm-zsh/colors zpm-zsh/tmux zpm-zsh/vte zpm-zsh/core-config zpm-zsh/ignored-users zpm-zsh/check-deps zpm-zsh/minimal-theme zpm-zsh/material-colors zpm-zsh/pr-is-root zpm-zsh/pr-user zpm-zsh/pr-return zpm-zsh/pr-exec-time zpm-zsh/pretty-time-zsh zpm-zsh/pr-git zpm-zsh/pr-cwd zpm-zsh/pr-php zpm-zsh/pr-rust zpm-zsh/pr-node zpm-zsh/pr-2 zpm-zsh/pr-eol zpm-zsh/pr-zcalc zpm-zsh/pr-correct zpm-zsh/ls zpm-zsh/colorize zpm-zsh/ssh zpm-zsh/dot zpm-zsh/undollar zpm-zsh/dropbox lukechilds/zsh-better-npm-completion zpm-zsh/clipboard zpm-zsh/mysql-colorize zpm-zsh/zshmarks voronkovich/gitignore.plugin.zsh zpm-zsh/autoenv mdumitru/fancy-ctrl-z zsh-users/zsh-history-substring-search zdharma/fast-syntax-highlighting zsh-users/zsh-autosuggestions psprint/history-search-multi-word zpm-zsh/zpm-readme zpm-zsh/zpm-info zpm-zsh/zpm-telemetry zpm-zsh/zpm-link @omz/extract @omz/command-not-found @omz/pip @empty/npm @empty/rustup zpm-zsh/create-zsh-plugin ```
Add the following text into .zshrc
if [[ ! -f ~/.zpm/zpm.zsh ]]; then
git clone --recursive https://github.com/zpm-zsh/zpm ~/.zpm
fi
source ~/.zpm/zpm.zsh
If you don't have .zshrc
copy example of .zshrc
from zpm
ln -sf ~/.zpm/zshrc ~/.zshrc
Currently zpm has following commands
The set of commands can be expanded extended using plugins
- [zpm-readme](https://github.com/zpm-zsh/zpm-readme) - Show plugin readme in terminal - [zpm-info](https://github.com/zpm-zsh/zpm-info) - Show plugin info in terminal - [zpm-telemetry](https://github.com/zpm-zsh/zpm-telemetry) - Send telemetry data. Keep calm. Data is sent using GitHub and you can see it before sending.
Important
Be carefully, zpm doesn't guarantee loading order in call. So if you need to load a plugin before antoher, you should do 2 separate
zpm load
calls. This is very important for oh-my-zsh plugins, because @omz-core should be loaded before
Plugin name must have next form: @plugin-type/user/plugin-name
. This plugin can be enabled using
# Add to `~/.zshrc` after zpm initialization:
zpm load @plugin-type/user/plugin-name
Notice: if you change
~/.zshrc
, you need to remove zpm cache using:zpm clean
Additionaly they can have some tags. Tags must be separated by commas ,
without spaces, tag parameters must be separated from tag names or another tag parameters by :
# plugin type
# | plugin name
# | | tag
# | | | tag parameters,
# | | | divided by `:` boolean tag
# | | | | |
# ↓ ↓ ↓ ↓ ↓
@type/some/plugin,apply:source:path:fpath,async
If plugin name starts with @word
, this word will be used as plugin type. Plugin name will be used to detect plugin origin url.
@github/
or @gh/
- plugin will be cloned from GitHub, this is default value, so you don't need to set it
@gitlab/
or @gl/
- plugin will be cloned from GitLab
@bitbucket/
or @bb/
- plugin will be cloned from Bitbucket
@git/
- plugin will be cloned via git. Be careful, zpm can't detect origin for this plugin type, you must specify origin using tag origin:
@gist/
- plugin will be downloaded from GitHub Gist
@omz/
- zpm will use a plugin from oh-my-zsh, oh-my-zsh will be download if not installed. Important: you shoud load @omz
before any other plugin from on-my-zsh: zpm load @omz
.
@omz/theme/
- will load a theme from omz dir: <omz-dir>/themes/*.zsh-theme
@omz/lib/
- will load a lib from omz dir: <omz-dir>/lib/*.zsh
See: https://github.com/zpm-zsh/zpm/issues/24
# Pull in OMZ (doesn't actually source anything)
zpm load @omz
# Load any OMZ libraries we want or our OMZ plugins require
zpm load \
@omz/lib/compfix \
@omz/lib/completion \
@omz/lib/directories \
@omz/lib/functions \
@omz/lib/git \
@omz/lib/grep \
@omz/lib/history \
@omz/lib/key-bindings \
@omz/lib/misc \
@omz/lib/spectrum \
@omz/lib/theme-and-appearance
# Load some OMZ plugins and theme
zpm load \
@omz/virtualenv \
@omz/git
zpm load @omz/theme/robbyrussell
@dir
- special type, zpm will create a symlink to local directory from origin
tag
@file
- special type, zpm will create a symlink to file from origin
tag. Should be used for plugins that are written in single file, without additional dependencies
@remote/
- plugin will be downloaded using curl, for example from an HTTP site. Be careful, zpm can't detect origin for this plugin type, you must specify origin using tag origin:
@exec/
- special type, zpm will create plugin, completion or binary via executing of origin
tag content. See destination
tag
@empty/
- special type, zpm will create empty dir without files. Useful with hook
tag.
plugin-from/github # @github doesn't necessary
@gitlab/plugin-from/gitlab
@bitbucket/plugin-from/bitbucket
@omz/some-plugin
@empty/custom/empty-plugin
@empty/another-empty-plugin
apply
tagThis tag has 3 possible arguments divided by :
source
- load zsh plugin file, enabled by default. File name can be changed using source
tagpath
- add directory to your $PATH
, by default - /bin
dir, enabled by default. Directory name can be changed using path
tagfpath
- add directory to your $fpath
, by default or /functions
dir if it exists, or plugin root dir if exist at least one _*
file, enabled by default. Directory name can be changed using fpath
tagzpm load some/plugin,apply:source:path:fpath
zpm load another/plugin,apply:path # zpm will only add /bin dir to $PATH, plugin will not be sourced, nor be added to $fpath
async
tagIf this tag is present, zsh plugin will be loaded async
source
tagDefine own file that will be loaded
zpm some/plugin,source:/other.file.zsh
path
and fpath
tagsUsing these tags you can change the destination of folders which will be added to $PATH
or $fpath
zpm some/plugin,path:/executables
zpm another/plugin,fpath:/completions
autoload
tagThis tag defines functions that will be autoloaded by zpm (using autoload -Uz
) divided by :
zpm load some/plugin,autoload:one:two:three
origin
tagAll plugins have internal origin type property, like: git, dir, file, remote. You can define own origin, but you can't mix different types of origin types. So, you can define Gitlab origin for GitHub plugin, or different origin for GitHub Gist plugin.
@github
, @gitlab
, @bitbucket
, @git
zpm load some/plugin,origin:https://github.com/another/origin # This plugin will be loaded from https://github.com/another/origin, but will have internal name some/plugin
zpm load @git/my-plugin,git://my.site/plugin.git # This plugin will be loaded from 3-party origin
@gist
, @remote
zpm load @gist/user/hash,origin:https://another-site/file.zsh # This file will be downloaded instead of gist
zpm load @remote/plugin,origin:https://mysite.com/plugin.zsh # In this case origin should be declared, because zpm can't detect origin
@dir
zpm load @dir/plugin,origin:/home/user/Projects/plugin # Internal plugin directory will be linked to your local directory
@file
zpm load @file/plugin-file,origin:/home/user/Projects/plugin.zsh # Internal plugin file will be linked to your local file
@empty
, @omz
, @omz/theme
, @omz/lib
Do not declare own origin:
, because this can produce side effects
hook
tagThis tag parameter contains command who will be run in the plugin directory after instalation or upgrade
zpm plugin/name,hook:"make; make install"
if
and if-not
conditionsIf condition allows you to run the following commands only if the condition is true
zpm if some-condition (another commands)
Conditions:
linux
- if current OS is Linuxbsd
- if current OS is *BSDopenwrt
- if current OS is OpenWrtmacos
- if current OS is macOStermux
- if current session run in Termuxssh
- if session run on remote hostvte
- if session run on VTE based terminal emulatorResult of condition can be negated using if-not
tag
The condition can be combined zpm if macos if-not ssh load repo/plugin
Notice: conditions will be verified only at first run, after that will be used generated cache
Run zpm upgrade
for upgrading, or run zpm upgrade some-plugin another-plugin
if you want to upgrade only these plugins
By default zpm will generate cache file at first run, but if you will change ~/.zshrc
this cache should be removed using zpm clean
command
You can use another mirror for GitHub/Gitlab/Bitbucket:
# Declare this before zpm load
GITHUB_MIRROR="https://hub.fastgit.org"
GITLAB_MIRROR="Some url"
BITBUCKET_MIRROR="Some url"
Powerlevel10k loads extra modules in its installation directory, which it automatically detects by taking the file containing its init code, making it absolute, and taking its directory. However, as zpm combines plugins into one fast-loading cache file, this automatic detection would break.
As a workaround, you have to explicitly tell Powerlevel10k where it is installed. This needs to be done before the cache file is loaded, which means before zpm itself is loaded, like this:
# Adjust the path accordingly if your zpm is not installed at `~/.zpm` or you're
# using a powerlevel10k fork
export POWERLEVEL9K_INSTALLATION_DIR=~/.zpm/plugins/romkatv---powerlevel10k
source ~/.zpm/zpm.zsh
# ...
zpm load romkatv/powerlevel10k
If you have problems with zpm
try updating:
rm -rf "${TMPDIR:-/tmp}/zsh-${UID:-user}" # clear the cache
cd ~/.zpm
git pull
You can see debug information by setting the system variable
DEBUG=zpm
When you make changes, add information about them to the change log in next section. Also add link to pr and link to your GitHub profile.
zpm load
, zpm upgrade
or zpm subcommand
will complete only one argument6.0
5.3
5.2
5.1
5.0
gen-plugin
and gen-completion
tags@omz-theme/
and @omz-lib/
changed to @omz/theme/
and @omz/lib/
4.2
4.1
4.0
@gist
, @remote
3.6
@dir
and @file
@link
now is an alias for @dir
3.5
3.4
3.3
origin
tagautoload-all
tag3.2
3.1
3.0
@link
tr
callstype:
tagzpm load @omz-theme/theme-name
zpm load @omz-lib/lib
zpm load @omz
if you use at least one oh-my-zsh plugin.type:plugin-type
with @plugin-type/plugin/name
2.3
zsh_loaded_plugins
2.2
2.1
/functions
and /bin
will be copied into single dir, in zpm cache dirzpm
to @zpm
zpm u @zpm
2.0
omz/
prefix replaced by @omz/
empty
autoload
and autoload-all
tagsgen-plugin
and gen-completion
tagsomz/
to @omz/
in your .zshrc