ZPLUG(1) | ZPLUG Manual | ZPLUG(1) |
zplug - A next-generation plugin manager for zsh
zplug ["username/reponame"[, tag:"value"[,...]]]
[<command> [<options>] [<package>]]
The word ´package´ refers to the string in the format: "username/reponame".
zplug is a super-fast next-generation plugin manager for zsh. zplug can manage everything including: zsh plugins, UNIX commands, Gist files, GitHub Releases, local plugins and so on. Unlike antigen, zplug requires no ZSH plugin file (*.plugin.zsh). It’s such a fantabulous piece of software.
--help
--version
--log
check [--verbose] [package]
clean [--force] [--select] [package]
clear
install [package]
list [--verbose] [--select] [package]
load [--verbose]
info <package>
status [--select]
update [--select] [--force] [package]
Values truthy and falsy mean any of "true, yes, on, 1" and "false, no, off, 0", respectively.
Table 1. zplug list of available tags
Tag | Description | Value (default) | Example |
as | Whether to register the package as commands or as plugins | plugin,command,theme (plugin) | as:command |
use | Specify the pattern of the files to source (for plugin) or the relative path from the package root of the file to add to $PATH (for command) / Useful, for example, with from:gh-r you can specify use:"*darwin*{amd,386}*" and so on. If you want to use extended glob, see later section for setting the zstyle. | glob (use:"*.zsh") | use:bin,use:"*.sh", use:"*darwin*" |
from | Specify the service from which you install | github,gitlab,bitbucket,gh-r,gist, oh-my-zsh,prezto,local (github) | from:gh-r |
at | Branch, tag, or commit to use | revision (master) | at:v1.5.6 |
rename-to | Specify the filename you want to rename to (only valid with as:command) | filename (-) | rename-to:fzf |
dir | Installation directory which is managed by zplug | READ ONLY | dir:/path/to/user/repo |
if | The conditions under which to install and/or use the package | commands (-) | if:"[ -d ~/.zsh ]" |
hook-build | Commands to run after installation/update | commands (-) | hook-build:"make install" |
hook-load | Commands to run after loading | commands (-) | hook-load:"echo ´Boo!´" |
frozen | Do not update unless explicitly specified | truthy,falsy (no) | frozen:true |
on | Dependencies | package (-) | on:user/repo |
lazy | Lazy-load | truthy,falsy (no) | lazy:true |
depth | The number of commits to include in the cloned repository. 0 means the whole history. | Any non-negative integer | depth:10 |
defer | Defers the loading of a package. If the value is 2 or above, zplug will source the plugin after compinit (see also #26) | 0..3 (0) | |
defer:2 | ignore | Similar to use, but specify exception pattern of files that you don’t want to load (see also #56) | glob (-) |
You can register packages for zplug from the command line. If you use zplug on the command line, you can take advantage of the command line completions. When using this method, zplug writes out the package settings to $ZPLUG_LOADFILE. If you launch a new zsh process, zplug load command will automatically use this file. Note that you can also use $ZPLUG_LOADFILE to isolate your zplug package listing from your .zshrc.
Various zplug commands use the following environment variables:
ZPLUG_HOME
$ZPLUG_HOME |-- bin | `-- some_command -> ../repos/username_A/reponame1/some_command `-- repos
|-- username_A
| |-- reponame1
| | |-- README.md
| | `-- some_command
| `-- reponame2
| |-- README.md
| `-- some_plugin.zsh
`-- username_B
`-- reponame1
If you specify as:command when registering the package, zplug will recognize the plugin as a command and create a symbolic link of the same name (if you want to rename it, use rename-to) in $ZPLUG_HOME/bin. Because zplug adds $ZPLUG_HOME/bin to the $PATH, you can run that command from anywhere just like any other commands.
ZPLUG_THREADS
ZPLUG_PROTOCOL
ZPLUG_FILTER
ZPLUG_LOADFILE
ZPLUG_USE_CACHE
$ ZPLUG_USE_CACHE=false zplug load
ZPLUG_CACHE_DIR
ZPLUG_REPOS
ZPLUG_SUDO_PASSWORD
# your .zshrc source ~/.zshrc_secret zplug "some/command", hook-build:"make && sudo make install"
You can use zstyle to change the default values for each tag. The format is: zstyle ":zplug:tag" tag_name new_default_value. For example, if you have a lot of commands and not so many plugins, (i.e. if you find yourself specifying as:command often), you can do: zstyle ":zplug:tag" as command.
You can also specify what options to enable in sub shells. Sub shells are used when expanding glob expressions. If you want to use the extended_glob for example, you can do: zstyle ":zplug:config:setopt" only_subshell extended_glob. If you set :zplug:config:setopt same_curshell to a truthy value (i.e. true, 1, yes), zplug will enable the options enabled at the point of sourcing zplug (i.e. at the point of source $ZPLUG_HOME/init.zsh).
zplug, like git(1), supports external commands. These are executable scripts that reside somewhere in the PATH, named zplug-cmdname, which can be invoked with zplug cmdname. This allows you to create your own commands without modifying zplug’s internals. Instructions for creating your own commands can be found in the docs: https://github.com/zplug/zplug/blob/master/doc/zplug/External-Commands.md Check out the sample zplug-env external command for an example.
Add a zplug section to your .zshrc (or $ZPLUG_LOADFILE):
source ~/.zplug/zplug # Make sure you use double quotes zplug "zsh-users/zsh-history-substring-search" # Can manage a plugin as a command # And accept glob patterns (e.g., brace, wildcard, ...) zplug "Jxck/dotfiles", as:command, use:"bin/{histuniq,color}" # Can manage everything e.g., other person´s zshrc zplug "tcnksm/docker-alias", use:zshrc # Prohibit updates to a plugin by using the "frozen:" tag zplug "k4rthik/git-cal", as:command, frozen:1 # Grab binaries from GitHub Releases # and rename using the "rename-to:" tag zplug "junegunn/fzf-bin", \
as:command, \
from:gh-r, \
rename-to:fzf, \
use:"*darwin*amd64*" # Support oh-my-zsh plugins and the like zplug "plugins/git", from:oh-my-zsh, if:"(( $+commands[git] ))" zplug "themes/duellj", from:oh-my-zsh, as:theme zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]" # Also supports prezto plugins zplug "modules/osx", from:prezto, if:"[[ $OSTYPE == *darwin* ]]" zplug "modules/prompt", from:prezto # Set zstyle before zplug load zstyle ´:prezto:module:prompt´ theme ´sorin´ # Run a command after a plugin is installed/updated zplug "tj/n", hook-build:"make install" # Support checking out a specific branch/tag/commit of a plugin zplug "b4b4r07/enhancd", at:v1 zplug "mollifier/anyframe", commit:4c23cb60 # Install if "if:" tag returns true zplug "hchbaw/opp.zsh", if:"(( ${ZSH_VERSION%%.*} < 5 ))" # Can manage gist file just like other plugins zplug "b4b4r07/79ee61f7c140c63d2786", \
as:command, \
from:gist, \
use:get_last_pane_path.sh # Support bitbucket zplug "b4b4r07/hello_bitbucket", \
as:command, \
from:bitbucket, \
hook-build:"chmod 755 *.sh", \
use:"*.sh" # Support Gitlab zplug "willemmali-sh/chegit", \
as:command, \
from:gitlab # Group dependencies, emoji-cli depends on jq in this example zplug "stedolan/jq", \
as:command, \
from:gh-r \
rename-to:jq, \
on:"b4b4r07/emoji-cli" # Defers the loading of a package # e.g., zsh-syntax-highlighting must be loaded # after executing compinit command and sourcing other plugins zplug "zsh-users/zsh-syntax-highlighting", defer:3 # Can manage local plugins zplug "~/.zsh", from:local # Load theme file zplug ´dracula/zsh´, as:theme # Install plugins if there are plugins that have not been installed if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi fi # Then, source plugins and add commands to $PATH zplug load --verbose
Finally, use zplug install to install your plugins and reload .zshrc.
See the references in official wiki page to get started using zplug. The wiki may perhaps be overwhelming for first-time users.
zplug was originally written by Masaki Ishiyama (a.k.a @b4b4r07). Many people have contributed to it.
Copyright (C) 2015-2016 Masaki Ishiyama
MIT License
Report bugs to the zplug issues
12/22/2016 | ZPLUG Manual |