-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The best way to add .oh-my-zsh plugins that don't have a repo #1614
Comments
This is a very interesting use case. You can probably make use of the $ cat ~/.local/share/chezmoi/zsh-custom-folder/plugins/bw/_bw.tmpl
{{ output "bw" "completion" "--shell" "zsh" }} I didn't test it, but it should work. Now I'm thinking on doing it in my dotfiles too! |
That's a very useful tip, but the thing I am most struggling with is why the actual file is being put in the wrong place. I am currently fine with adding the file as is once, i.e. in it's current state or not being generated, but I cannot add the file at all and have it be put in the correct path. |
Ops, I forgot
PS: |
Hm... what's the real path for the file? (in other words, what is the current contents of |
I got your point now. Can you try to create the correct folder structure in your I suspect you have |
If it works by adding the file on the source state by hand, then the guilty here is the
What is inside $ZSH_CUSTOM? Whatever is there, it needs to be prefixed with your home directory. So, if it's |
My $ZSH_CUSTOM: $ echo $ZSH_CUSTOM
/home/lund/.oh-my-zsh/custom where the real path of _bw needs to be My .chezmoiexternal.toml file[".oh-my-zsh"]
type = "archive"
url = "https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "168h"
[".oh-my-zsh/custom/plugins/zsh-syntax-highlighting"]
type = "archive"
url = "https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "168h"
[".oh-my-zsh/custom/themes/powerlevel10k"]
type = "archive"
url = "https://github.com/romkatv/powerlevel10k/archive/master.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "168h"
[".oh-my-zsh/custom/plugins/zsh-autosuggestions"]
type = "archive"
url = "https://github.com/zsh-users/zsh-autosuggestions/archive/master.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "168h"
[".oh-my-zsh/custom/plugins/zsh-completions"]
type = "archive"
url = "https://github.com/zsh-users/zsh-completions/archive/master.tar.gz"
exact = true
stripComponents = 1
refreshPeriod = "168h" I'm not sure how to make the correct file path structure for this file but here's me trying: chezmoi: .oh-my-zsh: inconsistent state (dot_oh-my-zsh, https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz); .oh-my-zsh/custom: inconsistent state (dot_oh-my-zsh/custom, https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz); .oh-my-zsh/custom/plugins: inconsistent state (dot_oh-my-zsh/custom/plugins, https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz) |
Sorry, Would you mind taking a look on what I needed to do and try to replicate to see if it works? By the way, I had to run some If so, this should definitely become a guide in https://chezmoi.io, it's amazing how chezmoi can help us here! However, to deal with the
As otherwise it gives the error stated by @jaron-l at #1614 (comment). @twpayne WDYT? And, @jaron-l, until a fix for this is in place, I suggest you disable |
Yes, this is #1574. Unfortunately, fixing it is quite tricky. Neat trick with the completions file as a template using |
@felipecrs Wow, you are amazing. It worked wonderfully! chezmoi is impressive! I didn't need to do the extra compinit or autoload so I'm not sure what happened there. |
It's probably because I used to use |
I've been using a Due to |
FWIW this works for me with |
Correct, this is working as intended. |
Understandable and it's not a problem, given that there is a solution (using the archive method). But surely you can agree it's not an unreasonable use-case, where the git repository has an ignored directory that they expect is modified by the user, so no conflict would have occurred. I doubt it's worth trying to parse the |
I agree that it's a reasonable use-case. At the same time, the expectation of what is modified by the user is not encoded in the
I did investigate this in #1421 and #1623, including an attempted implementation in #1709, but the details turned out to be much more tricky than I anticipated. The workaround of using an archive is reasonable for now. |
I've added a note to #1574 to include @felipecrs's neat trick in the docs once #1574 is fixed. As the original issue is resolved, I'll close this issue now. |
What exactly are you trying to do?
Several command line tools provide ways to add command completions to ZSH but don't provide a static file that can be integrated into .chezmoiexternal.toml using either external repo configuration. For example, in order to add bitwarden command completions to zsh through .oh-my-zsh, you have to run the following command to generate the completion file1:
Because I don't see a place where this file exists statically (it looks like it's being rendered), I need a way to include it through a different means.
What have you tried so far?
My first thought was to just include it like a normal file in chezmoi. So I ran:
chezmoi add $ZSH_CUSTOM/plugins/bw --recursive
after having already run the bw completion command to generate the file. The problem here is that the file gets added to chezmoi's repo at the base level, i.e. $(chezmoi source-path)/plugins/bw/_bw, which is not the correct position to be installed in for .oh-my-zsh to pick it up. Perhaps this is because .oh-my-zsh is in the .chezmoiexternal.toml? The effect is that
chezmoi apply
or using chezmoi on another machine causes _bw to be pull into $HOME/plugins/bw/_bw and for the plugin to not be loaded.Where else have you checked for solutions?
Output of any commands you've tried with
--verbose
flag❯ chezmoi add --verbose $ZSH_CUSTOM/plugins/bw --recursive
and the subsequent chezmoi diff
❯ chezmoi diff --verbose
Output of
chezmoi doctor
❯ chezmoi doctor --verbose
Additional context
I'm pretty sure you can ignore the bitwarden error shown in
chezmoi doctor
as I have the snap installed which has some permission issues accessing a certificate. Seeing as I'm not currently using bitwarden for this setup, I don't think it affects this issue.The text was updated successfully, but these errors were encountered: