Skip to content

Minimalistic Git-based fish plugin manager

License

Notifications You must be signed in to change notification settings

kidonng/plug.fish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

  1. 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)
  2. Restart fish

    exec 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.

About

Minimalistic Git-based fish plugin manager

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages