• Stars
    star
    206
  • Rank 190,504 (Top 4 %)
  • Language
    Haskell
  • License
    MIT License
  • Created over 10 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast zsh plugin manager

Build Status

Once a zsh user realizes that oh-my-zsh and antigen actually is bloatware, they will rejoice in antigen-hs. Here's a quote from one content user.

Great work on antigen-hs, you just saved me more than a second each time I split a tmux pane. Probably a month or two in some longer timespan. Never thought about how much time oh-my-zsh took to run its stuff.

antigen-hs

A replacement for antigen which has a low overhead when starting up the shell. I created this plugin because I realized that antigen were the main cause of slow zsh startup times. After the switch, I went from a loading time of 1.00 seconds to less than 0.10 seconds (wall clock).

The performance improvement is achieved by generating a shell script consisting of commands to source your plugin scripts. The script contains full absolute paths of your plugins scripts. In antigen, the paths are calculated every time a new shell is opened.

Installing

Since this plugin is not entirely written in zsh (unlike antigen), it has a few more installation steps. In addition to this README, check out this diff to my dotfiles repository where I replace antigen with antigen-hs.

Haskell and packages

Since this plugin is written in Haskell, you have to download it:

  • installation through cabal:

      $ sudo apt-get install ghc cabal-install
    

    And if you won't use cabal sandbox:

      $ cabal update
      $ cabal install base text directory filepath process
    
  • installation through stack:

    Follow Stack installation guide.

Clone and source

This plugin assumes that you put it in ~/.zsh/antigen-hs/:

git clone https://github.com/Tarrasch/antigen-hs.git ~/.zsh/antigen-hs/

Create plugins file

touch ~/.zsh/MyAntigen.hs
$EDITOR ~/.zsh/MyAntigen.hs

And paste this example content

{-# LANGUAGE OverloadedStrings #-}
module MyAntigen where

import Antigen (
                -- Rudimentary imports
                AntigenConfig (..)
              , defaultConfig
              , bundle
              , antigen
                -- If you want to source a bit trickier plugins
              , ZshPlugin (..)
              , antigenSourcingStrategy
              , filePathsSourcingStrategy
              )

bundles =
  [ bundle "Tarrasch/zsh-functional"
  , bundle "Tarrasch/zsh-bd"
  , bundle "zsh-users/zsh-syntax-highlighting"
  , (bundle "zsh-users/zsh-history-substring-search") { sourcingStrategy = antigenSourcingStrategy }

  -- If you use a plugin that doesn't have a *.plugin.zsh file. You can set a
  -- more liberal sourcing strategy.
  --
  -- , (bundle "some/stupid-plugin") { sourcingStrategy = antigenSourcingStrategy }

  -- If you use a plugin that has sub-plugins. You can specify that as well
  --
  -- NOTE: If you want to use oh-my-zsh for real (please don't), you still need
  -- to set the $ZSH env var manually.
  -- , (bundle "robbyrussell/oh-my-zsh")
  --    { sourcingLocations = [ "plugins/wd"
  --                          , "plugins/colorize"] }

  -- Sourcing a list of files
  -- , (bundle "alfredodeza/zsh-plugins")
  --    { sourcingStrategy = filePathsSourcingStrategy
  --                          [ "vi/zle_vi_visual.zsh"
  --                          , "pytest/pytest.plugin.zsh"
  --                          ] }

  -- Alternatively, this way will give you the same result
  -- , (bundle "alfredodeza/zsh-plugins")
  --    { sourcingStrategy = antigenSourcingStrategy
  --    , sourcingLocations = [ "vi"
  --                          , "pytest"
  --                          ] }

  -- vvv    Add your plugins here    vvv
  ]

config = defaultConfig { plugins = bundles }

main :: IO ()
main = antigen config

Now edit this file accordingly by adding your own plugins. Then you're done! You can get some inspiration from the author's ~/.zsh/MyAntigen.hs.

Finally, source it from you zshrc:

$ echo 'source ~/.zsh/antigen-hs/init.zsh' | tee -a ~/.zshrc | env zsh

And let withard to help you setup and recompile your configuration:

Didn't find file ~/.antigen-hs/antigen-hs.zsh
Try to setup? [Y/n] Yes
Use sandbox for haskell dependencies? [Y/n] Yes
Stack executable found. Use it for sandbox? [Y/n] Yes

Usage

Each time you update MyAntigen.hs you have to run antigen-hs-setup

Limitations

The original antigen plugin does way more than it should (just look at its bloated command list). This plugin tries to be minimal, if you are enough experienced with computers to use a zsh plugin manager, you can delete and manage the repositories in ~/.antigen-hs/repos manually yourself!

Configuration

The following variables alter the behavior of antigen-hs, and must be set before sourcing init.zsh:

ANTIGEN_HS_HOME # This is only set automatically, and is set to the location
                # of the antigen-hs repository (which by default is
                # $HOME/.zsh/antigen-hs)
ANTIGEN_HS_OUT  # Output directory for cloned repositories and generated
                # scripts, defaults to $HOME/.antigen-hs.
ANTIGEN_HS_MY   # Your configuration file, defaults to
                # $ANTIGEN_HS_HOME/../MyAntigen.hs

FAQ

Is Prezto or oh-my-zsh supported in some way? No, if you load them they will be treated like any other plugin. Remember that those two basically are just bundles of plugins, I recommend against using them because one should load the individual plugins through a plugin manager like antigen or antigen-hs. If there's anything inside those plugins that you want, just create a seperate repository for it like I did.

Why do I get No *.plugin.zsh file error? Because all zsh plugins should have that file. I want to enforce it so that people start following this convention. The easiest way is to just fork the plugin you want and/or make them change it If you're interested in some discussion about this, take a look at #3 and zsh-users/antigen#23.

What is the relationship of antigen-hs with antigen? antigen-hs can achieve 100% of antigen if the user is just willing to spend some time doing things right (like not using plugin bundles like oh-my-zsh). In reward they don't need to use software that is bloated. To be fair, many (including my good github friend @sharat87) might want to say that antigen is more featureful/convenient, not bloated. I'll let you choose side yourself. :)

What about the antigen commands like theme and others? I do not found them useful or stable so I rather not have them. I rather rely on my own zsh fu when it comes to chores like updating the repositories (nuking the ~/.antigen-hs folder) than relying on some shaky commands of antigen.

Can I only source GitHub repositories? At the moment yes, patches are very welcome! :)

