mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-22 10:07:57 +08:00
%%% United States of the Fish → Wahoo + OMF %%%
This commit is contained in:
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
18
.gitignore
vendored
|
@ -1,13 +1,9 @@
|
|||
custom/*
|
||||
plugins/*
|
||||
themes/*
|
||||
pkg/**
|
||||
!pkg/omf
|
||||
!pkg/omf/**
|
||||
|
||||
themes/**
|
||||
!themes/default/*
|
||||
|
||||
.DS_Store
|
||||
*.pyc
|
||||
*~
|
||||
*.sw?
|
||||
|
||||
plugins/ta/data/*
|
||||
|
||||
# Track oh-my-fish plugin
|
||||
!plugins/omf/
|
||||
**/.DS_Store
|
||||
|
|
31
.travis.yml
31
.travis.yml
|
@ -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
|
||||
|
|
138
CONTRIBUTING.md
138
CONTRIBUTING.md
|
@ -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:
|
||||
|
||||
Fork and make your change. Make sure the tests pass:
|
||||
## Issues
|
||||
|
||||
./script/run-tests.fish -v
|
||||
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.
|
||||
|
||||
Push to your fork and [submit a pull request][pr].
|
||||
If you have a new feature or large change in mind, please open a new issue with your suggestion to discuss the idea together.
|
||||
|
||||
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.
|
||||
## Package Repositories
|
||||
|
||||
Some things that will increase the chance that your pull request is accepted:
|
||||
This is the repository for the core Oh My Fish framework and bootstrap installer.
|
||||
|
||||
* Write tests.
|
||||
* Follow our [style guide][style].
|
||||
* Write a [good commit message][commit].
|
||||
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.
|
||||
|
||||
## Style Guide
|
||||
## Commit Messages
|
||||
|
||||
* Indentation should follow the "2-space convention".
|
||||
* Keep line length to a maximum of 100 characters.
|
||||
+ Use the [present tense](https://simple.wikipedia.org/wiki/Present_tense) ("add awesome-package" not "added ...")
|
||||
|
||||
### Plugins
|
||||
+ Less than 72 characters or less for the first line of your commit.
|
||||
|
||||
If your plugin is complex, make sure to include tests, we suggest using [fish-spec][].
|
||||
+ Use of [emoji](http://www.emoji-cheat-sheet.com/) is definitely encouraged. :lollipop:
|
||||
|
||||
### Themes
|
||||
## Code Style
|
||||
|
||||
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.
|
||||
> These rules are not set in stone. Feel free to open an issue with suggestions and/or feedback.
|
||||
|
||||
### Control Flow
|
||||
|
||||
[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
|
||||
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:
|
||||
|
||||
```fish
|
||||
function greet -a message -d "Display a greeting message"
|
||||
echo "$message"
|
||||
end
|
||||
```
|
||||
|
||||
`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`.
|
||||
|
||||
If you are writing a function inside another function, prefix the inner one with the parent's name.
|
||||
|
||||
```fish
|
||||
function parent
|
||||
function parent_child
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Note that it's still possible to mimic private functions in `fish` by deleting the function before returning using `functions -e function_name`
|
||||
|
||||
```fish
|
||||
function public_func
|
||||
function private_func
|
||||
# ...
|
||||
functions -e private_func
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
### Blocks
|
||||
|
||||
Blocks allow you to write code resembling macro expressions composed of smaller blocks without relying on variables.
|
||||
|
||||
Compare the following _without_ blocks:
|
||||
|
||||
```fish
|
||||
set -l colors green1 green2 green3
|
||||
if test $error -ne 0
|
||||
set colors red1 red2 red3
|
||||
end
|
||||
|
||||
for color in $colors
|
||||
printf "%s"(set_color $color)">"
|
||||
end
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
The second example does not use a `colors` variable.
|
||||
|
|
18
Dockerfile
18
Dockerfile
|
@ -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"]
|
89
FAQ.md
Normal file
89
FAQ.md
Normal file
|
@ -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
|
||||
```
|
2
LICENSE
2
LICENSE
|
@ -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
|
||||
|
|
257
README.md
257
README.md
|
@ -1,66 +1,243 @@
|
|||
<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>
|
||||
</p>
|
||||
> The [Fishshell][fishshell] Framework
|
||||
|
||||
[![Fish Version][fish-badge]][fishshell]
|
||||
[![Build Status][travis-badge]][travis-url]
|
||||
[![License][license-badge]](#LICENSE)
|
||||
|
||||
<a name="omf"></a>
|
||||
|
||||
[![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>
|
||||
|
||||
|
||||
# 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.
|
||||
|
||||
### 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.
|
||||
|
||||
[fish]: http://fishshell.com/
|
||||
|
||||
### 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.
|
||||
<p align="center">
|
||||
<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>
|
||||
|
||||
<br>
|
||||
## Installation
|
||||
|
||||
```fish
|
||||
curl -L https://github.com/oh-my-fish/oh-my-fish/raw/master/tools/install.fish | fish
|
||||
<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>
|
||||
|
||||
<br>
|
||||
|
||||
# About
|
||||
|
||||
> :warning: You need [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||
and [Fish][fishshell] to install Oh My Fish!.
|
||||
|
||||
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.
|
||||
|
||||
We love contributions, [fork and send us a PR](https://github.com/fish-shell/omf/fork).
|
||||
|
||||
# Install
|
||||
|
||||
```sh
|
||||
curl -L git.io/omf | sh
|
||||
omf help
|
||||
```
|
||||
|
||||
**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.
|
||||
Or _download_ and run it yourself:
|
||||
|
||||
If you want to install it manually, [click here](https://github.com/oh-my-fish/oh-my-fish/wiki/Manual-Installation).
|
||||
```sh
|
||||
curl -L git.io/omf > install
|
||||
chmod +x install
|
||||
./install
|
||||
```
|
||||
|
||||
## Usage
|
||||
# :beginner: Getting Started
|
||||
|
||||
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.
|
||||
Oh My Fish includes a small utility `omf` to fetch and install new packages and themes.
|
||||
|
||||
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.
|
||||
## `omf update`
|
||||
|
||||
## Upgrading from previous version
|
||||
Update framework and installed packages.
|
||||
|
||||
[![asciicast](https://asciinema.org/a/20802.png)](https://asciinema.org/a/20802)
|
||||
## `omf get` _`<package> ...`_
|
||||
|
||||
## Customization
|
||||
Install one _or more_ themes or packages. To list available packages type `omf use`.
|
||||
|
||||
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.
|
||||
> You can fetch packages by URL as well via `omf get URL`
|
||||
|
||||
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/`.
|
||||
## `omf list`
|
||||
|
||||
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.
|
||||
List installed packages.
|
||||
|
||||
## Contributing
|
||||
> To list packages available for download use `omf get`.
|
||||
|
||||
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.
|
||||
## `omf use` _`<theme>`_
|
||||
|
||||
## Uninstall
|
||||
Apply a theme. To list available themes type `omf use`.
|
||||
|
||||
rm -rf ~/.oh-my-fish
|
||||
## `omf remove` _`<name>`_
|
||||
|
||||
## License
|
||||
Remove a theme or package.
|
||||
|
||||
[MIT](http://mit-license.org) © [Contributors](https://github.com/oh-my-fish/oh-my-fish/graphs/contributors)
|
||||
> Packages subscribed to `uninstall_<pkg>` events are notified before the package is removed to allow custom cleanup of resources. See [Uninstall](#uninstall).
|
||||
|
||||
[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 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
|
||||
$ 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](http://fishshell.com/docs/current/commands.html#complete) for your utilities if applicable and describe how your package works in the `README.md`.
|
||||
|
||||
|
||||
`my_package.fish` defines a single function:
|
||||
|
||||
```fish
|
||||
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](http://fishshell.com/docs/current/commands.html#block).
|
||||
|
||||
|
||||
### 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
|
||||
```
|
||||
|
||||
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 ...
|
||||
```
|
||||
|
||||
|
||||
# License
|
||||
|
||||
MIT © [Oh My Fish][contributors] :metal:
|
||||
|
||||
[fishshell]: http://fishshell.com
|
||||
|
||||
[contributors]: https://github.com/fish-shell/omf/graphs/contributors
|
||||
|
||||
[travis-badge]: http://img.shields.io/travis/fish-shell/omf.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/fish-shell/omf
|
||||
|
||||
[fish-badge]: https://img.shields.io/badge/fish-v2.2.0-007EC7.svg?style=flat-square
|
||||
|
||||
[license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
|
||||
|
||||
[omf-pulls-link]: https://github.com/fish-shell/omf/pulls
|
||||
|
|
120
bin/install
Executable file
120
bin/install
Executable file
|
@ -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.
|
1
db/pkg/ansible
Normal file
1
db/pkg/ansible
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-ansible
|
1
db/pkg/battery
Normal file
1
db/pkg/battery
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-battery
|
1
db/pkg/copy
Normal file
1
db/pkg/copy
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-copy
|
1
db/pkg/direnv
Normal file
1
db/pkg/direnv
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-direnv
|
1
db/pkg/emacs
Normal file
1
db/pkg/emacs
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/cap10morgan/wa-emacs
|
1
db/pkg/extract
Normal file
1
db/pkg/extract
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-extract
|
1
db/pkg/fasd
Normal file
1
db/pkg/fasd
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-fasd
|
1
db/pkg/hub
Normal file
1
db/pkg/hub
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-hub
|
1
db/pkg/keychain
Normal file
1
db/pkg/keychain
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-keychain
|
1
db/pkg/limap
Normal file
1
db/pkg/limap
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-limap
|
1
db/pkg/osx_manpath
Normal file
1
db/pkg/osx_manpath
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-osx_manpath
|
1
db/pkg/peco
Normal file
1
db/pkg/peco
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-peco
|
1
db/pkg/pyenv
Normal file
1
db/pkg/pyenv
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-pyenv
|
1
db/pkg/rbenv
Normal file
1
db/pkg/rbenv
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-rbenv
|
1
db/pkg/set_color
Normal file
1
db/pkg/set_color
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-set_color
|
1
db/pkg/stamp
Normal file
1
db/pkg/stamp
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-stamp
|
1
db/pkg/thefuck
Normal file
1
db/pkg/thefuck
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-thefuck
|
1
db/pkg/tiny
Normal file
1
db/pkg/tiny
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/pkg-tiny
|
1
db/themes/agnoster
Normal file
1
db/themes/agnoster
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-agnoster
|
1
db/themes/agnoster copy
Normal file
1
db/themes/agnoster copy
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-agnoster
|
1
db/themes/agnoster-mercurial
Normal file
1
db/themes/agnoster-mercurial
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-agnoster-mercurial
|
1
db/themes/batman
Normal file
1
db/themes/batman
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-batman
|
1
db/themes/beloglazov
Normal file
1
db/themes/beloglazov
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-beloglazov
|
1
db/themes/bira
Normal file
1
db/themes/bira
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-bira
|
1
db/themes/bobthefish
Normal file
1
db/themes/bobthefish
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-bobthefish
|
1
db/themes/budspencer
Normal file
1
db/themes/budspencer
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-budspencer
|
1
db/themes/cbjohnson
Normal file
1
db/themes/cbjohnson
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-cbjohnson
|
1
db/themes/clearance
Normal file
1
db/themes/clearance
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-clearance
|
1
db/themes/cmorrell
Normal file
1
db/themes/cmorrell
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-cmorrell
|
1
db/themes/coffeeandcode
Normal file
1
db/themes/coffeeandcode
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-coffeeandcode
|
1
db/themes/cor
Normal file
1
db/themes/cor
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-cor
|
1
db/themes/dangerous
Normal file
1
db/themes/dangerous
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-dangerous
|
1
db/themes/eclm
Normal file
1
db/themes/eclm
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-eclm
|
1
db/themes/edan
Normal file
1
db/themes/edan
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-edan
|
1
db/themes/fishface
Normal file
1
db/themes/fishface
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-fishface
|
1
db/themes/fishy-drupal
Normal file
1
db/themes/fishy-drupal
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-fishy-drupal
|
1
db/themes/fisk
Normal file
1
db/themes/fisk
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-fisk
|
1
db/themes/flash
Normal file
1
db/themes/flash
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-flash
|
1
db/themes/fox
Normal file
1
db/themes/fox
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-fox
|
1
db/themes/gianu
Normal file
1
db/themes/gianu
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-gianu
|
1
db/themes/gitstatus
Normal file
1
db/themes/gitstatus
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-gitstatus
|
1
db/themes/gnuykeaj
Normal file
1
db/themes/gnuykeaj
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-gnuykeaj
|
1
db/themes/godfather
Normal file
1
db/themes/godfather
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-godfather
|
1
db/themes/hogan
Normal file
1
db/themes/hogan
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-hogan
|
1
db/themes/hulk
Normal file
1
db/themes/hulk
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-hulk
|
1
db/themes/idan
Normal file
1
db/themes/idan
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-idan
|
1
db/themes/integral
Normal file
1
db/themes/integral
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-integral
|
1
db/themes/jacaetevha
Normal file
1
db/themes/jacaetevha
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-jacaetevha
|
1
db/themes/krisleech
Normal file
1
db/themes/krisleech
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-krisleech
|
1
db/themes/l
Normal file
1
db/themes/l
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-l
|
1
db/themes/led
Normal file
1
db/themes/led
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-led
|
1
db/themes/mtahmed
Normal file
1
db/themes/mtahmed
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-mtahmed
|
1
db/themes/nai
Normal file
1
db/themes/nai
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-nai
|
1
db/themes/numist
Normal file
1
db/themes/numist
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-numist
|
1
db/themes/ocean
Normal file
1
db/themes/ocean
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-ocean
|
1
db/themes/perryh
Normal file
1
db/themes/perryh
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-perryh
|
1
db/themes/red-snapper
Normal file
1
db/themes/red-snapper
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-red-snapper
|
1
db/themes/robbyrussell
Normal file
1
db/themes/robbyrussell
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-robbyrussell
|
1
db/themes/russell
Normal file
1
db/themes/russell
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/wa/theme-russell
|
1
db/themes/scorphish
Normal file
1
db/themes/scorphish
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-scorphish
|
1
db/themes/simplevi
Normal file
1
db/themes/simplevi
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-simplevi
|
1
db/themes/syl20bnr
Normal file
1
db/themes/syl20bnr
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-syl20bnr
|
1
db/themes/taktoa
Normal file
1
db/themes/taktoa
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-taktoa
|
1
db/themes/technopagan
Normal file
1
db/themes/technopagan
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-technopagan
|
1
db/themes/toaster
Normal file
1
db/themes/toaster
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-toaster
|
1
db/themes/tomita
Normal file
1
db/themes/tomita
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/daveyarwood/tomita
|
1
db/themes/trout
Normal file
1
db/themes/trout
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-trout
|
1
db/themes/uggedal
Normal file
1
db/themes/uggedal
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-uggedal
|
1
db/themes/will
Normal file
1
db/themes/will
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-will
|
1
db/themes/yimmy
Normal file
1
db/themes/yimmy
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/oh-my-fish/theme-yimmy
|
1
db/themes/zish
Normal file
1
db/themes/zish
Normal file
|
@ -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
|
54
init.fish
Normal file
54
init.fish
Normal file
|
@ -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
|
78
lib/README.md
Normal file
78
lib/README.md
Normal file
|
@ -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.
|
19
lib/autoload.fish
Normal file
19
lib/autoload.fish
Normal file
|
@ -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
|
9
lib/available.fish
Normal file
9
lib/available.fish
Normal file
|
@ -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
|
29
lib/basename.fish
Normal file
29
lib/basename.fish
Normal file
|
@ -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
|
15
lib/git/git_ahead.fish
Normal file
15
lib/git/git_ahead.fish
Normal file
|
@ -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
|
5
lib/git/git_branch_name.fish
Normal file
5
lib/git/git_branch_name.fish
Normal file
|
@ -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
|
3
lib/git/git_is_dirty.fish
Normal file
3
lib/git/git_is_dirty.fish
Normal file
|
@ -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…
Reference in New Issue
Block a user