antibody

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2016 License: MIT Imports: 5 Imported by: 0

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

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

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 (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