jedahan / zr

zsh plugin manager written in rust
Mozilla Public License 2.0
180 stars 12 forks source link

Add plugins and source by modifying .zshrc #15

Closed mustaqimM closed 5 years ago

mustaqimM commented 6 years ago
 ➫  zr load zsh-users/prezto modules/git/alias.zsh
cloning https://github.com/zsh-users/prezto
cloning https://github.com/modules/git
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -1, klass: 12, message: "authentication required but no callback set" }', /checkout/src/libcore/result.rs:860:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

I wanted to use the prezto alias package so I added it to the .zshrc file:
zsh-users/prezto/modules/git/alias.zsh \
but zr doesn't ask to download it if it's in .zshrc and the terminal is started so for each and every package I had to run:
zr load url/ofpackage and then still add it to my .zshrc file. Is this how installing packages is done?

The above error was trying to load and use in one go, which I thought would work from the example in the wiki.

Anyway, thank you so much for this, it's blazing fast even with the same amount of plugins I have on zplug, though I wish it used the same syntax as zplug (especially when it comes to commenting out packages). It also seems to have a problem with oh-my-zsh packages, I can't use the git plugin without some compdef errors. (Sorry for mixing so many thoughts into one issue, I don't want to open one for every one)

jedahan commented 6 years ago

I think the biggest conceptual difference between zr and other package managers, is that all zr does is manage git repositories, and creates a init.zsh that you can load however you wish. I am open to suggestions to have the load then source that init.zsh, but generally it feels like a nicer separation for me.

So you can see how I load git aliases from prezto

# make relevant files and directories if not found
test -d ~/.zr || mkdir $_
test -f ~/.zr/init.zsh || touch $_
# if my zshrc is newer than ~/.zr/init.zsh, regenerate the **init.zsh**
[[ ~/.zshrc -nt ~/.zr/init.zsh ]] && { 
  zr load sorin-ionescu/prezto/modules/git/alias.zsh \
    sorin-ionescu/prezto/modules/history/init.zsh \
    sorin-ionescu/prezto/modules/osx/init.zsh \
    sorin-ionescu/prezto/modules/homebrew/init.zsh
}
# load ~/.zr/init.zsh
source ~/.zr/init.zsh

This means every time i edit ~/.zshrc, im sure to have the latest plugins (added or removed) in the next opened prompt. I would love to reduce the boilerplate.

jedahan commented 6 years ago

re: prezto git plugin, I just source the aliases directly, as seen above. If that is enough for you as well, great. If you want the entire git plugin, could you make a new zr issue describing just that problem? It would help me keep track of things better.

jedahan commented 5 years ago

lemme know if this is still an issue