plug.fish
plug.fish copied to clipboard
Minimalistic Git-based fish plugin manager
plug.fish
Minimalistic Git-based fish plugin manager.
[!NOTE] plug.fish v3 is a complete rewrite. Previous versions are available on other branches.
Features
- Doesn't occupy
~/.config/fish
- Flexible plugin management
- Support Fisher plugins
- < 100 lines of code you can actually read and understand
Requirements
- fish >= 3.5
- Git
Installation
- Run this one-liner:
curl -L https://github.com/kidonng/plug.fish/raw/v3/conf.d/plugin_load.fish | plugins=https://github.com/kidonng/plug.fish source
- Add the following to your
~/.config/fish/config.fish
set plugins https://github.com/kidonng/plug.fish
source $__fish_user_data_dir/plugins/plug.fish/conf.d/plugin_load.fish
Usage
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)
Advanced
Manage plugins from the command-line
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
Load plugins dynamically
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
Masking conf.d
scripts
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.