2015-08-27 01:04:34 +08:00
2015-08-26 23:20:13 +08:00
> The [Fishshell][fishshell] Framework
[![Fish Version][fish-badge]][fishshell]
[![Build Status][travis-badge]][travis-url]
[![License][license-badge]](#LICENSE)
< a name = "omf" > < / a >
2015-08-27 00:49:23 +08:00
< br >
2015-08-27 01:04:34 +08:00
< p align = "center" >
< h1 align = "center" > :warning: Important :warning:< / h1 >
< h4 align = "center" >
2015-08-27 01:11:17 +08:00
< a href = "https://github.com/wa/wahoo" > Wahoo< / a > and < a href = "https://github.com/oh-my-fish/oh-my-fish" > Oh My Fish!< / a > are now one project. See this page and < a href = "FAQ.md" > FAQ< / a > to learn what's new.
2015-08-27 01:04:34 +08:00
< / h4 >
< / p >
< hr >
2015-08-27 00:49:23 +08:00
2015-08-26 23:20:13 +08:00
< br >
2015-03-30 12:06:42 +08:00
< p align = "center" >
2015-08-27 00:49:23 +08:00
< a href = "https://github.com/fish-shell/oh-my-fish/blob/master/README.md" >
2015-08-27 01:04:34 +08:00
< img width = "160px" src = "https://cloud.githubusercontent.com/assets/8317250/8510172/f006f0a4-230f-11e5-98b6-5c2e3c87088f.png" >
2015-08-26 23:20:13 +08:00
< / a >
2015-03-30 12:06:42 +08:00
< / p >
2015-08-26 23:20:13 +08:00
< br >
< p align = "center" >
< b > < a href = "#about" > About< / a > < / b >
|
< b > < a href = "#install" > Install< / a > < / b >
|
< b > < a href = "#getting-started" > Getting Started< / a > < / b >
|
< b > < a href = "#advanced" > Advanced< / a > < / b >
|
2015-08-27 00:49:23 +08:00
< b > < a href = "https://github.com/fish-shell/oh-my-fish/wiki/Screencasts" > Screencasts< / a > < / b >
2015-08-26 23:20:13 +08:00
|
< b > < a href = "/CONTRIBUTING.md" > Contributing< / a > < / b >
|
< b > < a href = "/FAQ.md" > FAQ< / a > < / b >
< p align = "center" >
2015-08-27 00:49:23 +08:00
< a href = "https://gitter.im/fish-shell/oh-my-fish?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge" >
2015-08-26 23:20:13 +08:00
< img src = "https://badges.gitter.im/Join%20Chat.svg" >
< / a >
< / p >
< / p >
2015-03-29 11:45:38 +08:00
2015-08-26 23:20:13 +08:00
< br >
2015-03-30 12:06:42 +08:00
2015-08-26 23:20:13 +08:00
# About
2015-03-30 12:06:42 +08:00
2015-08-27 00:33:22 +08:00
Oh My Fish is an all-purpose framework for the [fishshell][Fishshell]. It looks after your configuration, themes and packages. It's lightning fast and easy to use.
2013-05-17 21:05:41 +08:00
2015-08-27 00:49:23 +08:00
We love contributions, [fork and send us a PR ](https://github.com/fish-shell/oh-my-fish/fork ).
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
# Install
2013-05-17 21:05:41 +08:00
2015-08-27 01:04:34 +08:00
```fish
2015-08-26 23:20:13 +08:00
curl -L git.io/omf | sh
omf help
```
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
Or _download_ and run it yourself:
2015-08-27 01:04:34 +08:00
```fish
2015-08-26 23:20:13 +08:00
curl -L git.io/omf > install
chmod +x install
./install
```
# :beginner: 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.
2015-08-27 06:47:47 +08:00
## `omf install` _`<package> ...`_
2015-08-26 23:20:13 +08:00
2015-08-27 02:06:37 +08:00
Install one _or more_ themes or packages. To list available packages type `omf theme` .
2015-08-26 23:20:13 +08:00
2015-08-27 06:47:47 +08:00
> You can fetch packages by URL as well via `omf install URL`
2015-08-26 23:20:13 +08:00
## `omf list`
List installed packages.
2015-08-27 06:47:47 +08:00
> To list packages available for download use `omf install`.
2015-08-26 23:20:13 +08:00
2015-08-27 02:06:37 +08:00
## `omf theme` _`<theme>`_
2015-08-26 23:20:13 +08:00
2015-08-27 02:06:37 +08:00
Apply a theme. To list available themes type `omf theme` .
2015-08-26 23:20:13 +08:00
## `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](#uninstall).
## `omf new pkg | theme` _`<name>`_
Scaffold out a new package or theme.
2015-08-28 01:56:01 +08:00
> This creates a new directory under `$OMF_CONFIG/{pkg | themes}/` with a template.
2015-08-26 23:20:13 +08:00
## `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][omf-pulls-link] 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 ](#uninstall ) for more information.
# :triangular_flag_on_post: Advanced
+ [Startup ](#startup )
+ [Core Library ](#core-library )
+ [Packages ](#packages )
+ [Creating ](#creating )
+ [Submitting ](#submitting )
+ [Initialization ](#initialization )
+ [Uninstall ](#uninstall )
+ [Ignoring ](#ignoring )
## Startup
2015-08-28 01:56:01 +08:00
This script runs each time a new session begins, autoloading packages, themes and your _config_ path in that order.
2015-08-26 23:20:13 +08:00
2015-08-28 18:57:48 +08:00
The _config_ path (`~/.config/omf` by default) is defined by `$OMF_CONFIG` in `~/.config/fish/config.fish` . Modify this to load your own configuration if you have any as discussed in the [FAQ ](FAQ.md#what-does-oh-my-fish-do-exactly ).
2015-08-26 23:20:13 +08:00
## Core Library
The core library is a minimum set of basic utility functions that extend your shell.
+ [See the documentation ](/lib/README.md ).
## Packages
### Creating
> A package name may only contain lowercase letters and hyphens to separate words.
To scaffold out a new package:
2013-05-17 21:05:41 +08:00
2015-01-30 08:06:05 +08:00
```fish
2015-08-26 23:20:13 +08:00
$ omf new pkg my_package
my_package/
README.md
my_package.fish
completions/my_package.fish
2015-01-30 08:06:05 +08:00
```
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
> Use `omf new theme my_theme` for themes.
Please provide [auto completion ](http://fishshell.com/docs/current/commands.html#complete ) for your utilities if applicable and describe how your package works in the `README.md` .
2015-05-01 00:46:10 +08:00
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
`my_package.fish` defines a single function:
```fish
function my_package -d "My package"
end
```
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
> Bear in mind that fish lacks a private scope so consider the following options to avoid polluting the global namespace:
2015-02-15 03:08:16 +08:00
2015-08-26 23:20:13 +08:00
+ Prefix functions: `my_package_my_func` .
+ Using [blocks ](http://fishshell.com/docs/current/commands.html#block ).
2013-05-17 21:05:41 +08:00
2015-05-30 20:21:54 +08:00
2015-08-26 23:20:13 +08:00
### Submitting
Oh My Fish keeps a registry of packages under `$OMF_PATH/db/` .
To create a new entry run:
```fish
omf submit pkg/my_package .../my_package.git
```
2015-05-30 20:21:54 +08:00
2015-08-26 23:20:13 +08:00
Similarly for themes use:
```fish
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][omf-pulls-link] to update the global registry.
### Initialization
2015-08-27 00:33:22 +08:00
If you want to be [notified ](http://fishshell.com/docs/current/commands.html#emit ) when your package loads, declare the following function in your `my_package.fish` :
2015-08-26 23:20:13 +08:00
```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.
```fish
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:
```fish
set -g OMF_IGNORE skip this that ...
```
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
# License
2014-04-17 04:01:38 +08:00
2015-08-26 23:20:13 +08:00
MIT © [Oh My Fish][contributors] :metal:
2013-05-17 21:05:41 +08:00
2015-08-26 23:20:13 +08:00
[fishshell]: http://fishshell.com
2015-01-30 08:06:05 +08:00
2015-08-27 00:49:23 +08:00
[contributors]: https://github.com/fish-shell/oh-my-fish/graphs/contributors
2013-05-17 21:05:41 +08:00
2015-08-27 00:49:23 +08:00
[travis-badge]: http://img.shields.io/travis/fish-shell/oh-my-fish.svg?style=flat-square
[travis-url]: https://travis-ci.org/fish-shell/oh-my-fish
2013-06-21 10:49:24 +08:00
2015-08-26 23:20:13 +08:00
[fish-badge]: https://img.shields.io/badge/fish-v2.2.0-007EC7.svg?style=flat-square
2015-03-29 11:45:38 +08:00
2015-08-26 23:20:13 +08:00
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
2015-03-29 12:05:18 +08:00
2015-08-27 00:49:23 +08:00
[omf-pulls-link]: https://github.com/fish-shell/oh-my-fish/pulls