antibody

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2016 License: MIT Imports: 5 Imported by: 1

README

A faster and simpler antigen written in Golang.

License Build Status Coverage Status Go Report Card

"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!

asciicast

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:

  • bundle
  • update
  • apply

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

You can also specify a branch to download, for example, antibody bundle caarlos0/jvm v2 will download the v2 branch of that repository.

When you decide to update your bundles, just run antibody update: it will update all bundles inside the antibody home folder.

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

Static loading

You can use antibody in a static-loading manner (so you don't need to exec antibody every time you open a shell).

$ antibody bundle --static < bundles.txt >> sourceables.sh
# In your zshrc (or whatever):
$ source sourceables.sh

Beware that antibody does stuff in parallel, so bundle order is not guaranteed.

Thanks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Home

func Home() string

Home finds the right home folder to use

Types

type Antibody

type Antibody struct {
	// contains filtered or unexported fields
}

Antibody wraps a list of bundles to be processed.

func New added in v0.3.1

func New(bundles []bundle.Bundle) Antibody

New creates an instance of antibody with the given bundles.

func NewStatic added in v0.9.2

func NewStatic(bundles []bundle.Bundle) Antibody

NewStatic creates an instance of antibody with the given bundles in static-loading mode.

func (Antibody) Download

func (a Antibody) Download()

Download the needed bundles.

func (Antibody) Update

func (a Antibody) Update()

Update all bundles.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL