oh-my-fish/README.md
2015-08-26 23:47:47 +01:00

6.5 KiB

The Fishshell Framework

Fish Version
Build Status
License



⚠️ Important ⚠️

Wahoo and Oh My Fish! are now one project. See this page and FAQ to learn what's new.




About | Install | Getting Started | Advanced | Screencasts | Contributing | FAQ


About

Oh My Fish is an all-purpose framework for the fishshell. It looks after your configuration, themes and packages. It's lightning fast and easy to use.

We love contributions, fork and send us a PR.

Install

curl -L git.io/omf | sh
omf help

Or download and run it yourself:

curl -L git.io/omf > install
chmod +x install
./install

🔰 Getting Started

Oh My Fish includes a small utility omf to fetch and install new packages and themes.

omf update

Update framework and installed packages.

omf install <package> ...

Install one or more themes or packages. To list available packages type omf theme.

You can fetch packages by URL as well via omf install URL

omf list

List installed packages.

To list packages available for download use omf install.

omf theme <theme>

Apply a theme. To list available themes type omf theme.

omf remove <name>

Remove a theme or package.

Packages subscribed to uninstall_<pkg> events are notified before the package is removed to allow custom cleanup of resources. See Uninstall.

omf new pkg | theme <name>

Scaffold out a new package or theme.

This creates a new directory under $OMF_CUSTOM/{pkg | themes}/ with a template.

omf submit pkg/<name> [<url>]

Add a new package. To add a theme use omf submit themes/<name> <url>.

Make sure to send us a PR to update the registry.

omf query <variable name>

Use to inspect all session variables. Useful to dump path variables like $fish_function_path, $fish_complete_path, $PATH, etc.

omf destroy

Uninstall Oh My Fish. See uninstall for more information.

🚩 Advanced

Startup

This script runs each time a new session begins, autoloading packages, themes and your custom path (dotfiles) in that order.

The custom path ($HOME/.dotfiles by default) is defined by $OMF_CUSTOM in $HOME/.config/fish/config.fish. Modify this to load your own dotfiles if you have any.

Core Library

The core library is a minimum set of basic utility functions that extend your shell.

Packages

Creating

A package name may only contain lowercase letters and hyphens to separate words.

To scaffold out a new package:

$ omf new pkg my_package

my_package/
  README.md
  my_package.fish
  completions/my_package.fish

Use omf new theme my_theme for themes.

Please provide auto completion for your utilities if applicable and describe how your package works in the README.md.

my_package.fish defines a single function:

function my_package -d "My package"
end

Bear in mind that fish lacks a private scope so consider the following options to avoid polluting the global namespace:

  • Prefix functions: my_package_my_func.
  • Using blocks.

Submitting

Oh My Fish keeps a registry of packages under $OMF_PATH/db/.

To create a new entry run:

omf submit pkg/my_package .../my_package.git

Similarly for themes use:

omf submit theme/my_theme .../my_theme.git

This will add a new entry to your local copy of the registry. Please send us a PR to update the global registry.

Initialization

If you want to be notified when your package loads, declare the following function in your my_package.fish:

function init -a path --on-event init_mypkg
end

Use this event to modify the environment, load resources, autoload functions, etc. If your package does not export any functions, you can still use this event to add functionality to your package.

Uninstall

Oh My Fish emits uninstall_<pkg> events before a package is removed via omf remove <pkg>. Subscribers can use the event to clean up custom resources, etc.

function uninstall --on-event uninstall_pkg
end

Ignoring

Remove any packages you wish to turn off using omf remove <package name>. Alternatively, you can set a global env variable $OMF_IGNORE in your ~/.config/fish/config.fish with the packages you wish to ignore. For example:

set -g OMF_IGNORE skip this that ...

License

MIT © Oh My Fish 🤘