Code Monkey home page Code Monkey logo

antibody's Introduction

A faster and simpler antigen written in Golang.

License Build Status Coverage Status Go Report Card Issue Stats Issue Stats

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

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;

Usage

First of all, download and install the latest release.

Pay attention to not put the antibody binary in your PATH. This will cause antibody to malfunction. You just need to source the antibody.zsh for it to work.

Now, you can just antibody bundle stuff, e.g., antibody bundle Tarrasch/zsh-autoenv. The repository will be cloned at your XDG_CACHE folder and antibody will try to load some 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 arount it.

If you want to use antibody just to download and/or update your dependencies, you can run it like this:

$ ANTIBODY_FOLDER/bin/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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.