fisher icon indicating copy to clipboard operation
fisher copied to clipboard

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

Open charego opened this issue 2 years ago • 4 comments

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

charego avatar Oct 17 '22 14:10 charego

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?

jorgebucaran avatar Oct 19 '22 10:10 jorgebucaran

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.

arkag avatar Mar 05 '24 15:03 arkag

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

jorgebucaran avatar Mar 05 '24 16:03 jorgebucaran

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.

arkag avatar Mar 05 '24 16:03 arkag

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

lianghx-319 avatar May 26 '24 13:05 lianghx-319

@lianghx-319 Describe the issue, please.

jorgebucaran avatar May 26 '24 16:05 jorgebucaran

@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 avatar May 27 '24 06:05 lianghx-319

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

lianghx-319 avatar May 27 '24 06:05 lianghx-319