A faster and simpler antigen written in Golang.
"Antigen is a small set of functions that help you easily manage your shell
(zsh) plugins, called bundles. The concept is pretty much the same as
bundles in a typical vim+pathogen setup. Antigen is to zsh, what Vundle
is to vim."
Read more: Antigen.
Why?
Antigen is really nice, but it is bloated and it is slow - 5+ seconds to load
on my Mac... that's way too much to wait for a prompt to load!
I'm aware that there is other attempts, like
antigen-hs, but I don't want to
install a lot of stuff for this to work.
So, why Go, you might ask: Well, the compiled Go program runs anywhere
and doesn't depend on any shared libraries. I also don't need to source it as
it would be necessary with plain simple shell. I also can do stuff in
parallel with Go routines. The little amount of shell written is needed
because I can't source something from inside a Go program (or at least
don't yet know how to do it).
What works
These are the only antigen commands I ever used:
Antibody does just those three things, but you don't even need to apply
.
Running antibody bundle
will already download and apply the given bundle.
antibody home
also shows where the repositories are being downloaded.
What doesn't work
- Modules that are not in GitHub (you can open a PR if you wish);
- The
theme
command (although most themes might just work with bundle
);
- oh-my-zsh support: it looks very ugly to me and I won't do it;
Install
The simplest way to install Antibody is to run:
$ curl -s https://raw.githubusercontent.com/getantibody/installer/master/install | bash -s
$ echo 'source <(antibody init)' >> ~/.zshrc
This will put the binary in /usr/local/bin/antibody
and setup your ~/.zshrc
to
load what is needed on startup.
Usage
Now, you can just antibody bundle
stuff, e.g.,
antibody bundle caarlos0/jvm
. The repository will be cloned at
your XDG_CACHE
folder and antibody will try to load files that match:
*.plugin.zsh
*.zsh
*.sh
*.zsh-theme
When you decide to update your bundles, just run antibody update
.
Protips
Prefer to use it like this:
$ cat plugins.txt
caarlos0/jvm
djui/alias-tips
caarlos0/zsh-mkc
zsh-users/zsh-completions
caarlos0/zsh-open-github-pr
zsh-users/zsh-syntax-highlighting
zsh-users/zsh-history-substring-search
$ antibody bundle < plugins.txt
This way antibody can concurrently clone the bundles and find their sourceable
files, so it will probably be faster than call each one separately.
In the wild
Hacking
Static loading
In #67 I was asked if there
is some sort of static loading.
Short answer: no, there isn't. But you can hack around it.
If you want to use antibody just to download and/or update your dependencies,
you can run it like this:
$ antibody bundle < bundles.txt | xargs -I {} echo "source {}" >> sourceables.sh
# In your zshrc (or whatever):
$ source sourceables.sh
With this approach you don' even need to source antibody.zsh
if you don't
want to, and, yes, your shell will probably be even faster. It comes with
the cost of additional work though.
Thanks