Open undg opened 2 years ago
What if I make it look for this string in .zshrc
and skip saving it if so?
# bun: don't auto-source completions
Yes, that will be perfect. Whatever is sensible and doesn't involve much effort. Thank you.
That comment flag can be auto added next to source(before, after 👐). It will require no documentation to figure out what's what by simply seeing it.
If I'm not wrong, you don't need to change the path every time an update is made. Unless I'm wrong and the path for the autocompletion file is not stable yet.
What if I make it look for this string in .zshrc and skip saving it if so?
Other tools I use (deno, 1password-cli, rtx) that generate completions simply output them to stdout and don't modify any files. That's simpler for the tool, and it's easy for the user to put the completions in the proper place on the local system (such as a zsh/site-functions directory). It'd be a nice option.
Big +1 on this one. Would be great to have a zsh plugin that does something like:
bun completions # generate but don't mutate zshrc
fpath+=~/.bun/
This bit me hard because it creates a conflict with zsh-autocomplete
With bun completions enabled:
~$ % arch(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
(eval):1: command not found: _autocomplete.command
The probably disappears when I turn off
[ -s "/Users/user/.bun/_bun" ] && source "/Users/user/.bun/_bun"
Took a while to bisect this issue. Note that this was on an older version of bunjs (0.6.13) so the problem may have been fixed in the meantime.
However, it highlights the fact that zsh completions should be opt in because they're potentially risky
These lines in bun.zsh
are a definite no-no:
if ! command -v compinit >/dev/null; then
autoload -U compinit && compinit
fi
compdef _bun bun
Please see this guide I wrote on how to properly install Zsh completions.
Here's a zsh plugin that is working for me
What is the problem this feature will solve?
When I'm generating completions by bun, .zshrc is changed. It's my little .zshrc and strangers should not touch him. He can grow up on pervert or something.
I'm using separate folders for completions: generated, written manually and pulled from the zsh-completion community. I'm sourcing them in my way. I don't want bun to touch my dotfiles to source one completion.
What is the feature you are proposing to solve the problem?
What alternatives have you considered?
IDK what I can do. Not updating bun? Not really a solution. chmoding zshrc? Bit overkill. As far as I know, completion is regenerated after an update. I'm installing it from AUR, not sure if that issue is present when updating it by YAY. I'll look at this closer after the next update.