jorgebucaran / fisher

A plugin manager for Fish
https://git.io/fisher
MIT License
7.53k stars 257 forks source link

Committing plugin source files (completions, conf.d, functions, themes) is not supported #741

Closed charego closed 1 month ago

charego commented 1 year ago

I would like to track not only the list of plugins (fish_plugins file) but also the source code of those plugins, for a few reasons. Typically when you run "fisher update" you don't know if anything changed in your plugins. Tracking the files in git makes it easier to review changes after you pull them in, and commit them to your dotfiles once you "approve" them. Secondly, it makes provisioning a new machine easier because you don't need to install Fisher manually, the code is already in your dotfiles.

The problem emerges when you want to run "fisher update" because the universal variables expected by Fisher are missing (I would prefer not to track the fish_variables file). Rather than suggest a duplicate of https://github.com/jorgebucaran/fisher/issues/611 ("Fisher should stop using universal variables for plugin state"), I wonder if it would be possible for Fisher to create the universal variables on startup if they don't exist?

if ! set --query _fisher_plugins
    # setup the Fisher universal variables by inspecting fish_plugins, etc.
end

Here is a minimal example: https://git.sr.ht/~crg/fishy

> docker container run --rm -it fishy
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
root@59bd29f2ca3c /# fisher update
fisher update version 4.4.3
Fetching https://api.github.com/repos/jorgebucaran/fisher/tarball/HEAD
Fetching https://api.github.com/repos/jorgebucaran/replay.fish/tarball/HEAD
fisher: Cannot install "jorgebucaran/fisher": please remove or move conflicting files first:
        /root/.config/fish/functions/fisher.fish
        /root/.config/fish/completions/fisher.fish
fisher: Cannot install "jorgebucaran/replay.fish": please remove or move conflicting files first:
        /root/.config/fish/functions/replay.fish
        /root/.config/fish/completions/replay.fish
jorgebucaran commented 1 year ago

I wonder if it would be possible for Fisher to create the universal variables on startup if they don't exist?

Maybe, why not. Would you like to send me PR with a fix that works for you?

arkag commented 4 months ago

I'm not exactly sure if this is the same issue I'm dealing with, but I would like the ability to ensure that when I switch to a new computer, I can run fisher update without getting errors because the files from my plugins already exist.

An alternative idea would be to enable specifying locations to put plugin files so that I can deliberately avoid sourcing $__fish_config_dir/functions/fisher or something.

jorgebucaran commented 4 months ago

How did files from your plugins end up on the new machine?

arkag commented 4 months ago

I've had them committed to my dotfiles repo for a while now. I can definitely remove them manually and ignore them, but I do use the functions directory for my own functions and I'd prefer to not gitignore all of the plugin files individually.

lianghx-319 commented 1 month ago

suffering same issue. When I want to recover plugins on new machine.

jorgebucaran commented 1 month ago

@lianghx-319 Describe the issue, please.

lianghx-319 commented 1 month ago

@lianghx-319 Describe the issue, please.

@jorgebucaran I just found that the latest version of fisher will create a fish_plugins file to store the plugin list. It's seem works when fisher update in other machine which sync the fish_plugins

lianghx-319 commented 1 month ago

I think this issue can be closed, after update the document about the file fish_plugins