1

In reference to How do you convert or translate these zplug codes whose uncommon option into zinit language?, I am migrating from zplug/zinit to znap in which I am interested.

I was reading the znap documentation, but I observed that zinit and znap are totally different.

I observed the option pick that does not exist on znap:

zinit light "mafredri/zsh-async" pick "async.zsh"

I wonder if I would write like:

znap source mafredri/zsh-async
znap eval zsh-async 'curl -fsSL https://github.com/mafredri/zsh-async/async.zsh'

Also observe zplug language, using defer:

zplug "zdharma/fast-syntax-highlighting", defer:2

I also need to defer one of plugins before another plugin, but I have no idea of how it is like in znap. I am thinking of sourcing the first before the second, but not sure if it is correct.

It would be interesting to want to use the conditions checking the commands but also I need to check the OS type, for example:

zinit wait lucid for \
      OMZ::plugins/common-aliases \
      OMZ::plugins/copydir \
      OMZ::plugins/cp \
      OMZ::plugins/encode64 \
      OMZ::plugins/extract \
      OMZ::plugins/git \
      if"[[ $+commands[go] ]]" OMZ::plugins/golang \
      if"[[ $+commands[npm] ]]" OMZ::plugins/npm \
      if"[[ $+commands[sudo] ]]" OMZ::plugins/sudo \
      if"[[ $+commands[systemd] ]]" OMZ::plugins/systemd \
      OMZ::plugins/urltools \
      pick "zshrc" tcnksm/docker-alias

And can I switch from ~/.local/share/znap to ~/.config/zsh?

1
  • There's no point to individual tags for all these plugin managers. The only questions in any of them so far have been by you, and even there were like 4 all together in two years.
    – muru
    Feb 19 at 3:54

1 Answer 1

1

This should do the trick:

znap prompt  # This is how you "defer".

() {
  local -a plugins=( 
      common-aliases copydir cp encode64 extract urltools
      ${commands[go]:+golang} 
      ${commands[npm]:+npm} 
      ${commands[sudo]:+sudo} 
      ${commands[systemd]:+systemd} 
  )
  znap source ohmyzsh/ohmyzsh plugins/$^plugins
}

znap source tcnksm/docker-alias zshrc  # This is how you "pick".

znap source mafredri/zsh-async
znap source zdharma-continuum/fast-syntax-highlighting

By the way, I would recommend not using mafredri/zsh-async. Zsh has built-in features for doing async. You don't need a plugin for that.

4
  • Thank you, I'll remove the unnecessary plugin. And about the plugins junegunn/fzf (failed), peco/peco (failed)? About wfxr/forgit (failed), Aloxaf/fzf-tab (failed), larkery/zsh-histdb, plugins/dircycle, plugins/z, supercrabtree/k and tarrasch/zsh-bd? I want just to know if they are unnecessary for znap. Feb 21 at 1:24
  • What do you mean with "(failed)"? Feb 21 at 7:21
  • Znap doesn't make any plugins unnecessary. I don't really understand your question. :) Feb 21 at 7:22
  • If you find that there are plugins that Znap cannot load, then please start a discussion on the Znap repo. Feb 21 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.