Skip to content
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

Plugins using init.fish don't work #8

Closed
tcoenraad opened this issue Dec 13, 2015 · 7 comments
Closed

Plugins using init.fish don't work #8

tcoenraad opened this issue Dec 13, 2015 · 7 comments

Comments

@tcoenraad
Copy link
Contributor

For example:

It seems that fundle.fish is invoking init_$plugin_name not at all, as is done by Oh My Fish: https://github.com/oh-my-fish/oh-my-fish/blob/93ddd6f213d6f21386651a1663f9f3460e35dbec/lib/require.fish#L34

@danhper
Copy link
Owner

danhper commented Dec 14, 2015

@tcoenraad Thanks for reporting, I did not know that oh-my-fish was emitting an event after loading plugins. I want the plugins to be compatible, so I am going to add this.

@danhper
Copy link
Owner

danhper commented Dec 14, 2015

@tcoenraad This should now be fixed, I would be glad if you could give it a try.

@tcoenraad
Copy link
Contributor Author

@tuvistavie I think we're almost there, yet now the plugin name is incorrectly retrieved. For example for plugin-grc:

> ~ echo 'oh-my-fish/plugin-grc' | awk -F/ '{print $NF}' | sed -e s/plugin//
-grc

This results in init_-grc to be invoked, what (of course) should be init_grc. Adding a - to the regex however results in these errors:

fish: Unknown command 'available grc'
~/.config/fish/fundle/oh-my-fish/plugin-grc/grc.fish (line 5):   if not available grc
                                                                        ^
in function 'init'
    called on line 135 of file ~/.config/fish/functions/fundle.fish
    with parameter list '/Users/twancoenraad/.config/fish/fundle/oh-my-fish/plugin-grc'

in event handler: handler for generic event 'init_grc'

Okay, I have to reorder plugins to load oh-my-fish-core first. Then the following error occurs:

fish: Unknown command 'grc.wrap cat'
~/.config/fish/config.fish (line 1): grc.wrap $executable $argv
                                     ^
in function 'cat'
    called on line 69 of file /usr/local/Cellar/fish/HEAD/share/fish/functions/psub.fish

Can you please look into this? I guess that dependencies of a plugin should be sourced first, before invoking any initializations.

Besides, in the future, string manipulation can be done in native Fish (see fish-shell/fish-shell#156) 😄

@danhper
Copy link
Owner

danhper commented Dec 14, 2015

@tcoenraad Thanks for reporting. This should now be fixed in 0.3.1. Dependencies order is also respected now: the init event is sent only once the dependencies are initialized. However, this implies to have fundle plugin 'dependency' in the init.fish file of the plugin, so it will not work here.

oh-my-fish plugins are kind of a mess, sometimes functions are in the functions directory, sometimes hanging around in the root directory, that was the issue with grc.
Anyway I restored the previous approach, which is to source all the .fish files in the root directory when no init.fish is there, so it should work for this one.

Please let me know if you still have any issue.

@tcoenraad
Copy link
Contributor Author

I see that while I was commenting, you almost already fixed it. It's now working beautifully (well, as far it can with those messy oh-my-fish plugins), thank you! 👍

@danhper
Copy link
Owner

danhper commented Dec 14, 2015

Besides, in the future, string manipulation can be done in native Fish (see fish-shell/fish-shell#156) 😄

Thanks, I am probably going to switch to the fish implementation, but fish 2.0 and 2.1 are (supposed to be) supported for now (and string manipulation has been added in 2.2 if I remember), so I will see when I drop the support for older fish versions.

I see that while I commenting, you almost already fixed it. It's now working beautifully (well, as far it can with those messy oh-my-fish plugins), thank you! 👍

👍

@mustaqimM
Copy link

@tuvistavie I'm getting the same issue on 0.6.2 with plugin-gem from omf, it isn't loading the function with function init --on-event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants