# Antigen 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. Please note that this is a very new project and can be considered beta at best. That said, I am using antigen full time now on my work machine. Also, please read the commit comments of the changesets when you pull a new version of antigen. ## Show off > Enough talk. Let's fight! > -- Po, Kung-fu Panda. You're going to experience antigen right in your open shell. No `.zshrc` tweaking and reading the rest of this documentation. Kinda like an ice-cream sample, if you will. Get and load antigen. curl https://raw.github.com/zsh-users/antigen/master/antigen.zsh > antigen.zsh source antigen.zsh There. You now have all the antigen goodies. Let's try install some plugins. How about some color to start with. Get the [syntax highlighting plugin][] by running antigen-bundle zsh-users/zsh-syntax-highlighting Now let it do its thing and once its done and you're back at your prompt, try and type a command. See that? Colors! So, you do git? ruby? git and ruby? There are lots of awesome plugins over at oh-my-zsh. Treat yourself to some. antigen-bundle robbyrussell/oh-my-zsh plugins/ruby antigen-bundle robbyrussell/oh-my-zsh plugins/git There are lots of plugins out there in the wild and people are writing zsh utilities as small scripts all the time. Antigen is compatible with all of them. The plugins and scripts don't need any special handling to be compatible with antigen. Another example, [kennethreitz's autoenv](autoenv). Just a bundle command away. antigen-bundle kennethreitz/autoenv And boom! you have all the autoenv goodness. Just remember how you used to do these before antigen, clone it, modify your bashrc to source it, load a new terminal, all just to test it out. Duh! The side effect of this is that you can tell antigen to grab just about anything from anyone's `dotfiles` repo, as long as it is in a directory under any repo on github. And themes? How would you like a fancy new prompt for yourself? antigen-theme funky No? Not your taste? There are many themes available to you, check out the oh-my-zsh's [page on themes][]. (You can currently only install themes from robbyrussell's, i.e., the canonical oh-my-zsh repo). Note: Many of those plugins and especially themes, assume you have the core library of oh-my-zsh loaded. So, if you want to experiment further, issue a antigen-lib and continue until you're tired. At which point you can come back to this page ;) ## Usage So, now that you're here, I'll assume you are convinced and want antigen running your shell all the time. Sweet. Let's do it. First, clone this repo, probably as a submodule if you have your dotfiles in a git repo, git clone https://github.com/sharat87/antigen.git The usage should be very familiar to you if you use Vundle. A typical `.zshrc` might look like this source /path-to-antigen-clone/antigen.zsh # Load the oh-my-zsh's library. antigen-lib # Bundles from the default repo (robbyrussell's oh-my-zsh). antigen-bundle git antigen-bundle heroku antigen-bundle pip antigen-bundle lein antigen-bundle command-not-found # Syntax highlighting bundle. antigen-bundle zsh-users/zsh-syntax-highlighting # Load the theme. antigen-theme robbyrussell # Tell antigen that you're done. antigen-apply Open your zsh with this zshrc and you should see all the bundles you defined here, getting installed. Once its done, you are ready to roll. The complete syntax for the `antigen-bundle` command is discussed further down on this page. ## Motivation If you use zsh and [oh-my-zsh][], you know that having many different plugins that are developed by many different authors in a single (sub)repo is not a very easy to maintain. There are some really fantastic plugins and utilities in oh-my-zsh, but having them all in a single repo doesn't really scale well. And I admire robbyrussell's efforts for reviewing and merging the gigantic number of pull requests the project gets. It needs a better way of plugin management. This was discussed on [a][1] [few][2] [issues][3], but it doesn't look like there was any progress made. So, I'm trying to start this off with antigen, hoping to better this situation. Please note that I'm by no means a zsh or any shell script expert (far from it). [1]: https://github.com/robbyrussell/oh-my-zsh/issues/465 [2]: https://github.com/robbyrussell/oh-my-zsh/issues/377 [3]: https://github.com/robbyrussell/oh-my-zsh/issues/1014 Inspired by vundle, antigen can pull oh-my-zsh style plugins from various github repositories. You are not limited to use plugins from the oh-my-zsh repository only and you don't need to maintain your own fork and pull from upstream every now and then. Antigen also lets you switch the prompt theme with one command, just like that bundle-theme candy and your prompt is changed, just for this session of course. ## Commands ### antigen-bundle This command tells antigen to install (if not already installed) and load the given plugin. The simplest usage follows the following syntax. antigen-bundle This will install the `plugins/` directory from [robbyrussell's oh-my-zsh][oh-my-zsh] (can be changed by setting `ANTIGEN_DEFAULT_REPO_URL`). However, the above is just syntax sugar for the extended syntax of the `antigen-bundle` command. antigen-bundle [ []] where `` is the repository url and it defaults to [robbyrussell's oh-my-zsh][oh-my-zsh] repo (can be changed by setting `ANTIGEN_DEFAULT_REPO_URL` discussed further down). `` is the path under this repository which has the zsh plugin. This is typically the directory that contains a `*.plugin.zsh` file, but it could contain a completion file or just many `*.zsh` files to be sourced. `` defaults to `/`, which indicates the repository itself is a plugin. An example invocation would be # The following is the same as `antigen-bundle ant`. But for demonstration # purposes, we use the extended syntax here. antigen-bundle https://github.com/robbyrussell/oh-my-zsh.git plugins/ant This would install the ant plugin from robbyrussell's oh-my-zsh repo. Of course, github url's can be shortened. antigen-bundle robbyrussell/oh-my-zsh plugins/ant And since this repo is the default, even that isn't necessary. But we can't specify the `loc` without giving the first argument. For this and a few other reasons, `antigen-bundle` also supports a simple keyword argument syntax, using which we can rewrite the above as antigen-bundle --loc=plugins/ant Which picks up the default for the `url` argument, and uses the `loc` given to it. *Note* that you can mix and match positional and keyword arguments. But you can't have positional arguments after keyword arguments. antigen-bundle robbyrussell/oh-my-zsh --loc=plugins/ant And keyword arguments don't care about the order in which the arguments are specified. The following is perfectly valid. antigen-bundle --loc=plugins/ant --url=robbyrussell/oh-my-zsh In addition to the above discussed arguments, `antigen-bundle` also takes a `btype` keyword-only argument, that is used internally. You shouldn't be concerned with this argument, its only used internally and will probably go away in the future. It indicates whether the bundle is a theme or a simple plugin. You can use this `antigen-bundle` command not just from your `.zshrc`, but also from your shell environment. This allows you to install plugins on the fly and try them out. Of course if you want a bundle to be available every time you open a shell, put it in your `.zshrc`. Other keyword-only arguments accepted: `branch` — Specify the branch of the git repo to be used for this bundle. Please note that if you specify two plugins to be loaded from the same git repo, but different branches, then two separate clones of this repo will be maintained. This is a small implementation detail and shouldn't influence you in any way. ### antigen-bundles If you have a fair number of bundles, using the `antigen-bundle` command can look cumbersome. You can use the `antigen-bundles` command to *bulk* define bundles instead of individual calls to `antigen-bundle`. Usage is pretty straightforward. Just pipe the bundle specifications, just as you would give to the `antigen-bundle` command, one per line, into the `antigen-bundles` command. The easiest way to do this, is using the heredoc syntax. antigen-bundles < *TBD* ## Meta Project is licensed with the [MIT License][license]. To contribute, just fork, make changes and send a pull request. If its a rather long/complicated change, please consider opening an [issue][] first so we can discuss it out. Any comments/suggestions/feedback welcome. Please join the discussion on the [reddit page][] of this project. Also, follow me on twitter, [@sharat87](twitter). [Vundle]: https://github.com/gmarik/vundle [page on themes]: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes [syntax highlighting plugin]: https://github.com/zsh-users/zsh-syntax-highlighting [autoenv]: https://github.com/kennethreitz/autoenv [oh-my-zsh]: https://github.com/robbyrussell/oh-my-zsh [issue]: https://github.com/sharat87/antigen/issues [license]: http://mit.sharats.me [reddit page]: http://www.reddit.com/r/commandline/comments/u4f26/antigen_a_plugin_manager_for_zsh_shell/ [twitter]: http://twitter.com/sharat87