Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

compile option/static loading #67

Closed
mwilliammyers opened this issue Sep 7, 2015 · 8 comments · Fixed by #73
Closed

compile option/static loading #67

mwilliammyers opened this issue Sep 7, 2015 · 8 comments · Fixed by #73
Assignees
Milestone

Comments

@mwilliammyers
Copy link
Contributor

I can understand if this is beyond the scope of antibody/not the design goal of antibody but...

In an effort to make antibody even faster than it already is, what do you think about having an option to "compile"/statically load your current bundles?

For example, if you had a plugins.txt that looked like:

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

and then had antibody bundle < plugins.txt in your ~/.zshrc; this "compile" option would simply create a file with all the full paths to source and would look something like:

source /full/path/to/jvm.plugin.zsh
source /full/path/to/jvm.sh
source /full/path/to/alias-tips.plugin.zsh
source /full/path/to/mkc.plugin.zsh
...

and then in antibody.zsh it would first check for the presence of this file and if it was found it would just do source name_of_this_file.zsh instead of doing what it does now (i.e. running the go binary and sourcing the necessary files)

However, something that would have to be figured out would be if the user has a ~/.zshrc like:

antibody bundle zsh-users/zsh-syntax-highlighting
antibody bundle zsh-users/zsh-history-substring-search
antibody bundle foo
antibody bundle bar

instead of the faster way of doing antibody bundle < plugins.txt it would be tricky to know when to do source name_of_this_file.zsh, because you wouldn't want to do source name_of_this_file.zsh for every bundle <some repo> in ~/.zshrc... That is, unless antibody compile was a completely separate command from antibody bundle.

or am I missing something and this would not actually improve the speed of antibody? (not saying that antibody is slow by any means though...)

I guess my motive is to make my dotfiles completely modular in the sense that I would use antibody to bundle just about everything in my dotfiles. The only downside to doing this is that antibody would, I imagine, inherently be slower than just directly sourcing the files how I normally do in my dotfiles. (As well as it won't add things to fpath, if I am not mistaken, but that would be a separate issue...)

@caarlos0 caarlos0 self-assigned this Sep 10, 2015
@caarlos0 caarlos0 added this to the First stable milestone Sep 10, 2015
@caarlos0
Copy link
Member

Hi @mkwmms,

Sorry, but I have no plans of adding this to the project mostly because of the issues you cited above...

Thanks!

@caarlos0 caarlos0 reopened this Sep 22, 2015
@caarlos0
Copy link
Member

I just realized a good way of doing that, it's kind of hacky, but will work just fine ;)

@caarlos0
Copy link
Member

@mkwmms please check the Hacking session of the readme, that should do the trick.

https://github.com/caarlos0/antibody#hacking

Let me know if it doesn't. Thanks!

@mwilliammyers
Copy link
Contributor Author

@caarlos0 clever hack! I like it. Will do! 😄

some thoughts:
I started a side project https://github.com/mkwmms/reel (very much WIP) to do static loading for fish (zsh and bash to come), mostly so I could explore the fish shell though and a slick ruby parallelization library.

However, I like this go implementation a lot better than my ruby script. Would it be totally off this projects' design goal if you explored fish shell support? I haven't explored this idea much but it might be as simple as changing this line. Fish support is pretty easy because anything in ~/.config/fish/functions/ is automatically loaded by fish...

Anyway if it is something you wouldn't mind exploring I can open a new issue and work on a fork.

I would love to use antibody across linux and OS X, some of which I can't change my default shell to zsh (and I am stuck with bash) so it would be cool if antibody could handle multiple shells (as far as I can see it kind of already unofficially supports bash via .sh extension bundling).

@caarlos0 caarlos0 assigned caarlos0 and unassigned caarlos0 Aug 3, 2016
@caarlos0 caarlos0 modified the milestone: First stable Aug 3, 2016
@caarlos0
Copy link
Member

caarlos0 commented Aug 7, 2016

@mwilliammyers check version v0.9.2. A --static flag was added to the bundle command =)

@mwilliammyers
Copy link
Contributor Author

@caarlos0 will do, thanks!

@caarlos0
Copy link
Member

caarlos0 commented Aug 8, 2016

@mwilliammyers just now I read your previous comment about fish support.. I guess we can do that, yes.

Maybe some --fish global option or something... will require some changes in design... but, yeah, would work 👍

@caarlos0
Copy link
Member

caarlos0 commented Aug 8, 2016

let me know if you still interested =)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants