Minimalistic Git-based fish plugin manager.
Note
plug.fish v3 is a complete rewrite. Previous versions are available on other branches.
- Doesn't occupy
~/.config/fish
- Flexible plugin management
- Support Fisher plugins
- < 100 lines of code you can actually read and understand
- fish >= 3.5
- Git
-
Add the following to your
~/.config/fish/config.fish
set plugins https://github.com/kidonng/plug.fish source (path filter $__fish_user_data_dir/plugins/plug.fish/conf.d/plugin_load.fish || curl https://raw.githubusercontent.com/kidonng/plug.fish/v3/conf.d/plugin_load.fish | psub)
-
Restart fish
exec fish
Adding plugins is as easy as setting $plugins
:
# Missing plugins are downloaded the next shell session
set plugins \
https://github.com/kidonng/plug.fish \
https://github.com/other/plugin \
~/any/git/repository
Update plugins by running plugin_update
:
$ plugin_update
Updating example-plugin
Updating another-plugin
Don't want some plugin to update? Add it to $plugins_pinned
:
set plugins \
https://github.com/kidonng/plug.fish \
https://github.com/plugin/to-be-pinned
# Use the last segment as identifier
set plugins_pinned to-be-pinned
Not into some plugin? Remove it from $plugins
to disable it or even run plugin_uninstall
:
$ plugin_uninstall
example-plugin is disabled, uninstall? (y/N)
Don't like editing config files? Make $plugins
a universal variable and set
becomes a plugin manager:
$ set --universal plugins \
https://github.com/kidonng/plug.fish \
https://github.com/plugin/foo
$ # Add plugin bar
$ set --append plugins https://github.com/plugin/bar && exec fish
$ # Remove plugin foo
$ set --erase plugins[2] && plugin_uninstall
Edit ~/.config/fish/config.fish
:
- set plugins \
+ set --query plugins || set plugins \
https://github.com/kidonng/plug.fish \
https://github.com/plugin/foo \
https://github.com/plugin/bar
Now you are able to load plugins however you want:
# Only the first two plugins will be loaded in the new shell!
plugins=$plugins[..2] exec fish
Creating ~/.config/fish/conf.d/foo.fish
prevents loading some-plugin/conf.d/foo.fish
(masking).
This is per the behavior described in fish documentation:
If there are multiple files with the same name in these directories, only the first will be executed.