%%% United States of the Fish → Wahoo + OMF %%%

pull/2/head
Jorge Bucaran 9 years ago
parent 4d628d5f43
commit 2693a2fd18

@ -1,11 +1,9 @@
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
# http://editorconfig.org
root = true
# Two-space indent, Unix-style newlines, and a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

18
.gitignore vendored

@ -1,13 +1,9 @@
custom/*
plugins/*
themes/*
pkg/**
!pkg/omf
!pkg/omf/**
.DS_Store
*.pyc
*~
*.sw?
plugins/ta/data/*
themes/**
!themes/default/*
# Track oh-my-fish plugin
!plugins/omf/
.DS_Store
**/.DS_Store

@ -1,24 +1,13 @@
language: c
os:
- linux
- osx
env:
- FISH_PPA=nightly-master BREW_OPTIONS=--HEAD
before_install:
- script/bootstrap.sh
script: script/run-tests.fish
notifications:
email:
on_success: never
on_failure: change
webhooks:
urls:
- https://webhooks.gitter.im/e/16e8638d3a0deeaf317d
on_success: change
on_failure: always
on_start: false
sudo: false
addons:
apt:
packages:
- tree
- fish
before_script: pwd; tree -h
script: /bin/sh bin/install
after_script:
- cd ~/.config/fish; tree -h; find . -type f | xargs cat

@ -1,36 +1,134 @@
<div align="center">
<a href="http://github.com/fish-shell/omf">
<img width=120px src="https://cloud.githubusercontent.com/assets/8317250/8510172/f006f0a4-230f-11e5-98b6-5c2e3c87088f.png">
</a>
</div>
<br>
<p align="center">
<b><a href="#issues">Issues</a></b>
|
<b><a href="#package-repositories">Packages</a></b>
|
<b><a href="#commit-messages">Commit Messages</a></b>
|
<b><a href="#code-style">Code Style</a></b>
</p>
# Contributing
We love pull requests. Here's a quick guide.
Thanks for taking the time to read this guide and please _do_ contribute to Oh My Fish. This is an open initiative and _everyone_ is welcome. :metal:
## Issues
Please [open an issue](https://github.com/fish-shell/omf/issues) for bug reports / patches. Include your OS version, code examples, stack traces and everything you can to help you debug your problem.
If you have a new feature or large change in mind, please open a new issue with your suggestion to discuss the idea together.
## Package Repositories
This is the repository for the core Oh My Fish framework and bootstrap installer.
If your issue is related to a specific package, we still may be able to help, but consider visiting that package's issue tracker first.
## Commit Messages
+ Use the [present tense](https://simple.wikipedia.org/wiki/Present_tense) ("add awesome-package" not "added ...")
+ Less than 72 characters or less for the first line of your commit.
+ Use of [emoji](http://www.emoji-cheat-sheet.com/) is definitely encouraged. :lollipop:
## Code Style
> These rules are not set in stone. Feel free to open an issue with suggestions and/or feedback.
### Control Flow
Using `if..else..end` blocks is preferred.
```fish
if not set -q ENV_VARIABLE
set -g ENV_VARIABLE 42
end
```
The following syntax is more concise, but arguably less transparent.
> You still may use `and` / `or` statements if you consider `if..else..then` to be overkill.
```fish
set -q VAR; set -g VAR 42
```
### Functions
Use named arguments `-a`:
```fish
function greet -a message
echo "$message"
end
```
Use `-d` description fields:
Fork and make your change. Make sure the tests pass:
```fish
function greet -a message -d "Display a greeting message"
echo "$message"
end
```
./script/run-tests.fish -v
`fish` does not have private functions, so in order to avoid polluting the global namespace, use a prefix based in the scope of your code. For example, if you are writing a `ninja` plugin using `__ninja_function_name`.
Push to your fork and [submit a pull request][pr].
If you are writing a function inside another function, prefix the inner one with the parent's name.
At this point you're waiting on us. We usually comment on pull requests within a few hours. We may suggest some changes or improvements or alternatives.
```fish
function parent
function parent_child
end
end
```
Some things that will increase the chance that your pull request is accepted:
Note that it's still possible to mimic private functions in `fish` by deleting the function before returning using `functions -e function_name`
* Write tests.
* Follow our [style guide][style].
* Write a [good commit message][commit].
```fish
function public_func
function private_func
# ...
functions -e private_func
end
end
```
## Style Guide
### Blocks
* Indentation should follow the "2-space convention".
* Keep line length to a maximum of 100 characters.
Blocks allow you to write code resembling macro expressions composed of smaller blocks without relying on variables.
### Plugins
Compare the following _without_ blocks:
If your plugin is complex, make sure to include tests, we suggest using [fish-spec][].
```fish
set -l colors green1 green2 green3
if test $error -ne 0
set colors red1 red2 red3
end
### Themes
for color in $colors
printf "%s"(set_color $color)">"
end
```
Make sure to include a screenshot in your pull request, but don't commit the file to git. A nifty way is to post a comment with the image and link directly to it.
and _using_ blocks:
```fish
for color in (begin
if test $error -ne 0
and printf "%s\n" red1 red2 red3
or printf "%s\n" green1 green2 green3
end)
printf "%s"(set_color $color)">"
end
```
[pr]: https://github.com/oh-my-fish/oh-my-fish/compare/
[fish-spec]: https://github.com/oh-my-fish/oh-my-fish/tree/master/plugins/fish-spec
[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[style]: #style-guide
The second example does not use a `colors` variable.

@ -1,18 +0,0 @@
FROM ubuntu:latest
# Install dependencies
RUN apt-get -y install curl git software-properties-common
# Set bootstrap script environment variables
ENV FISH_PPA=nightly-master \
TRAVIS_OS_NAME=linux TRAVIS_REPO_SLUG=oh-my-fish/oh-my-fish TRAVIS_BRANCH=master
# Cache script folder
ADD script /src/script
# Install fish and oh-my-fish
RUN /src/script/bootstrap.sh
WORKDIR /root/.oh-my-fish
CMD ["fish", "./script/run-tests.fish", "--verbose"]

@ -0,0 +1,89 @@
<div align="center">
<a href="http://github.com/fish-shell/omf">
<img width=120px src="https://cloud.githubusercontent.com/assets/8317250/8510172/f006f0a4-230f-11e5-98b6-5c2e3c87088f.png">
</a>
</div>
<br>
# FAQ
Thanks for taking the time to read this FAQ. Feel free to create a new issue if your question is not answered here.
## What is Oh My Fish and why do I want it?
Oh My Fish is a _framework_ for the [fishshell](https://fishshell.org). It helps you manage your configuration, themes and packages.
## What do I need to know to use Oh My Fish?
_Nothing_. You can install Oh My Fish and keep using Fish as usual. When you are ready to learn more just type `wa help`.
## What are Oh My Fish packages?
Oh My Fish packages are themes or plugins written in fish that extend the shell core functionality, run code during initialization, add auto completion for known utilities, etc.
## What kind of Oh My Fish packages are there?
There are roughly 3 kinds of packages:
1. Configuration utilities. For example [`pkg-pyenv`](https://github.com/oh-my-fish/pkg-pyenv) checks whether `pyenv` exists in your system and runs `(pyenv init - | psub)` for you during startup.
2. Themes. Check our [theme gallery](https://github.com/oh-my-fish).
3. Traditional shell utilities. For example [`pkg-copy`](https://github.com/oh-my-fish/pkg-copy), a clipboard utility compatible across Linux and OSX.
## What does Oh My Fish do exactly?
+ Autoload installed packages and themes under `$OMF_PATH/`.
+ Autoload your custom path. `$OMF_PATH/custom` by default, but configurable via `$OMF_CUSTOM`.
+ Autoload any `functions` directory under `$OMF_PATH` and `$OMF_CUSTOM`
+ Run `$OMF_CUSTOM/init.fish` if available.
## How can I upgrade from an existing Oh My Fish installation?
> :warning: Remember to backup your dotfiles and other sensitive data first.
```
rm -rf "$fish_path"
curl -L git.io/omf | sh
```
## I changed my prompt with `fish_config` and now I can't get my Oh My Fish theme's prompt back, what do I do?
`fish_config` persists the prompt to `~/.config/fish/functions/fish_prompt.fish`. That file gets loaded _after_ the Oh My Fish theme, therefore it takes precedence over the Oh My Fish theme's prompt. To restore your Oh My Fish theme prompt, simply remove that file by running:
```
rm ~/.config/fish/functions/fish_prompt.fish
```
## How do I use fish as my default shell?
Add Fish to `/etc/shells`:
```sh
echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
```
Make Fish your default shell:
```sh
chsh -s /usr/local/bin/fish
```
To switch your default shell back:
> Substitute `/bin/bash` with `/bin/tcsh` or `/bin/zsh` as appropriate.
```sh
chsh -s /bin/bash
```

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2014 Bruno Ferreira Pinto
Copyright (c) 2015, Oh My Fish!
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,66 +1,243 @@
> The [Fishshell][fishshell] Framework
[![Fish Version][fish-badge]][fishshell]
[![Build Status][travis-badge]][travis-url]
[![License][license-badge]](#LICENSE)
<a name="omf"></a>
<br>
<p align="center">
<a href="https://github.com/oh-my-fish/oh-my-fish">
<img width=20% src="https://cloud.githubusercontent.com/assets/958723/6883431/9beb62b0-d58b-11e4-902c-2f716859a7ad.png">
</a>
<a href="https://github.com/fish-shell/omf/blob/master/README.md">
<img width="200px" src="https://cloud.githubusercontent.com/assets/8317250/8510172/f006f0a4-230f-11e5-98b6-5c2e3c87088f.png">
</a>
</p>
<a name="omf"></a>
<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>
|
<b><a href="https://github.com/fish-shell/omf/wiki/Screencasts">Screencasts</a></b>
|
<b><a href="/CONTRIBUTING.md">Contributing</a></b>
|
<b><a href="/FAQ.md">FAQ</a></b>
<p align="center">
<a href="https://gitter.im/fish-shell/omf?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge">
<img src="https://badges.gitter.im/Join%20Chat.svg">
</a>
</p>
</p>
[![Build Status](https://travis-ci.org/oh-my-fish/oh-my-fish.svg?branch=master)](https://travis-ci.org/oh-my-fish/oh-my-fish) [![](https://img.shields.io/badge/Framework-Oh My Fish-blue.svg?style=flat)](https://github.com/oh-my-fish/oh-my-fish) ![](https://img.shields.io/cocoapods/l/AFNetworking.svg) [![Join the chat at https://gitter.im/oh-my-fish/oh-my-fish](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/oh-my-fish/oh-my-fish?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<br>
# About
# Oh My Fish!
> :warning: You need [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
and [Fish][fishshell] to install Oh My Fish!.
### Why?
Developing on a shell should be a pleasure. Our goal is to help developers that do not want to spend time configuring their own computer to spend time doing what they want.
Oh My Fish is an all-purpose framework for the [fishshell][Fishshell]. It looks after your configuration, themes and packages. It's lightining fast and easy to use.
### How?
With the power of our community, we take the already awesome [fish shell][fish] to another level by creating simple-to-use plugins and themes.
We love contributions, [fork and send us a PR](https://github.com/fish-shell/omf/fork).
[fish]: http://fishshell.com/
# Install
### What?
Oh-my-fish is a user-friendly framework for managing your fish-shell configuration. It includes optional plugins (brew, git-flow, rails, python, node, etc) and themes.
```sh
curl -L git.io/omf | sh
omf help
```
<br>
## Installation
Or _download_ and run it yourself:
```sh
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.
## `omf get` _`<package> ...`_
Install one _or more_ themes or packages. To list available packages type `omf use`.
> You can fetch packages by URL as well via `omf get URL`
## `omf list`
List installed packages.
> To list packages available for download use `omf get`.
## `omf use` _`<theme>`_
Apply a theme. To list available themes type `omf use`.
## `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.
> 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][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
+ [Bootstrap](#bootstrap)
+ [Startup](#startup)
+ [Core Library](#core-library)
+ [Packages](#packages)
+ [Creating](#creating)
+ [Submitting](#submitting)
+ [Initialization](#initialization)
+ [Uninstall](#uninstall)
+ [Ignoring](#ignoring)
## Bootstrap
Oh My Fish's bootstrap script will install `git` and `fish` if not available, switch your default shell and modify `$HOME/.config/fish/config.fish` to source Oh My Fish's `init.fish` script.
## 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.
+ [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:
```fish
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/tools/install.fish | fish
$ omf new pkg my_package
my_package/
README.md
my_package.fish
completions/my_package.fish
```
**NOTE**: The installation script renames your existing `config.fish` to `config.orig`, and replaces it with [the default oh-my-fish config](https://github.com/oh-my-fish/oh-my-fish/blob/master/templates/config.fish). If you have existing customizations to your fish config, you will need to manually include those customizations after the install.
> 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`.
If you want to install it manually, [click here](https://github.com/oh-my-fish/oh-my-fish/wiki/Manual-Installation).
## Usage
`my_package.fish` defines a single function:
```fish
function my_package -d "My package"
end
```
Open your fish configuration file `~/.config/fish/config.fish` and specify the theme and the plugins you want to use. And then run `omf install` on your terminal to install them.
> Bear in mind that fish lacks a private scope so consider the following options to avoid polluting the global namespace:
Before setting down on a theme, you might want to have a go with all themes using our quick [theme switcher](https://github.com/oh-my-fish/plugin-theme) by typing `theme --help` on your shell.
+ Prefix functions: `my_package_my_func`.
+ Using [blocks](http://fishshell.com/docs/current/commands.html#block).
## Upgrading from previous version
[![asciicast](https://asciinema.org/a/20802.png)](https://asciinema.org/a/20802)
### 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
```
## Customization
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
If you want to be [notified](http://fishshell.com/docs/current/commands.html#emit) when your package is loads, declare the following function in your `my_package.fish`:
```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 ...
```
If you have many functions which go well together, you can create custom plugin in the `custom/plugins/PLUGIN_NAME` directory and add to it as many functions as you want.
If you would like to use your custom theme, move it with the same name in the `custom/themes/` directory and it will override the original theme in `themes/`.
# License
If you just want to override any of the default behavior or add some environment variables, just add a new file (ending in .load) into the `custom/` directory.
MIT © [Oh My Fish][contributors] :metal:
## Contributing
[fishshell]: http://fishshell.com
Create an [issue](https://github.com/oh-my-fish/oh-my-fish/issues) linking to your repository and we will move it to the [oh-my-fish](https://github.com/oh-my-fish) organization.
[contributors]: https://github.com/fish-shell/omf/graphs/contributors
## Uninstall
[travis-badge]: http://img.shields.io/travis/fish-shell/omf.svg?style=flat-square
[travis-url]: https://travis-ci.org/fish-shell/omf
rm -rf ~/.oh-my-fish
## License
[fish-badge]: https://img.shields.io/badge/fish-v2.2.0-007EC7.svg?style=flat-square
[MIT](http://mit-license.org) © [Contributors](https://github.com/oh-my-fish/oh-my-fish/graphs/contributors)
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
[Logo](https://cloud.githubusercontent.com/assets/958723/6847746/8d1b95b0-d3a7-11e4-866a-6bdc1eea0fe6.png) by [marcker](https://github.com/marcker):small_blue_diamond: [Attribution CC 4.0](http://creativecommons.org/licenses/by/4.0/)
[omf-pulls-link]: https://github.com/fish-shell/omf/pulls

@ -0,0 +1,120 @@
#!/bin/sh
#
# USAGE
# #1: curl -L git.io/omf | sh
# #2: curl -L git.io/omf > install && chmod +x install && ./install
# #3: OMF_CUSTOM=~/.dotfiles curl -L git.io/omf | sh
#
# ENV
# XDG_DATA_HOME Base directory (~/.local/share)
# XDG_CONFIG_HOME Base configuration directory (~/.config)
#
# ↑ See XDG Base Directory Specification
# → https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
#
# OMF_PATH Oh My Fish directory
# OMF_CONFIG Oh My Fish configuration
# OMF_CUSTOM Custom dotfiles directory
#
# OMF_REPO_URI Source git repository
# OMF_REPO_BRANCH Source repository default branch (master)
#
# FUNCTIONS
# die
# is_installed
# omf_create_fish_config <path/to/fish.config>
# omf_install
test -z ${XDG_DATA_HOME+_} && XDG_DATA_HOME="${HOME}/.local/share"
test -z ${XDG_CONFIG_HOME+_} && XDG_CONFIG_HOME="${HOME}/.config"
test -z ${OMF_PATH+_} && OMF_PATH="${XDG_DATA_HOME}/omf"
test -z ${OMF_CUSTOM+_} && OMF_CUSTOM="${HOME}/.dotfiles"
test -z ${OMF_CONFIG+_} && OMF_CONFIG="${XDG_CONFIG_HOME}/omf"
test -z ${OMF_REPO_URI+_} && OMF_REPO_URI="https://github.com/fish-shell/omf"
test -z ${OMF_REPO_BRANCH+_} && OMF_REPO_BRANCH="master"
die() {
echo "$1" && exit 1
}
is_installed() {
type "$1" >/dev/null 2>&1
}
omf_create_fish_config() {
local fish_config_file=$1
mkdir -p $(dirname "${fish_config_file}")
touch "${fish_config_file}"
}
omf_install() {
echo "Resolving Oh My Fish path → ${OMF_PATH}"
test -d "${OMF_PATH}" && die "Existing installation detected, aborting"
local git_uri="$(echo ${OMF_REPO_URI} | sed 's/\.git//').git"
echo "Cloning Oh My Fish → ${git_uri}"
if ! git clone -q --depth 1 -b "${OMF_REPO_BRANCH}" "${git_uri}" "${OMF_PATH}"; then
echo "Is 'git' installed?"
die "Could not clone the repository → ${OMF_PATH}:${OMF_REPO_BRANCH}"
fi
pushd ${OMF_PATH} >/dev/null 2>&1
local git_rev=$(git rev-parse HEAD) >/dev/null 2>&1
local git_upstream=$(git config remote.upstream.url)
if [ -z "${git_upstream}" ]; then
git remote add upstream ${git_uri}
else
git remote set-url upstream ${git_uri}
fi
echo "Oh My Fish revision id → ${git_rev}"
popd >/dev/null 2>&1
test -z ${FISH_CONFIG+_} && FISH_CONFIG="${XDG_CONFIG_HOME}/fish"
local fish_config_file="${FISH_CONFIG}/config.fish"
if [ -e "${FISH_CONFIG}/config.fish" ]; then
local timestamp=$(date +%s)
local fish_config_bk="${FISH_CONFIG}/config.${timestamp}.copy"
echo "Found existing 'fish' configuration → ${fish_config_file}"
echo "Writing back-up copy → ${fish_config_bk}"
cp "${fish_config_file}" "${fish_config_bk}" >/dev/null 2>&1
test $? -ne 0 && die "Writing back-up copy failed, error code → ${?}"
else
omf_create_fish_config $fish_config_file
fi
echo "Adding Oh My Fish bootstrap → ${fish_config_file}"
touch ${fish_config_file} >/dev/null 2>&1
test ! -w ${fish_config_file} && die "Fish configuration file is not writable, aborting."
echo "set -g OMF_PATH $(echo "${OMF_PATH}" | sed -e "s|$HOME|\$HOME|")" > ${fish_config_file}
echo "set -g OMF_CUSTOM $(echo "${OMF_CUSTOM}" | sed -e "s|$HOME|\$HOME|")" >> ${fish_config_file}
echo "set -g OMF_CONFIG $(echo "${OMF_CONFIG}" | sed -e "s|$HOME|\$HOME|")" >> ${fish_config_file}
echo "source \$OMF_PATH/init.fish" >> ${fish_config_file}
if [ ! -d "${OMF_CONFIG}" ]; then
echo "Writing Oh My Fish configuration → ${OMF_CONFIG}"
mkdir -p "${OMF_CONFIG}"
test -f "${OMF_CONFIG}/theme" || echo default > "${OMF_CONFIG}/theme"
test -f "${OMF_CONFIG}/revision" || echo ${git_rev} > "${OMF_CONFIG}/revision"
fi
}
echo "Installing Oh My Fish..."
! is_installed "fish" && die "Please install fish to continue → http://fishshell.com/"
if omf_install; then
echo "Oh My Fish successfully installed."
cd $HOME
# Do not swap process if running in a CI environment.
[ -z ${CI+_} ] || exit 0 && exec "fish" < /dev/tty
else
die "Oh My Fish couldn't install, but you can complain here → git.io/omf-issues"
fi

@ -1,5 +0,0 @@
# Add yourself some shortcuts to projects you often work on
# Example:
#
# set oh-my-fish /Users/bpinto/.oh-my-fish
#

@ -1,2 +0,0 @@
# Optionally add completions for your plugin here.
# complete -f -c my_command -a some_arg -d 'Description here'

@ -1,2 +0,0 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.

@ -0,0 +1 @@
https://github.com/wa/pkg-ansible

@ -0,0 +1 @@
https://github.com/wa/pkg-battery

@ -0,0 +1 @@
https://github.com/wa/pkg-copy

@ -0,0 +1 @@
https://github.com/wa/pkg-direnv

@ -0,0 +1 @@
https://github.com/cap10morgan/wa-emacs

@ -0,0 +1 @@
https://github.com/wa/pkg-extract

@ -0,0 +1 @@
https://github.com/wa/pkg-fasd

@ -0,0 +1 @@
https://github.com/wa/pkg-gi

@ -0,0 +1 @@
https://github.com/wa/pkg-hub

@ -0,0 +1 @@
https://github.com/wa/pkg-keychain

@ -0,0 +1 @@
https://github.com/wa/pkg-limap

@ -0,0 +1 @@
https://github.com/wa/pkg-osx_manpath

@ -0,0 +1 @@
https://github.com/wa/pkg-peco

@ -0,0 +1 @@
https://github.com/wa/pkg-pyenv

@ -0,0 +1 @@
https://github.com/wa/pkg-rbenv

@ -0,0 +1 @@
https://github.com/wa/pkg-set_color

@ -0,0 +1 @@
https://github.com/wa/pkg-stamp

@ -0,0 +1 @@
https://github.com/wa/pkg-thefuck

@ -0,0 +1 @@
https://github.com/wa/pkg-tiny

@ -0,0 +1 @@
https://github.com/wa/theme-agnoster

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-agnoster

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-agnoster-mercurial

@ -0,0 +1 @@
https://github.com/wa/theme-batman

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-beloglazov

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-bira

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-bobthefish

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-budspencer

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-cbjohnson

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-clearance

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-cmorrell

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-coffeeandcode

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-cor

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-dangerous

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-eclm

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-edan

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-fishface

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-fishy-drupal

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-fisk

@ -0,0 +1 @@
https://github.com/wa/theme-flash

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-fox

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-gianu

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-gitstatus

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-gnuykeaj

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-godfather

@ -0,0 +1 @@
https://github.com/wa/theme-hogan

@ -0,0 +1 @@
https://github.com/wa/theme-hulk

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-idan

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-integral

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-jacaetevha

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-krisleech

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-l

@ -0,0 +1 @@
https://github.com/wa/theme-led

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-mtahmed

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-nai

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-numist

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-ocean

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-perryh

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-red-snapper

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-robbyrussell

@ -0,0 +1 @@
https://github.com/wa/theme-russell

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-scorphish

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-simplevi

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-syl20bnr

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-taktoa

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-technopagan

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-toaster

@ -0,0 +1 @@
https://github.com/daveyarwood/tomita

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-trout

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-uggedal

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-will

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-yimmy

@ -0,0 +1 @@
https://github.com/oh-my-fish/theme-zish

@ -1,11 +0,0 @@
function Plugin --argument-names name
set -g fish_plugins $fish_plugins $name
if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ]
import plugins/$name
else
set_color red
echo "Plugin '$name' is not installed. Run 'omf install' to download and install it."
set_color normal
end
end

@ -1,11 +0,0 @@
function Theme --argument-names name
set -g fish_theme $name
if [ -e $fish_path/themes/$name -o -e $fish_custom/themes/$name ]
import themes/$name
else
set_color red
echo "Theme '$name' is not installed. Run 'omf install' to download and install it."
set_color normal
end
end

@ -1,48 +0,0 @@
# NAME
# _prepend_path - adds a path to a list
#
# SYNOPSIS
# _prepend_path [-d --destination <destination path>] <path>
#
# DESCRIPTION
# Adds a path to a list.
# If no list specified, defaults to $PATH
#
# OPTIONS
# <path>
# Required. Specify the path to add to the list.
# OPERATORS
# -d <DESTINATION PATH>
# Should appear at the end if used. Specifies the name of the
# list to prepend the paths to.
# If not used, $PATH is assumed by default.
#
# EXAMPLES
# _prepend_path $path
# Add $path to $PATH
#
# _prepend_path $path -d $fish_function_path
# Add $path to $fish_function_path
#/
function _prepend_path
# $PATH is the default destination path
set -l destination_path PATH
set -l path $argv
if test (count $argv) -gt 2
switch $path[-2]
case -d --destination
set destination_path $path[-1]
set path $path[1..-3]
end
end
for path in $path
if test -d $path
if not contains $path $$destination_path
set $destination_path $path $$destination_path
end
end
end
end

@ -1,105 +0,0 @@
# NAME
# _prepend_tree - add a dependency tree to fish_function_path
#
# SYNOPSIS
# _prepend_tree [-v --verbose] <path> [<glob>..]
#
# DESCRIPTION
# Search a path tree and prepend directories with fish files. Use a glob
# list to include or exclude other file extensions. Use -v --verbose to
# output directories to be added to the path.
#
# OPTIONS
# [-v --verbose]
# Optional. Print directories that match the glob. Must be the
# first argument if used.
#
# <path>
# Required. Specify the path to search for glob patterns.
#
# [<glob> [<operator> <glob>..]]
# Glob pattern to match when traversing the path path.
#
# OPERATORS
# [! -not glob]
# Negates the following glob.
#
# [<glob> -o -or <glob>..]
# Default. Must meet at least one listed criteria.
#
# [<glob> [-a -and <glob>..]]
# Must meet *all* listed criteria.
#
# EXAMPLES
# _prepend_tree $path
# Match directories in $path containing `.fish` files.
#
# _prepend_tree $path \*.fish \*.sh
# Match directories in $path with either `.fish` OR `.sh` files.
#
# _prepend_tree $path \*.fish -a ! _\*.\*
# Match directories with `.fish` files that do not start with `_`.
#
# AUTHORS
# Jorge Bucaran <jbucaran@me.com>
#
# SEE ALSO
# .oh-my-fish/functions/_prepend_path.fish
#
# v.0.2.0
#/
function _prepend_tree -d "Add a dependency tree to the Fish path."
# Match directories with .fish files always.
set -l glob -name \*.fish
set -l verbose ""
# Retrieve first argument, either the path or the -v option.
set -l path $argv[1]
if contains -- $path -v --verbose
set verbose -v
# Option first, path should be next.
set path $argv[2]
end
# Parse glob options to create the main glob pattern.
if [ (count $argv) -gt 2 ]
set -l operator -o
for option in $argv[3..-1]
switch $option
case ! -not
set operator $operator !
case -o -or
set operator -o
case -a -and
set operator -a
case "*"
if [ operator = ! ]
set glob $operator $glob
else
set glob $glob $operator
end
set glob $glob -name $option
set operator -o # Default
end
end
end
# Traverse $path prepending only directories with matches. Excludes completions folder.
test -d $path
and for dir in (find $path ! -name "completions" ! -path "*.git*" -type d)
# Use head to retrieve at least one match. Skip not found errors
# for directories that do not exist.
if [ -z (find "$dir" $glob -maxdepth 1 ^/dev/null | head -1) ]
continue
end
# Print matched directories if the -v option is set.
if not [ -z $verbose ]
printf "%s\n" $dir
end
# Prepend matched directory to the the global fish function path.
# Note path duplicates are already handled by _prepend_path.
_prepend_path $dir -d fish_function_path
end
end

@ -1,53 +0,0 @@
# NAME
# import - load libraries, plugins, themes, etc.
#
# SYNOPSIS
# import <path/library>[<path/library>..]
#
# DESCRIPTION
# Import libraries, plugins, themes, completions. Prepend existing
# user custom/<library> directories to the path to allow users to
# override specific functions in themes/plugins.
#
# NOTES
# $fish_path and $fish_custom point to oh-my-fish home and the user
# dotfiles folder respectively. Both globals are usually configured
# in ~/.config/fish/config.fish. Also, import is clever enough to
# skip directories with *.spec.fish files.
#
# EXAMPLES
# import plugins/<plugin>
# import plugins/{dpaste,cask} themes/bobthefish
#
# AUTHORS
# Jorge Bucaran <jbucaran@me.com>
#
# SEE ALSO
# functions/_prepend_path.fish
# functions/_prepend_tree.fish
#
# v.0.1.1
#/
function import -d "Load libraries, plugins, themes, etc."
# Do not add spec files to function path.
set -l skip_spec \*.fish -a ! \*.spec.fish
for library in $argv
# Prepend plugins, themes and completions, traversing library
# trees and prepending directories with fish code.
_prepend_tree $fish_path/$library $skip_spec
_prepend_tree $fish_custom/$library $skip_spec
_prepend_path $fish_path/$library/completions -d fish_complete_path
_prepend_path $fish_custom/$library/completions -d fish_complete_path
# Set path to load files.
set -l path $library/(basename $library).load
# Source each plugin, theme, etc., configuration load file.
for load in $fish_path/$path $fish_custom/$path
if [ -e $load ]
. $load
end
end
end
end

@ -1,29 +0,0 @@
function restore_original_fish_colors
# Regular syntax highlighting colors
set fish_color_normal normal
set fish_color_command 005fd7 purple
set fish_color_param 00afff cyan
set fish_color_redirection normal
set fish_color_comment red
set fish_color_error red --bold
set fish_color_escape cyan
set fish_color_operator cyan
set fish_color_quote brown
set fish_color_autosuggestion 555 yellow
set fish_color_valid_path --underline
set fish_color_cwd green
set fish_color_cwd_root red
# Background color for matching quotes and parenthesis
set fish_color_match cyan
# Background color for search matches
set fish_color_search_match --background=purple
# Pager colors
set fish_pager_color_prefix cyan
set fish_pager_color_completion normal
set fish_pager_color_description 555 yellow
set fish_pager_color_progress cyan
end

@ -1,94 +0,0 @@
# Cloned from https://github.com/fish-shell/fish-shell/issues/522
function source_script --description 'Source sh/csh file'
set -l ext
set -l type
while true
switch $argv[1]
case '--sh'
set type sh
case '--csh'
set type csh
case '--bash'
set type bash
case '--ext'
set ext 1
case '*'
break
end
set -e argv[1]
end
if not test "$type"
for f in $argv
switch $f
case '*.sh'
set type bash
break
case '*.csh' '*.tcsh'
set type csh
break
end
end
end
set -l exe
set -l source
switch "$type"
case bash
set exe /bin/bash
set source .
case sh
set exe /bin/sh
set source .
case csh
set exe /bin/tcsh
set source source
case '*'
echo Unknown source type for "'$argv'"
end
if test "$ext"
eval "exec $exe -c '$source $argv; exec fish'"
else
set -l f1 (command mktemp -t tmp.XXXXXXXXXX)
set -l f2 (command mktemp -t tmp.XXXXXXXXXX)
eval $exe -c "'env | sort > $f1; $source $argv; env | sort > $f2'"
set -l filter "(^[^\+-]|^\+\+\+|^---|^[\+-]_|^[\+-]PIPESTATUS|^[\+-]COLUMNS)"
set -l pattern 's/[:]\{0,1\}\([^:]\+\)/"\1" /g'
set -l IFS '='
set -l diffopts --old-line-format '-=%L' --new-line-format '+=%L' --unchanged-line-format ''
command diff $diffopts $f1 $f2 | command grep -vE $filter | while read -l state var value
switch $state$var
case -PATH
continue
case +PATH
eval set value (echo $value | tr : ' ')
for pt in $value
contains $pt $PATH; and continue
if not test -d $pt
echo "Unable to add '$pt' to \$PATH. Check existance."
continue
end
set -gx PATH $PATH $pt > /dev/null
end
case '-*'
set -e $var
case '+*'
eval set -gx $var (echo $value | command sed $pattern)
case '*'
echo Source error! Invalid case "'$state$var'"
end
end
command rm $f1 $f2 > /dev/null
end
end

@ -0,0 +1,54 @@
# SYNOPSIS
# Initialize Oh My Fish.
#
# ENV
# OSTYPE Operating system.
# RESET_PATH Original $PATH preseved across Oh My Fish refreshes.
# OMF_PATH Set in ~/.config/fish/config.fish
# OMF_IGNORE List of packages to ignore.
# OMF_CUSTOM Same as OMF_PATH. ~/.dotfiles by default.
#
# OVERVIEW
# + Autoload Oh My Fish packages, themes and custom path
# + For each <pkg> inside {$OMF_PATH,$OMF_CUSTOM}
# + Autoload <pkg> directory
# + Source <pkg>.fish
# + Emit init_<pkg> event
#
# + Autoload {$OMF_PATH,$OMF_CUSTOM}/functions
# + Source {$OMF_PATH,$OMF_CUSTOM}fish-shell/fish-shell/issues/845
# + Source $OMF_CUSTOM/init.fish
if set -q RESET_PATH
set PATH $RESET_PATH
else
set -gx RESET_PATH $PATH
end
set -q OSTYPE; or set -g OSTYPE (uname)
# Save the head of function path and autoload Oh My Fish core functions
set -l user_function_path $fish_function_path[1]
set fish_function_path[1] $OMF_PATH/lib
set -l theme {$OMF_PATH,$OMF_CUSTOM}/themes/(cat $OMF_CONFIG/theme)
set -l paths $OMF_PATH/pkg/*
set -l custom $OMF_CUSTOM/pkg/*
set -l ignore $OMF_IGNORE
for path in $paths
set custom $OMF_CUSTOM/(basename $path) $custom
end
for path in $OMF_PATH/lib $OMF_PATH/lib/git $paths $theme $custom
contains -- (basename $path) $ignore; and continue
autoload $path $path/completions
source $path/(basename $path).fish
and emit init_(basename $path) $path
end
autoload $OMF_CUSTOM/functions
autoload $user_function_path
source {$OMF_PATH,$OMF_CUSTOM}/events.fish
source $OMF_CUSTOM/init.fish

@ -0,0 +1,78 @@
<p align="center">
<a href="https://github.com/fish-shell/omf/blob/master/README.md">
<img width="100px" src="https://cloud.githubusercontent.com/assets/8317250/8510172/f006f0a4-230f-11e5-98b6-5c2e3c87088f.png">
</a>
</p>
# Core Library
## Basic Functions
#### `autoload` _`<path [path...]>`_
Autoload a function or completion path. Add the specified list of directories to `$fish_function_path`.
Any `completions` directories are correctly added to the `$fish_complete_path`.
```fish
autoload $mypath $mypath/completions
```
#### `available` _`<name>`_
Check if a program is available to run. Sets `$status` to `0` if the program is available.
Use this function to check if a plugin is available before using it:
```fish
if available battery
battery
end
```
#### `basename` _`<path> ...`_
Wrap basename so it can handle multiple arguments.
#### `refresh`
Extract the root (top-most parent directory), dirname and basename from [`fish_prompt`](http://fishshell.com/docs/current/faq.html#faq-prompt).
#### `prompt_segments`
Replace the running instance of fishshell with a new one causing Oh My Fish to reload as well.
## Git Functions
#### `git_ahead`
Echo a character that represents whether the current repo is ahead, behind or has diverged from its upstream.
##### Default values:
+ ahead: `+`
+ behind: `-`
+ diverged: `±`
+ none: ` `
#### `git_is_repo`
Set `$status` to `0` if the current working directory belongs to a git repo.
#### `git_branch_name`
Echo the currently checked out branch name of the current repo.
#### `git_is_dirty`
Set `$status` to `0` if there are any changes to files already being tracked in the repo.
#### `git_is_staged`
Set `$status` to `0` if there [staged](http://programmers.stackexchange.com/questions/119782/what-does-stage-mean-in-git) changes.
#### `git_is_stashed`
Set `$status` to `0` if there are items in the [stash](https://git-scm.com/book/en/v1/Git-Tools-Stashing).
#### `git_is_touched`
Set `$status` to `0` if the repo has any changes whatsoever, including [tracked or untracked](http://stackoverflow.com/questions/9663507/what-is-tracked-files-and-untracked-files-in-the-context-of-git) files.
#### `git_untracked`
Echo a `\n` separated list of untracked files.

@ -0,0 +1,19 @@
# SYNOPSIS
# autoload <path [path...]>
#
# OVERVIEW
# Autoload a function or completion path. Add the specified list of
# directories to $fish_function_path. Any `completions` directories
# are correctly added to the $fish_complete_path.
function autoload -d "autoload a function or completion path"
for path in $argv
if test -d "$path"
set -l dest fish_function_path
if test (basename "$path") = "completions"
set dest fish_complete_path
end
contains "$path" $$dest; or set $dest "$path" $$dest
end
end
end

@ -0,0 +1,9 @@
# SYNOPSIS
# available [name]
#
# OVERVIEW
# Check if a program is available.
function available -a program -d "check if a program is available."
type "$program" ^/dev/null >&2
end

@ -0,0 +1,29 @@
# SYNOPSIS
# basename <string> [suffix]
# basename [-s suffix] <string> [string...]
#
# OVERVIEW
# osx style variable arguments basename
function basename -d "get the filename or directory part of a path"
if test (uname) = "Darwin"
command basename $argv
else
if set -q argv[1]
set -l ext ""
switch $argv[1]
case -s
if test (count $argv) -gt 2
set ext $argv[2]
set argv $argv[3..-1]
else
echo "basename: Invalid number of arguments"
return 1
end
end
for path in $argv
command basename "$path" "$ext"
end
end
end
end

@ -0,0 +1,15 @@
function git_ahead -a ahead behind diverged none
git_is_repo; and begin
test -z "$ahead"; and set ahead "+"
test -z "behind"; and set behind "-"
test -z "diverged"; and set diverged "±"
test -z "none"; and set none ""
command git rev-list --left-right "@{upstream}...HEAD" ^/dev/null \
| awk "/>/ {a += 1} /</ {b += 1} \
{if (a > 0) nextfile} END \
{if (a > 0 && b > 0) print \"$diverged\"; \
else if (a > 0) print \"$ahead\"; \
else if (b > 0) print \"$behind\";
else printf \"$none\"}"
end
end

@ -0,0 +1,5 @@
function git_branch_name -d "Get current branch name"
git_is_repo; and begin
command git symbolic-ref --short HEAD
end
end

@ -0,0 +1,3 @@
function git_is_dirty -d "Check if there are changes to tracked files"
git_is_repo; and not command git diff --no-ext-diff --quiet --exit-code
end

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save