Fisher: Need info on how to develop a plugin locally.

Created on 5 Jan 2017  路  8Comments  路  Source: jorgebucaran/fisher

I cannot tell from the docs how one would go about developing a plugin or theme locally. More info would be appreciated.

Most helpful comment

@milkypostman You are right, the README only explains how to use fisherman. A tutorial would serve this project more. 馃憤

Developing a plugin (same applies to themes, a.k.a prompts) locally

  • Create a directory for my_plugin
 $ mkdir -p path/to/my_plugin
  • Edit my_plugin.fish file (using cat here only for terseness)
 $ cat > path/to/my_plugin/my_plugin.fish
function my_plugin
  echo "hello, world"
end
  • Install my_plugin
$ fisher path/to/my_plugin                                                                                          
Installing path/to/my_plugin 
  • Did it work?
 $ my_plugin 
hello, world

screen shot 2017-01-06 at 0 47 09

All 8 comments

@milkypostman You are right, the README only explains how to use fisherman. A tutorial would serve this project more. 馃憤

Developing a plugin (same applies to themes, a.k.a prompts) locally

  • Create a directory for my_plugin
 $ mkdir -p path/to/my_plugin
  • Edit my_plugin.fish file (using cat here only for terseness)
 $ cat > path/to/my_plugin/my_plugin.fish
function my_plugin
  echo "hello, world"
end
  • Install my_plugin
$ fisher path/to/my_plugin                                                                                          
Installing path/to/my_plugin 
  • Did it work?
 $ my_plugin 
hello, world

screen shot 2017-01-06 at 0 47 09

One more thing, when you run fisher ls now, local plugins will be prepended with a @ in the listing.

I have a related question:

I'm starting fresh with Fisherman, and I'm wondering which files should I track with git. I know I should track the fishfile, but what about my custom functions, completions, and etc. Placing them at the completions/ and functions/ directories under ~/.config/fish/ doesn't seem a good idea, since they are full of Fisherman's stuff.

One idea is to make everything a fisherman plugin, and placing them at ~/.config/fish/fisher_plugins/. That way it seems easier to track.

Any input is appreciated.

@iquabius This question does not have a clear-cut answer, but I can tell you how I do it.

Make your custom functions, themes and snippets into plugins. You can then publish and share them with everyone else.

If sharing is not an option, turn them into _local_ plugins (follow the steps above), and like you suggested, create a directory somewhere, say ~/Code/fish and put them plugins in there.

Now, it's up to you to decide whether to wrap all those functions into a single plugin (not efficient), or create a plugin per function (best approach that taps into fish-shell's lazy loading mechanism).

One more thing. What if you want to keep some of those plugins private, but still need an option to publish over the network? You can use a private git URL for that, but to make it all simple, fisherman supports installing from gists too.

I hope this helps.

It sure helps. Thank you!

@milkypostman There's still no "official" guide to develop plugins locally, other than what I posted there above, but we'll get there soon. In the meantime, I've been working on a cookbook for fish. Perhaps you'll find that useful.

closing as question has been anwered.

@jbucaran I created a wiki pages from your post Developing a plugin or themes locally.

Thanks @edouard-lopez! 馃檹

Was this page helpful?
0 / 5 - 0 ratings