Where are some more plugins? awesome-zsh-plugins is a list of zsh plugins that you may find helpful.

Do it use sandbox for haskell dependencies? Yes, it support installation by stack or in cabal sandbox as an option.

Why not write it in pure zsh? Trust me, it is a horrible language.

Why Haskell? I love it.

More Repositories

1

zsh-autoenv

Autoenv for zsh
Perl
692
star
2

zsh-bd

Jump back to a specific directory, without doing `cd ../../..`
Shell
417
star
3

zsh-colors

Imagine a shell where `red ERROR` just works
Shell
42
star
4

zsh-command-not-found

A mirror of oh-my-zsh/plugins/command-not-found in case you don't want all of oh-my-zsh
Shell
22
star
5

dotfiles

My own simple dotfiles (I promise, when i started it was simple ;p)
Vim Script
16
star
6

zsh-mcd

zsh plugin for `mkdir && cd`
Shell
5
star
7

yesod-text-markdown

Yesod support for Text.Markdown
Haskell
5
star
8

vietnamese-stopwords

A relatively big list of vietnamese stopwords
Python
5
star
9

timed-repeating

Repeat haskell IO actions (run background jobs) in a managed way, useful when caching scraping results
Haskell
4
star
10

zsh-i-know

Avoid catastrophes like accidentally running `rm -rf .giit`
Shell
3
star
11

Forarprov-selenium-rb

Check for available test day times for Swedish drivers license
Ruby
3
star
12

Einstein-scraping

A "Restaurant Einstein" online menu scraper in haskell
2
star
13

Matrix-multiplication-in-MIPS

Optimized implementation of gaussian elimination for MIPS assembler
C
2
star
14

authenticate-kerberos

kerberos authentication in Haskell
Haskell
2
star
15

Listify

Managing Spotify playlists using libspotify
C
2
star
16

exjobb

None-code files for my master thesis work
TeX
2
star
17

Huzzle-Bobble

[Abandoned] Puzzle Bobble written in Haskell
Haskell
2
star
18

Cheapest-SJ-Ticket

[Abandoned] SJ.se scraper that could find cheaper train tickets by nontrivial routes
Pascal
2
star
19

LBA-Image-Creator

GUI for modifying in-game images for the Little Big Adventure games
Pascal
2
star
20

Cyclic-Barrier

2
star
21

room-booker-rb

Book group rooms at Chalmers University of Technology
JavaScript
2
star
22

sokoban-planner

[CS7649] RIP12 project1: Classical Sokoban Planner
Java
2
star
23

Jenkins-home-dir

Repo "backup" of jenkins home dir
Shell
2
star
24

yesod-auth-kerberos

Kerberos support for Yesod Auth
Haskell
2
star
25

Basic-image-Processing

Objective-C
2
star
26

Hong

A Pong clone in Haskell with reactive programming
Haskell
2
star
27

Single-lane-Bridge

Getting cars to cross a bridge
2
star
28

Tuplespace

Erlang module which implements a Linda-style tuple space
Erlang
2
star
29

BabuschkaEngine

Babuschka playing engine (also see Babuface)
C++
1
star
30

Cryptography-Course

Coursework repo
1
star
31

Functional-language-interpreter

An interpreter for a very small untyped functional language
Haskell
1
star
32

Dynamic-Sieves

Sieving out primes with channels created dynamically
1
star
33

shorten-strings

A unified interface for shorten-ellipsis'ing string-like types
1
star
34

Digital-Signature-Algorithm

Digital Signature Algorithm
Haskell
1
star
35

rack-example

Rack example application
Ruby
1
star
36

Advanced-Algorithms

Excercises for the advanced algorithms course on CTH
1
star
37

luigid-basics-jun-2015

Short presentation about luigi central scheduler
JavaScript
1
star
38

Nollform

A yesod site where university freshmen can register their personality in brief
Haskell
1
star
39

Receiving-in-JR

Receiving multiple messages in JR
Java
1
star
40

Hello-world-in-MIPS

1
star
41

Optimization-of-x2

1
star
42

Maxmargin-classifier

Simple classifier
Objective-C
1
star
43

Recipe-Site

A small yesod site as described by http://www.yesodweb.com/blog/2011/5/yesod-for-non-haskellers
Haskell
1
star
44

thunky-lists

[Proof of concept] Lazy lists in java using thunks
Java
1
star
45

Yerbersod

Kerberos + Yesod (temporary repo)
1
star
46

JK-vippa

1
star
47

Synchronus-sequential-design

Laboration in VHDL (= Lab 3)
VHDL
1
star
48

vhpop

[UNOFFICIAL] Mirror of vhpop, just changed to compile
C++
1
star
49

TCP-Client

TCP Client written in java that fetches a website
1
star
50

Water-Tank-Regulator

A control engineering approach to regulate water tanks
1
star
51

Pattern-Recognition

An excercise to recognize patterns in Iris Plants
1
star
52

Flank-Detector

A circuit detecting which signal was last changed
1
star
53

K1K2-MIPS-interrupts

1
star
54

Weighted-Max-Cut

Objective-C
1
star
55

Two-Player-Zero-Sum

Objective-C
1
star
56

Dtek-Apache-Conf

Apache2 configuration for dtek.se
1
star
57

Control-of-Satellite

A Control engineering approach using a PD-regulator
1
star
58

my-tetris-solver-hs

Weekend project: Solve Tetris in Haskell
Haskell
1
star
59

MagControl

A control engineering approach to regulating the position of a magnetic ball
MATLAB
1
star
60

motion-planning

[CS7649] RIP12 project2: Motion planning
C++
1
star
61

Hazards

Hazards in combinatorial circuits
1
star
62

stacker

Hello world in elixir
Elixir
1
star
63

Studying-Abroad

1
star
64

Water-demo

We show what github's commenting feature can do
1
star
65

word-numbers-hs

Solving the word numbers problem with help from <http://conway.rutgers.edu/~ccshan/wiki/blog/posts/WordNumbers1/>
1
star
66

AlphaBiscuit

Analyze alphabet crackers and determine Characters/Words
MATLAB
1
star
67

Basic-image-operation-in-matlab

1
star
68

Babuschkaface

Babuschka game interface (game idea © Alan Newman)
Pascal
1
star
69

Curriculum-Vitae

Repo for my curriculum vitae - a compiled version can be found on my website:
TeX
1
star