jorgebucaran / fisher

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

Plugins Missing After Restart Terminal #755

Closed devajmeireles closed 1 year ago

devajmeireles commented 1 year ago

Hey, @jorgebucaran ! First of all thank you for your work.

Can you help me? I'm having a strange problem. Whenever I install a plugin it gets removed when I restart the terminal. I'm installing the plugin: https://github.com/jhillyerd/plugin-git and when I close the terminal it doesn't exist anymore in the abbreviations, and I need to install again (using Fisher).

What am I doing wrong?

jorgebucaran commented 1 year ago

Hey, @ajmeireles! Maybe it's something in your config.fish. Paste it here please?

zephaniahong commented 1 year ago

I'm having a similar issue. But rather than the plugin being removed, I think it's just that the abbreviations don't work.

config.fish

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
status is-interactive && eval /Users/zephaniahong/opt/anaconda3/bin/conda "shell.fish" "hook" $argv | source
# <<< conda initialize <<<

# I've tried removing the following lines as well but it did not fix the issue
if status --is-login
    set -gx PATH $PATH /opt/homebrew/bin
end
jorgebucaran commented 1 year ago

@zephaniahong I don't think your config is interfering with Fisher, so your issue might be something else.

zephaniahong commented 1 year ago

If I run

echo $fisher_path

Should I be expecting an output? Mine seems to be blank.

Also, I notice that the functions in /Users/zephaniahong/.config/fish/functions with their own files work fine e.g. gdt, ggp etc... but the abbreviations that are in __git.init.fish do not seem to work

jorgebucaran commented 1 year ago

What plugins are you currently using?

zephaniahong commented 1 year ago

I see these 4 when I run fisher list: jorgebucaran/fisher jethrokuan/z ilancosman/tide@v5 jhillyerd/plugin-git

jorgebucaran commented 1 year ago

What happens if you uninstall that git plug-in and start a new shell? Do your abbreviations work now? Also try commenting everything in your config.

zephaniahong commented 1 year ago

Nope! The abbreviations come from the plugin so they are gone when I uninstall. These are the files that get downloaded.Screenshot 2023-01-27 at 6 27 51 PM All the functions work. But the abbreviations that exist in the __git.init.fish file don't seem to work when I open another shell.

the __git.init.fish file looks something like this:

function __git.init
  function __git.create_abbr -d "Create Git plugin abbreviation"
    set -l name $argv[1]
    set -l body $argv[2..-1]
    abbr -a $name $body
    set -a __git_plugin_abbreviations $name
  end

  set -q __git_plugin_initialized; and return 0

  set -U __git_plugin_abbreviations

  # git abbreviations
  __git.create_abbr g          git
  __git.create_abbr ga         git add
  __git.create_abbr gaa        git add --all

  # Cleanup declared functions
  functions -e __git.create_abbr

  # Mark git plugin as initialized
  set -U __git_plugin_initialized (date)
end
jorgebucaran commented 1 year ago

Maybe that plugin doesn't work well with Fisher. See also https://github.com/jhillyerd/plugin-git/pull/49

faho commented 1 year ago

This is https://github.com/jhillyerd/plugin-git/pull/88.

The underlying issue is that fish 3.6.0's new and improved abbreviations won't be stored in universal variables anymore, so the plugin creates global abbreviations and then doesn't re-add them in subsequent shells.

As a workaround I believe this should work:

set -e __git_plugin_initialized
__git.init

I don't believe it has anything to do with fisher.

jorgebucaran commented 1 year ago

Thanks for chiming in, @faho.