Top Related Projects
🌻 Flexible and fast ZSH plugin manager
🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.
The configuration framework for Zsh
The plugin manager for zsh.
The fastest shell plugin manager.
:hibiscus: A next-generation plugin manager for zsh
Quick Overview
Zgen is a lightweight plugin manager for Zsh that allows users to load plugins and themes from GitHub and other sources. It's designed to be fast and simple, providing an efficient way to manage Zsh configurations and extensions.
Pros
- Fast startup times due to its intelligent caching mechanism
- Easy to use and configure with minimal setup required
- Supports loading plugins from various sources, including GitHub and local directories
- Automatically updates plugins when changes are detected
Cons
- Less feature-rich compared to some other Zsh plugin managers
- Limited documentation and community support
- May require manual intervention for complex plugin configurations
- Not actively maintained (last commit was in 2020)
Code Examples
- Loading a plugin from GitHub:
zgen load zsh-users/zsh-syntax-highlighting
- Loading a theme:
zgen load robbyrussell/oh-my-zsh themes/robbyrussell
- Saving the generated init script:
zgen save
Getting Started
To get started with zgen, follow these steps:
- Clone the zgen repository:
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
- Add the following to your
.zshrc
:
# load zgen
source "${HOME}/.zgen/zgen.zsh"
# if the init script doesn't exist
if ! zgen saved; then
echo "Creating a zgen save"
# specify plugins here
zgen load zsh-users/zsh-syntax-highlighting
zgen load zsh-users/zsh-autosuggestions
# generate the init script from plugins above
zgen save
fi
- Restart your shell or run
source ~/.zshrc
to apply the changes.
Competitor Comparisons
🌻 Flexible and fast ZSH plugin manager
Pros of zinit
- More feature-rich with advanced loading techniques like turbo mode
- Offers better plugin management with automatic updates and rollbacks
- Provides a more extensive ecosystem with additional tools and extensions
Cons of zinit
- Steeper learning curve due to its complexity and numerous features
- Potentially slower startup times for simple configurations
- Requires more configuration and setup compared to zgen's simplicity
Code comparison
zgen:
source "${HOME}/.zgen/zgen.zsh"
if ! zgen saved; then
zgen oh-my-zsh
zgen load zsh-users/zsh-syntax-highlighting
zgen save
fi
zinit:
source "${HOME}/.zinit/bin/zinit.zsh"
zinit light zsh-users/zsh-syntax-highlighting
zinit snippet OMZ::lib/git.zsh
zinit ice wait'!0'
zinit load zsh-users/zsh-autosuggestions
zgen focuses on simplicity and ease of use, making it ideal for users who want a straightforward plugin manager. It uses a static approach to plugin loading, which can lead to faster startup times for basic setups.
zinit, on the other hand, offers more advanced features and flexibility. It provides dynamic loading, allowing for more granular control over when and how plugins are loaded. This can be beneficial for users with complex configurations or those who want to optimize their shell's performance.
🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.
Pros of Oh My Zsh
- Extensive collection of plugins and themes out-of-the-box
- Large, active community providing support and contributions
- Well-documented and beginner-friendly
Cons of Oh My Zsh
- Can be slower to load due to its large codebase
- Potential for bloat with unused features
- More complex configuration process
Code Comparison
Oh My Zsh configuration:
plugins=(git docker kubectl)
ZSH_THEME="robbyrussell"
source $ZSH/oh-my-zsh.sh
zgen configuration:
zgen oh-my-zsh
zgen oh-my-zsh plugins/git
zgen oh-my-zsh plugins/docker
zgen oh-my-zsh plugins/kubectl
zgen load robbyrussell/oh-my-zsh themes/robbyrussell
zgen save
Key Differences
- zgen is a lightweight plugin manager, while Oh My Zsh is a full-featured framework
- zgen allows for faster startup times by generating a static init script
- Oh My Zsh provides a more comprehensive out-of-the-box experience
- zgen requires manual plugin specification, offering more granular control
- Oh My Zsh has a simpler initial setup process for beginners
Both tools aim to enhance the Zsh experience, but they cater to different user preferences. Oh My Zsh offers a rich, pre-configured environment, while zgen provides a minimalist approach with faster load times and more customization options.
The configuration framework for Zsh
Pros of Prezto
- Comprehensive set of pre-configured modules for enhanced Zsh functionality
- Well-organized and modular structure for easy customization
- Active community and regular updates
Cons of Prezto
- Larger footprint and potentially slower startup time
- Steeper learning curve for configuration and customization
- May include more features than some users need
Code Comparison
Prezto configuration:
zstyle ':prezto:*:*' color 'yes'
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'directory'
Zgen configuration:
zgen load prezto
zgen prezto
zgen prezto git
zgen prezto syntax-highlighting
zgen prezto history-substring-search
Key Differences
- Zgen is a lightweight plugin manager, while Prezto is a full Zsh configuration framework
- Zgen allows for easier mixing of different plugin sources, while Prezto focuses on its own modules
- Prezto offers a more cohesive and integrated experience, while Zgen provides more flexibility in plugin selection
Use Cases
- Choose Prezto for a comprehensive, pre-configured Zsh environment with minimal setup
- Opt for Zgen if you prefer a minimalist approach with the ability to cherry-pick plugins from various sources
The plugin manager for zsh.
Pros of antigen
- More feature-rich with advanced plugin management capabilities
- Supports a wider range of plugin sources, including Oh My Zsh and Prezto
- Offers automatic plugin updates and can handle complex dependencies
Cons of antigen
- Slower startup time due to its more complex functionality
- Higher memory usage, especially with many plugins loaded
- Can be more challenging to configure for beginners
Code comparison
antigen:
source /path/to/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply
zgen:
source "${HOME}/.zgen/zgen.zsh"
zgen oh-my-zsh
zgen load zsh-users/zsh-syntax-highlighting
zgen save
Key differences
- Syntax: antigen uses
bundle
for loading plugins, while zgen usesload
- Initialization: antigen requires
antigen apply
at the end, zgen useszgen save
- Performance: zgen generally offers faster startup times due to its simpler design
- Flexibility: antigen provides more options for managing and updating plugins
- Learning curve: zgen is often considered easier to set up and use for beginners
Both tools serve similar purposes in managing Zsh plugins, but zgen focuses on simplicity and speed, while antigen offers more advanced features at the cost of performance.
The fastest shell plugin manager.
Pros of Antibody
- Written in Go, offering faster performance and easier installation
- Supports both static and dynamic loading of plugins
- Actively maintained with more recent updates
Cons of Antibody
- Requires separate installation of Go runtime
- May have compatibility issues with some older Zsh plugins
- Slightly more complex configuration for advanced users
Code Comparison
Zgen:
source "${HOME}/.zgen/zgen.zsh"
if ! zgen saved; then
zgen oh-my-zsh
zgen load zsh-users/zsh-syntax-highlighting
zgen save
fi
Antibody:
source <(antibody init)
antibody bundle zsh-users/zsh-syntax-highlighting
antibody bundle ohmyzsh/ohmyzsh
Both Zgen and Antibody are Zsh plugin managers that aim to improve shell startup time and plugin management. Zgen uses a simple, lightweight approach with a focus on generating a static init script. Antibody, on the other hand, offers more flexibility with its dynamic loading capabilities and faster performance due to its Go implementation.
While Antibody provides better performance and more active development, it requires an additional Go installation and may have some compatibility issues with older plugins. Zgen is simpler to set up and use but lacks some of the advanced features and speed improvements of Antibody.
The code comparison shows that both tools have similar syntax for loading plugins, with Antibody using a more streamlined approach. Users should consider their specific needs and system requirements when choosing between these two plugin managers.
:hibiscus: A next-generation plugin manager for zsh
Pros of zplug
- More feature-rich with advanced functionality like parallel installation and updating
- Supports a wider range of plugin sources, including GitHub, Bitbucket, and local plugins
- Offers a more flexible syntax for plugin management and configuration
Cons of zplug
- Generally slower performance compared to zgen, especially during shell startup
- More complex setup and configuration process
- Requires more system resources due to its extensive feature set
Code Comparison
zplug:
source ~/.zplug/init.zsh
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug load
zgen:
source "${HOME}/.zgen/zgen.zsh"
zgen load zsh-users/zsh-autosuggestions
zgen load zsh-users/zsh-syntax-highlighting
zgen save
Both zplug and zgen are popular Zsh plugin managers, each with its own strengths. zplug offers more features and flexibility, while zgen focuses on simplicity and performance. The choice between them depends on your specific needs and preferences for managing Zsh plugins.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
zgen
A lightweight plugin manager for Zsh inspired by Antigen. Keep your .zshrc
clean and simple.
Zgen provides you a few simple commands for managing plugins. It installs your plugins and generates a static init script that will source them for you every time you run the shell. We do this to save some startup time by not having to execute time consuming logic (plugin checking, updates, etc). This means that you have to manually check for updates (zgen update
) and reset the init script (zgen reset
) whenever you add or remove plugins.
The motive for creating zgen was to have plugins quickly installed on a new machine without getting the startup lag that Antigen used to give me.
Installation
Clone the zgen repository
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
Edit your .zshrc file to load zgen
# load zgen
source "${HOME}/.zgen/zgen.zsh"
Place the following code after the one above to load oh-my-zsh for example, see Usage for more details
# if the init script doesn't exist
if ! zgen saved; then
# specify plugins here
zgen oh-my-zsh
# generate the init script from plugins above
zgen save
fi
Usage
oh-my-zsh
This is a handy shortcut for installing oh-my-zsh plugins. They can be loaded using zgen load
too with a significantly longer format.
Load oh-my-zsh base
It's a good idea to load the base components before specifying any plugins.
zgen oh-my-zsh
Load oh-my-zsh plugins
zgen oh-my-zsh <location>
Example
zgen oh-my-zsh
zgen oh-my-zsh plugins/git
zgen oh-my-zsh plugins/sudo
zgen oh-my-zsh plugins/command-not-found
zgen oh-my-zsh themes/arrow
Prezto
Load Prezto
zgen prezto
This will create a symlink in the ZSHDOT
or HOME
directory. This is needed by prezto.
Load prezto plugins
zgen prezto <modulename>
This uses the Prezto method for loading modules.
Load a repo as Prezto plugins
zgen pmodule <reponame> <branch>
This uses the Prezto method for loading the module. It creates a symlink and calls pmodule
.
Set prezto options
zgen prezto <modulename> <option> <value(s)>
This must be used before the module is loaded. Or if the default modules should be loaded (default) these settings must be done before the zgen prezto
command. module
is prepended if the name does not start with module
, prezto
or a *
, prezto
is prepended if it does not start with prezto
.
General zgen functions
Load plugins and completions
zgen load <repo> [location] [branch]
Zgen tries to source any scripts from location
using a "very smart matching logic". If it fails to find any, it will appends location
to $fpath
.
repo
- github
user/repository
or path to a repository - currently supported formats for a repository path:
- any local repository
git://*
https://*
http://*
ssh://*
git@*:*/*
- github
location
- relative path to a script/folder
- useful for repositories that don't have proper plugin support like
zsh-users/zsh-completions
branch
- specifies the git branch to use
Bulk load plugins
zgen loadall <plugins>
Please see example .zshrc
for usage.
Generate init script
zgen save
It is recommended to save the plugin sourcing part to a static init script so we don't have to go through the time consuming installing/updating part every time we start the shell (or source .zshrc)
Remove init script
zgen reset
Removes the init script so it will be created next time you start the shell. You must run this every time you add or remove plugins to trigger the changes.
This will not remove the plugins physically from disk.
Check for an init script
zgen saved
Returns 0 if an init script exists.
Update all plugins and reset
zgen update
Pulls updates on every plugin repository and removes the init script.
Update zgen
zgen selfupdate
Watch files for modifications
You can automate the process of running zgen reset
by specifying a list of files to ZGEN_RESET_ON_CHANGE
. These files will be checked and if a change is detected zgen reset is called.
ZGEN_RESET_ON_CHANGE=(${HOME}/.zshrc ${HOME}/.zshrc.local)
Notes
Be aware that zgen
tries to handle compinit
for you to allow for the fastest possible initialization times. However, this functionality will be disabled if you've already called compinit
yourself before sourcing zgen.zsh
. Alternatively, you can disable it yourself by disabling $ZGEN_AUTOLOAD_COMPINIT
.
Example .zshrc
# load zgen
source "${HOME}/.zgen/zgen.zsh"
# if the init scipt doesn't exist
if ! zgen saved; then
echo "Creating a zgen save"
zgen oh-my-zsh
# plugins
zgen oh-my-zsh plugins/git
zgen oh-my-zsh plugins/sudo
zgen oh-my-zsh plugins/command-not-found
zgen load zsh-users/zsh-syntax-highlighting
zgen load /path/to/super-secret-private-plugin
# bulk load
zgen loadall <<EOPLUGINS
zsh-users/zsh-history-substring-search
/path/to/local/plugin
EOPLUGINS
# ^ can't indent this EOPLUGINS
# completions
zgen load zsh-users/zsh-completions src
# theme
zgen oh-my-zsh themes/arrow
# save all to init script
zgen save
fi
Example .zshrc for prezto use
Here is a partial example how to work with prezto
...
echo "Creating a zgen save"
# prezto options
zgen prezto editor key-bindings 'emacs'
zgen prezto prompt theme 'sorin'
# prezto and modules
zgen prezto
zgen prezto git
zgen prezto command-not-found
zgen prezto syntax-highlighting
# plugins
zgen load /path/to/super-secret-private-plugin
....
Other resources
The awesome-zsh-plugins list contains many zgen-compatible zsh plugins & themes that you may find useful.
There's a quickstart kit for using zsh and zgen at zsh-quickstart-kit that guides you through setting up zgen and includes a sampler of useful plugins.
The autoupdate-zgen plugin will enable your zgen to periodically update itself and your list of plugins.
Alternatives
Top Related Projects
🌻 Flexible and fast ZSH plugin manager
🙃 A delightful community-driven (with 2,400+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool that makes it easy to keep up with the latest updates from the community.
The configuration framework for Zsh
The plugin manager for zsh.
The fastest shell plugin manager.
:hibiscus: A next-generation plugin manager for zsh
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot