commit
18ef1ee648
234 changed files with 10267 additions and 1855 deletions
@ -0,0 +1,201 @@ |
||||
 |
||||
|
||||
|
||||
Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. |
||||
|
||||
__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. |
||||
|
||||
To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. |
||||
|
||||
## Getting Started |
||||
|
||||
|
||||
### Prerequisites |
||||
|
||||
__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ |
||||
|
||||
* Unix-based operating system (Mac OS X or Linux) |
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) |
||||
* `curl` or `wget` should be installed |
||||
* `git` should be installed |
||||
|
||||
### Basic Installation |
||||
|
||||
Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either `curl` or `wget`. |
||||
|
||||
#### via curl |
||||
|
||||
`sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"` |
||||
|
||||
#### via wget |
||||
|
||||
`sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"` |
||||
|
||||
## Using Oh My Zsh |
||||
|
||||
### Plugins |
||||
|
||||
Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a look in the [plugins](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins) directory and/or the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins) to see what's currently available. |
||||
|
||||
#### Enabling Plugins |
||||
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization. |
||||
|
||||
For example, this line might begin to look like... |
||||
|
||||
```shell |
||||
plugins=(git bundler osx rake ruby) |
||||
``` |
||||
|
||||
#### Using Plugins |
||||
|
||||
Most plugins (should! we're working on this) include a __README__, which documents how to use them. |
||||
|
||||
### Themes |
||||
|
||||
We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! |
||||
|
||||
#### Selecting a Theme |
||||
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._ |
||||
|
||||
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like: |
||||
|
||||
```shell |
||||
ZSH_THEME="robbyrussell" |
||||
``` |
||||
|
||||
To use a different theme, simple change the value to match the name of your desired theme. For example: |
||||
|
||||
```shell |
||||
ZSH_THEME="agnoster" # (this is one of the fancy ones) |
||||
``` |
||||
|
||||
Open up a new terminal window and your prompt should look something like... |
||||
|
||||
 |
||||
|
||||
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes). |
||||
|
||||
## Advanced Topics |
||||
|
||||
If you're the type that likes to get their hands dirty, these sections might resonate. |
||||
|
||||
### Advanced Installation |
||||
|
||||
Some users may want to change the default path, or manually install Oh My Zsh. |
||||
|
||||
#### Custom Directory |
||||
|
||||
The default location is `~/.oh-my-zsh` (hidden in your home directory) |
||||
|
||||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: |
||||
|
||||
```shell |
||||
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh |
||||
``` |
||||
|
||||
#### Manual Installation |
||||
|
||||
##### 1. Clone the repository: |
||||
|
||||
```shell |
||||
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh |
||||
``` |
||||
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file: |
||||
|
||||
```shell |
||||
cp ~/.zshrc ~/.zshrc.orig |
||||
``` |
||||
|
||||
##### 3. Create a new zsh configuration file |
||||
|
||||
You can create a new zsh config file by copying the template that we included for you. |
||||
|
||||
```shell |
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc |
||||
``` |
||||
|
||||
##### 4. Change your default shell |
||||
|
||||
```shell |
||||
chsh -s /bin/zsh |
||||
``` |
||||
|
||||
##### 5. Initialize your new zsh configuration |
||||
|
||||
Once you open up a new terminal window, it should load zsh with Oh My Zsh's configuration. |
||||
|
||||
### Installation Problems |
||||
|
||||
If you have any hiccups installing, here are a few common fixes. |
||||
|
||||
* You _might_ need to modify your `PATH` in `~/.zshrc` if you're not able to find some commands after switching to `oh-my-zsh`. |
||||
* If you installed manually or changed the install location, check the `ZSH` environment variable in `~/.zshrc`. |
||||
|
||||
### Custom Plugins and Themes |
||||
|
||||
If you want to override any of the default behaviors, just add a new file (ending in `.zsh`) in the `custom/` directory. |
||||
|
||||
If you have many functions that go well together, you can put them as a `XYZ.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin. |
||||
|
||||
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. |
||||
|
||||
## Getting Updates |
||||
|
||||
By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-zsh` to automatically upgrade itself without prompting you, set the following in your `~/.zshrc`: |
||||
|
||||
```shell |
||||
DISABLE_UPDATE_PROMPT=true |
||||
``` |
||||
|
||||
To disable automatic upgrades, set the following in your `~/.zshrc`: |
||||
|
||||
```shell |
||||
DISABLE_AUTO_UPDATE=true |
||||
``` |
||||
|
||||
### Manual Updates |
||||
|
||||
If you'd like to upgrade at any point in time (maybe someone just released a new plugin and you don't want to wait a week?) you just need to run: |
||||
|
||||
```shell |
||||
upgrade_oh_my_zsh |
||||
``` |
||||
|
||||
Magic! |
||||
|
||||
## Uninstalling Oh My Zsh |
||||
|
||||
Oh My Zsh isn't for everyone. We'll miss you, but we want to make this an easy breakup. |
||||
|
||||
If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the command-line. It will remove itself and revert your previous `bash` or `zsh` configuration. |
||||
|
||||
## Contributing |
||||
|
||||
I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! |
||||
|
||||
We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can. |
||||
|
||||
### Do NOT send us themes |
||||
|
||||
We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page. |
||||
|
||||
## Contributors |
||||
|
||||
Oh My Zsh has a vibrant community of happy users and delightful contributors. Without all the time and help from our contributors, it wouldn't be so awesome. |
||||
|
||||
Thank you so much! |
||||
|
||||
## Follow Us |
||||
|
||||
We have an [@ohmyzsh](https://twitter.com/ohmyzsh) Twitter account. You should follow it. |
||||
|
||||
## Merchandise |
||||
|
||||
We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town! |
||||
|
||||
## License |
||||
|
||||
Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). |
||||
@ -1,110 +0,0 @@ |
||||
!https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png! |
||||
|
||||
oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout... |
||||
|
||||
bq. "OH MY ZSHELL!" |
||||
|
||||
h2. Setup |
||||
|
||||
@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. |
||||
|
||||
h3. The automatic installer... (do you trust me?) |
||||
|
||||
You can install this via the command line with either `curl` or `wget`. |
||||
|
||||
h4. via `curl` |
||||
|
||||
@curl -L http://install.ohmyz.sh | sh@ |
||||
|
||||
h4. via `wget` |
||||
|
||||
@wget --no-check-certificate http://install.ohmyz.sh -O - | sh@ |
||||
|
||||
h4. Optional: change the install directory |
||||
|
||||
The default location is `~/.oh-my-zsh` (hidden in your home directory). |
||||
|
||||
You can change the install directory with the ZSH environment variable, either |
||||
by running `export ZSH=/your/path` before installing, or setting it before the |
||||
end of the install pipeline like this: |
||||
|
||||
@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh@ |
||||
|
||||
|
||||
h3. The manual way |
||||
|
||||
1. Clone the repository |
||||
|
||||
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ |
||||
|
||||
2. *OPTIONAL* Backup your existing ~/.zshrc file |
||||
|
||||
@cp ~/.zshrc ~/.zshrc.orig@ |
||||
|
||||
3. Create a new zsh config by copying the zsh template we've provided. |
||||
|
||||
@cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ |
||||
|
||||
4. Set zsh as your default shell: |
||||
|
||||
@chsh -s /bin/zsh@ |
||||
|
||||
5. Start / restart zsh (open a new terminal is easy enough...) |
||||
|
||||
h3. Problems? |
||||
|
||||
You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_. |
||||
|
||||
If you installed manually or changed the install location, check ZSH in ~/.zshrc |
||||
|
||||
h2. Usage |
||||
|
||||
* enable the plugins you want in your @~/.zshrc@ (take a look at the @plugins/@ directory and the "wiki":https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins to see what's possible) |
||||
** example: @plugins=(git osx ruby)@ |
||||
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. |
||||
** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. |
||||
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers... |
||||
|
||||
h2. Useful |
||||
|
||||
the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips. |
||||
|
||||
h3. Customization |
||||
|
||||
If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. |
||||
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. |
||||
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. |
||||
|
||||
h3. Updates |
||||
|
||||
By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc |
||||
|
||||
@DISABLE_UPDATE_PROMPT=true@ |
||||
|
||||
To disable updates entirely, put this in your ~/.zshrc |
||||
|
||||
@DISABLE_AUTO_UPDATE=true@ |
||||
|
||||
To upgrade directly from the command line, just run @upgrade_oh_my_zsh@ |
||||
|
||||
h3. Uninstalling |
||||
|
||||
If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). |
||||
|
||||
h2. Help out! |
||||
|
||||
I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! |
||||
|
||||
h3. (Don't) Send us your theme! (for now) |
||||
|
||||
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.- |
||||
|
||||
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there. |
||||
|
||||
h2. Contributors |
||||
|
||||
This project wouldn't exist without all of our awesome users and contributors. |
||||
|
||||
* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors |
||||
|
||||
Thank you so much! |
||||
@ -0,0 +1,4 @@ |
||||
This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it. |
||||
|
||||
Feel free to add love notes for people here. |
||||
|
||||
@ -1,36 +0,0 @@ |
||||
# Push and pop directories on directory stack |
||||
alias pu='pushd' |
||||
alias po='popd' |
||||
|
||||
# Basic directory operations |
||||
alias ...='cd ../..' |
||||
alias -- -='cd -' |
||||
|
||||
# Super user |
||||
alias _='sudo' |
||||
alias please='sudo' |
||||
|
||||
#alias g='grep -in' |
||||
|
||||
# Show history |
||||
if [ "$HIST_STAMPS" = "mm/dd/yyyy" ] |
||||
then |
||||
alias history='fc -fl 1' |
||||
elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ] |
||||
then |
||||
alias history='fc -El 1' |
||||
elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ] |
||||
then |
||||
alias history='fc -il 1' |
||||
else |
||||
alias history='fc -l 1' |
||||
fi |
||||
# List direcory contents |
||||
alias lsa='ls -lah' |
||||
alias l='ls -lah' |
||||
alias ll='ls -lh' |
||||
alias la='ls -lAh' |
||||
alias sl=ls # often screw this up |
||||
|
||||
alias afind='ack-grep -il' |
||||
|
||||
@ -1,13 +1,13 @@ |
||||
alias man='nocorrect man' |
||||
alias mv='nocorrect mv' |
||||
alias mysql='nocorrect mysql' |
||||
alias mkdir='nocorrect mkdir' |
||||
alias gist='nocorrect gist' |
||||
alias heroku='nocorrect heroku' |
||||
alias ebuild='nocorrect ebuild' |
||||
alias hpodder='nocorrect hpodder' |
||||
alias sudo='nocorrect sudo' |
||||
|
||||
if [[ "$ENABLE_CORRECTION" == "true" ]]; then |
||||
alias ebuild='nocorrect ebuild' |
||||
alias gist='nocorrect gist' |
||||
alias heroku='nocorrect heroku' |
||||
alias hpodder='nocorrect hpodder' |
||||
alias man='nocorrect man' |
||||
alias mkdir='nocorrect mkdir' |
||||
alias mv='nocorrect mv' |
||||
alias mysql='nocorrect mysql' |
||||
alias sudo='nocorrect sudo' |
||||
|
||||
setopt correct_all |
||||
fi |
||||
|
||||
@ -1,24 +1,28 @@ |
||||
# |
||||
# Color grep results |
||||
# Examples: http://rubyurl.com/ZXv |
||||
# |
||||
|
||||
GREP_OPTIONS="--color=auto" |
||||
|
||||
# avoid VCS folders (if the necessary grep flags are available) |
||||
# is x grep argument available? |
||||
grep-flag-available() { |
||||
echo | grep $1 "" >/dev/null 2>&1 |
||||
} |
||||
|
||||
GREP_OPTIONS="" |
||||
|
||||
# color grep results |
||||
if grep-flag-available --color=auto; then |
||||
GREP_OPTIONS+=" --color=auto" |
||||
fi |
||||
|
||||
# ignore VCS folders (if the necessary grep flags are available) |
||||
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" |
||||
|
||||
if grep-flag-available --exclude-dir=.cvs; then |
||||
for PATTERN in .cvs .git .hg .svn; do |
||||
GREP_OPTIONS+=" --exclude-dir=$PATTERN" |
||||
done |
||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" |
||||
elif grep-flag-available --exclude=.cvs; then |
||||
for PATTERN in .cvs .git .hg .svn; do |
||||
GREP_OPTIONS+=" --exclude=$PATTERN" |
||||
done |
||||
GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" |
||||
fi |
||||
unfunction grep-flag-available |
||||
|
||||
export GREP_OPTIONS="$GREP_OPTIONS" |
||||
export GREP_COLOR='1;32' |
||||
# export grep settings |
||||
alias grep="grep $GREP_OPTIONS" |
||||
|
||||
# clean up |
||||
unset GREP_OPTIONS |
||||
unset VCS_FOLDERS |
||||
unfunction grep-flag-available |
||||
|
||||
@ -1,39 +1,73 @@ |
||||
#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title |
||||
#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 |
||||
#Fully support screen, iterm, and probably most modern xterm and rxvt |
||||
#Limited support for Apple Terminal (Terminal can't set window or tab separately) |
||||
# Set terminal window and tab/icon title |
||||
# |
||||
# usage: title short_tab_title [long_window_title] |
||||
# |
||||
# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 |
||||
# Fully supports screen, iterm, and probably most modern xterm and rxvt |
||||
# (In screen, only short_tab_title is used) |
||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately) |
||||
function title { |
||||
if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then |
||||
return |
||||
fi |
||||
emulate -L zsh |
||||
setopt prompt_subst |
||||
|
||||
[[ "$EMACS" == *term* ]] && return |
||||
|
||||
# if $2 is unset use $1 as default |
||||
# if it is set and empty, leave it as is |
||||
: ${2=$1} |
||||
|
||||
if [[ "$TERM" == screen* ]]; then |
||||
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars |
||||
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
||||
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
||||
print -Pn "\e]2;$2:q\a" #set window name |
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) |
||||
print -Pn "\e]1;$1:q\a" #set icon (=tab) name |
||||
fi |
||||
} |
||||
|
||||
ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD |
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" |
||||
# Avoid duplication of directory in terminals with independent dir display |
||||
if [[ $TERM_PROGRAM == Apple_Terminal ]]; then |
||||
ZSH_THEME_TERM_TITLE_IDLE="%n@%m" |
||||
fi |
||||
|
||||
#Appears when you have the prompt |
||||
# Runs before showing the prompt |
||||
function omz_termsupport_precmd { |
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then |
||||
return |
||||
fi |
||||
|
||||
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE |
||||
} |
||||
|
||||
#Appears at the beginning of (and during) of command execution |
||||
# Runs before executing the command |
||||
function omz_termsupport_preexec { |
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then |
||||
return |
||||
fi |
||||
|
||||
emulate -L zsh |
||||
setopt extended_glob |
||||
|
||||
# cmd name only, or if this is sudo or ssh, the next cmd |
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]:gs/%/%%} |
||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} |
||||
local LINE="${2:gs/%/%%}" |
||||
|
||||
title '$CMD' '%100>...>$LINE%<<' |
||||
} |
||||
|
||||
autoload -U add-zsh-hook |
||||
add-zsh-hook precmd omz_termsupport_precmd |
||||
add-zsh-hook preexec omz_termsupport_preexec |
||||
precmd_functions+=(omz_termsupport_precmd) |
||||
preexec_functions+=(omz_termsupport_preexec) |
||||
|
||||
|
||||
# Runs before showing the prompt, to update the current directory in Terminal.app |
||||
function omz_termsupport_cwd { |
||||
# Notify Terminal.app of current directory using undocumented OSC sequence |
||||
# found in OS X 10.9 and 10.10's /etc/bashrc |
||||
if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then |
||||
local PWD_URL="file://$HOSTNAME${PWD// /%20}" |
||||
printf '\e]7;%s\a' "$PWD_URL" |
||||
fi |
||||
} |
||||
|
||||
precmd_functions+=(omz_termsupport_cwd) |
||||
|
||||
@ -0,0 +1,8 @@ |
||||
# adb autocomplete plugin |
||||
|
||||
* Adds autocomplete options for all adb commands. |
||||
|
||||
|
||||
## Requirements |
||||
|
||||
In order to make this work, you will need to have the Android adb tools set up in your path. |
||||
@ -0,0 +1,48 @@ |
||||
#compdef adb |
||||
#autoload |
||||
|
||||
# in order to make this work, you will need to have the android adb tools |
||||
|
||||
# adb zsh completion, based on homebrew completion |
||||
|
||||
local -a _1st_arguments |
||||
_1st_arguments=( |
||||
'bugreport:return all information from the device that should be included in a bug report.' |
||||
'connect:connect to a device via TCP/IP Port 5555 is default.' |
||||
'devices:list all connected devices' |
||||
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.' |
||||
'emu:run emulator console command' |
||||
'forward:forward socket connections' |
||||
'help:show the help message' |
||||
'install:push this package file to the device and install it' |
||||
'jdwp:list PIDs of processes hosting a JDWP transport' |
||||
'kill-server:kill the server if it is running' |
||||
'logcat:view device log' |
||||
'pull:copy file/dir from device' |
||||
'push:copy file/dir to device' |
||||
'reboot:reboots the device, optionally into the bootloader or recovery program' |
||||
'reboot-bootloader:reboots the device into the bootloader' |
||||
'remount:remounts the partitions on the device read-write' |
||||
'root:restarts the adbd daemon with root permissions' |
||||
'sideload:push a ZIP to device and install it' |
||||
'shell:run remote shell interactively' |
||||
'sync:copy host->device only if changed (-l means list but dont copy)' |
||||
'start-server:ensure that there is a server running' |
||||
'tcpip:restart host adb in tcpip mode' |
||||
'uninstall:remove this app package from the device' |
||||
'version:show version num' |
||||
'wait-for-device:block until device is online' |
||||
) |
||||
|
||||
local expl |
||||
local -a pkgs installed_pkgs |
||||
|
||||
_arguments \ |
||||
'*:: :->subcmds' && return 0 |
||||
|
||||
if (( CURRENT == 1 )); then |
||||
_describe -t commands "adb subcommand" _1st_arguments |
||||
return |
||||
fi |
||||
|
||||
_files |
||||
@ -0,0 +1,19 @@ |
||||
## APACHE2 MACPORTS PLUGIN |
||||
|
||||
|
||||
--- |
||||
|
||||
### FEATURES |
||||
|
||||
| Alias | Function | Description | |
||||
|:--------------:|:-------------------------------------------------------------------------------|----------------------:| |
||||
| apache2restart | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart | Restart apache daemon | |
||||
| apache2start | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start | Start apache daemon | |
||||
| apache2stop | sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop | Stop apache daemon | |
||||
|
||||
--- |
||||
|
||||
### CONTRIBUTORS |
||||
- Alexander Rinass (alex@rinass.net) |
||||
|
||||
--- |
||||
@ -0,0 +1,64 @@ |
||||
## ARCHLINUX PLUGIN |
||||
|
||||
|
||||
--- |
||||
|
||||
### FEATURES |
||||
|
||||
| Alias | Function | Description | |
||||
|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------| |
||||
| pacin | sudo pacman -S | Install specific package(s) from the repositories | |
||||
| pacins | sudo pacman -U | Install specific package not from the repositories but from a file | |
||||
| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package | |
||||
| pacloc | pacman -Qi | Display information about a given package in the local database | |
||||
| paclocs | pacman -Qs | Search for package(s) in the local database | |
||||
| paclsorphans | sudo pacman -Qdt' | List all orphaned packages | |
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist | |
||||
| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies | |
||||
| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies | |
||||
| pacrep | pacman -Si | Display information about a given package in the repositories | |
||||
| pacreps | pacman -Ss | Search for package(s) in the repositories | |
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages | |
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories | |
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories | |
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories | |
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories | |
||||
| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. | |
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff | |
||||
| yain | yaourt -S | Install specific package(s) from the repositories | |
||||
| yains | yaourt -U | Install specific package not from the repositories but from a file | |
||||
| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package | |
||||
| yaloc | yaourt -Qi | Display information about a given package in the local database | |
||||
| yalocs | yaourt -Qs | Search for package(s) in the local database | |
||||
| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") | |
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist | |
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt | |
||||
| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies | |
||||
| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies | |
||||
| yarep | yaourt -Si | Display information about a given package in the repositories | |
||||
| yareps | yaourt -Ss | Search for package(s) in the repositories | |
||||
| yasu | yaourt --sucre | Same as yaupg, but without confirmation | |
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories | |
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories | |
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories | |
||||
| yaupd | yaourt -Sy | Update and refresh the local package database against repositories | |
||||
| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system | |
||||
|
||||
| Function | Description | |
||||
|----------------|:------------------------------------------------------------------------------------------------------------------| |
||||
| pacdisowned | List all disowned files in your system | |
||||
| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) | |
||||
| pacmanallkeys | Get all keys for developers and trusted users | |
||||
| pacmansignkeys | | |
||||
|
||||
--- |
||||
|
||||
### CONTRIBUTORS |
||||
- Benjamin Boudreau - dreurmail@gmail.com |
||||
- Celso Miranda - contacto@celsomiranda.net |
||||
- KhasMek - Boushh@gmail.com |
||||
- Martin Putniorz - mputniorz@gmail.com |
||||
- MatthR3D - matthr3d@gmail.com |
||||
- ornicar - thibault.duplessis@gmail.com |
||||
|
||||
--- |
||||
@ -0,0 +1,17 @@ |
||||
## atom |
||||
|
||||
Plugin for Atom, a cross platform text and code editor, available for Linux, Mac OS X, and Windows. |
||||
|
||||
### Requirements |
||||
|
||||
* [Atom](https://atom.io/) |
||||
|
||||
### Usage |
||||
|
||||
* If `at` command is called without an argument, launch Atom |
||||
|
||||
* If `at` is passed a directory, `cd` to it and open it in Atom |
||||
|
||||
* If `at` is passed a file, open it in Atom |
||||
|
||||
* if `att` command is called, it is equivalent to `at .`, opening the current folder in Atom |
||||
@ -1,17 +1,32 @@ |
||||
_homebrew-installed() { |
||||
type brew &> /dev/null |
||||
} |
||||
|
||||
_awscli-homebrew-installed() { |
||||
brew list awscli &> /dev/null |
||||
} |
||||
|
||||
export AWS_HOME=~/.aws |
||||
|
||||
function agp { |
||||
echo $AWS_DEFAULT_PROFILE |
||||
|
||||
} |
||||
function asp { |
||||
export AWS_DEFAULT_PROFILE=$1 |
||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>" |
||||
|
||||
export AWS_PROFILE=$1 |
||||
export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$RPROMPT" |
||||
} |
||||
function aws_profiles { |
||||
reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) |
||||
} |
||||
|
||||
compctl -K aws_profiles asp |
||||
source `which aws_zsh_completer.sh` |
||||
|
||||
if _homebrew-installed && _awscli-homebrew-installed ; then |
||||
_aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh |
||||
else |
||||
_aws_zsh_completer_path=$(which aws_zsh_completer.sh) |
||||
fi |
||||
|
||||
[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path |
||||
unset _aws_zsh_completer_path |
||||
|
||||
@ -0,0 +1,20 @@ |
||||
## bbedit |
||||
|
||||
Plugin for BBEdit, an HTML and text editor for Mac OS X |
||||
|
||||
### Requirements |
||||
|
||||
* [BBEdit](http://www.barebones.com/products/bbedit/) |
||||
* [BBEdit Command-Line Tools](http://www.barebones.com/support/bbedit/cmd-line-tools.html) |
||||
|
||||
### Usage |
||||
|
||||
* If the `bb` command is called without an argument, launch BBEdit |
||||
|
||||
* If `bb` is passed a directory, cd to it and open it in BBEdit |
||||
|
||||
* If `bb` is passed a file, open it in BBEdit |
||||
|
||||
* If `bbpb` create a new BBEdit document with the contents of the clipboard |
||||
|
||||
* If `bbd` alias for BBEdit diff tool |
||||
@ -0,0 +1,21 @@ |
||||
alias bbpb='pbpaste | bbedit --clean --view-top' |
||||
|
||||
alias bbd=bbdiff |
||||
|
||||
# |
||||
# If the bb command is called without an argument, launch BBEdit |
||||
# If bb is passed a directory, cd to it and open it in BBEdit |
||||
# If bb is passed a file, open it in BBEdit |
||||
# |
||||
function bb() { |
||||
if [[ -z "$1" ]] |
||||
then |
||||
bbedit --launch |
||||
else |
||||
bbedit "$1" |
||||
if [[ -d "$1" ]] |
||||
then |
||||
cd "$1" |
||||
fi |
||||
fi |
||||
} |
||||
@ -0,0 +1,54 @@ |
||||
# bgnotify zsh plugin |
||||
|
||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux. |
||||
|
||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify) |
||||
|
||||
---------------------------------- |
||||
|
||||
## How to use! |
||||
|
||||
Just add bgnotify to your plugins list in your `.zshrc` |
||||
|
||||
- On OS X you'll need [terminal-notifer](https://github.com/alloy/terminal-notifier) |
||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`) |
||||
- On ubuntu you're already all set! |
||||
- On windows you can use [notifu](http://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package |
||||
|
||||
|
||||
## Screenshots |
||||
|
||||
**Linux** |
||||
|
||||
 |
||||
|
||||
**OS X** |
||||
|
||||
 |
||||
|
||||
**Windows** |
||||
|
||||
 |
||||
|
||||
|
||||
## Configuration |
||||
|
||||
One can configure a few things: |
||||
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds) |
||||
- `function bgnotify_formatted` lets you change the notification |
||||
|
||||
Use these by adding a function definition before the your call to source. Example: |
||||
|
||||
~~~ sh |
||||
bgnotify_threshold=4 ## set your own notification threshold |
||||
|
||||
function bgnotify_formatted { |
||||
## $1=exit_status, $2=command, $3=elapsed_time |
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!" |
||||
bgnotify "$title -- after $3 s" "$2"; |
||||
} |
||||
|
||||
plugins=(git bgnotify) ## add to plugins list |
||||
source $ZSH/oh-my-zsh.sh ## existing source call |
||||
~~~ |
||||
@ -0,0 +1,67 @@ |
||||
#!/usr/bin/env zsh |
||||
|
||||
## setup ## |
||||
|
||||
[[ -o interactive ]] || return #interactive only! |
||||
zmodload zsh/datetime || { print "can't load zsh/datetime"; return } # faster than date() |
||||
autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return } |
||||
|
||||
(( ${+bgnotify_threshold} )) || bgnotify_threshold=5 #default 10 seconds |
||||
|
||||
|
||||
## definitions ## |
||||
|
||||
if ! (type bgnotify_formatted | grep -q 'function'); then |
||||
function bgnotify_formatted { |
||||
## exit_status, command, elapsed_time |
||||
[ $1 -eq 0 ] && title="#win (took $3 s)" || title="#fail (took $3 s)" |
||||
bgnotify "$title" "$2" |
||||
} |
||||
fi |
||||
|
||||
currentWindowId () { |
||||
if hash osascript 2>/dev/null; then #osx |
||||
osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0" |
||||
elif hash notify-send 2>/dev/null; then #ubuntu! |
||||
xprop -root | awk '/NET_ACTIVE_WINDOW/ { print $5; exit }' |
||||
else |
||||
echo $EPOCHSECONDS #fallback for windows |
||||
fi |
||||
} |
||||
|
||||
bgnotify () { |
||||
if hash terminal-notifier 2>/dev/null; then #osx |
||||
terminal-notifier -message "$2" -title "$1" |
||||
elif hash growlnotify 2>/dev/null; then #osx growl |
||||
growlnotify -m "$1" "$2" |
||||
elif hash notify-send 2>/dev/null; then #ubuntu! |
||||
notify-send "$1" "$2" |
||||
elif hash notifu 2>/dev/null; then #cygwyn support! |
||||
notifu /m "$2" /p "$1" |
||||
fi |
||||
} |
||||
|
||||
|
||||
## Zsh hooks ## |
||||
|
||||
bgnotify_begin() { |
||||
bgnotify_timestamp=$EPOCHSECONDS |
||||
bgnotify_lastcmd=$1 |
||||
bgnotify_windowid=$(currentWindowId) |
||||
} |
||||
|
||||
bgnotify_end() { |
||||
didexit=$? |
||||
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp )) |
||||
past_threshold=$(( elapsed >= bgnotify_threshold )) |
||||
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then |
||||
if [ $(currentWindowId) != "$bgnotify_windowid" ]; then |
||||
print -n "\a" |
||||
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed" |
||||
fi |
||||
fi |
||||
bgnotify_timestamp=0 #reset it to 0! |
||||
} |
||||
|
||||
add-zsh-hook preexec bgnotify_begin |
||||
add-zsh-hook precmd bgnotify_end |
||||
@ -0,0 +1,6 @@ |
||||
## Boot2docker autocomplete plugin |
||||
|
||||
- Adds autocomplete options for all boot2docker commands. |
||||
|
||||
|
||||
Maintainer : Manfred Touron ([@moul](https://github.com/moul)) |
||||
@ -0,0 +1,73 @@ |
||||
#compdef boot2docker |
||||
|
||||
# Boot2docker autocompletion for oh-my-zsh |
||||
# Requires: Boot2docker installed |
||||
# Author: Manfred Touron (@moul) |
||||
|
||||
local -a _1st_arguments |
||||
_1st_arguments=( |
||||
"init":"Create a new Boot2Docker VM." |
||||
"up":"Start VM from any states." |
||||
"start":"Start VM from any states." |
||||
"boot":"Start VM from any states." |
||||
"ssh":"[ssh-command] Login to VM via SSH." |
||||
"save":"Suspend VM and save state to disk." |
||||
"suspend":"Suspend VM and save state to disk." |
||||
"down":"Gracefully shutdown the VM." |
||||
"stop":"Gracefully shutdown the VM." |
||||
"halt":"Gracefully shutdown the VM." |
||||
"restart":"Gracefully reboot the VM." |
||||
"poweroff":"Forcefully power off the VM (may corrupt disk image)." |
||||
"reset":"Forcefully power cycle the VM (may corrupt disk image)." |
||||
"delete":"Delete Boot2Docker VM and its disk image." |
||||
"destroy":"Delete Boot2Docker VM and its disk image." |
||||
"config":"Show selected profile file settings." |
||||
"cfg":"Show selected profile file settings." |
||||
"info":"Display detailed information of VM." |
||||
"ip":"Display the IP address of the VM's Host-only network." |
||||
"socket":"Display the DOCKER_HOST socket to connect to." |
||||
"shellinit":"Display the shell command to set up the Docker client." |
||||
"status":"Display current state of VM." |
||||
"download":"Download Boot2Docker ISO image." |
||||
"upgrade":"Upgrade the Boot2Docker ISO image (restart if running)." |
||||
"version":"Display version information." |
||||
) |
||||
|
||||
_arguments \ |
||||
'(--basevmdk)--basevmdk[Path to VMDK to use as base for persistent partition]' \ |
||||
'(--cpus)'{-c,--cpus}'[number of CPUs for boot2docker.]' \ |
||||
'(--clobber)--clobber[overwrite Docker client binary on boot2docker upgrade]' \ |
||||
'(--dhcp)--dhcp[enable VirtualBox host-only network DHCP.]' \ |
||||
'(--dhcpip)--dhcpip[VirtualBox host-only network DHCP server address.]' \ |
||||
'(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB).]' \ |
||||
'(--dockerport)--dockerport[host Docker port (forward to port 2376 in VM). (deprecated - use with care)]' \ |
||||
'(--driver)--driver[hypervisor driver.]' \ |
||||
'(--force-upgrade-download)--force-upgrade-download[always download on boot2docker upgrade, never skip.]' \ |
||||
'(--hostip)--hostip[VirtualBox host-only network IP address.]' \ |
||||
'(--iso)--iso[path to boot2docker ISO image.]' \ |
||||
'(--iso-url)--iso-url[/api.github.com/repos/boot2docker/boot2docker/releases": source URL to provision the boot2docker ISO image.]' \ |
||||
'(--lowerip)--lowerip[VirtualBox host-only network DHCP lower bound.]' \ |
||||
'(--memory)'{-m,--memory}'[virtual machine memory size (in MB).]' \ |
||||
'(--netmask)--netmask[VirtualBox host-only network mask.]' \ |
||||
'(--no-dummy)--no-dummy[Example parameter for the dummy driver.]' \ |
||||
'(--retries)--retries[number of port knocking retries during 'start']' \ |
||||
'(--serial)--serial[try serial console to get IP address (experimental)]' \ |
||||
'(--serialfile)--serialfile[path to the serial socket/pipe.]' \ |
||||
'(--ssh)--ssh[path to SSH client utility.]' \ |
||||
'(--ssh-keygen)--ssh-keygen[path to ssh-keygen utility.]' \ |
||||
'(--sshkey)--sshkey[path to SSH key to use.]' \ |
||||
'(--sshport)--sshport[host SSH port (forward to port 22 in VM).]' \ |
||||
'(--upperip)--upperip[VirtualBox host-only network DHCP upper bound.]' \ |
||||
'(--vbm)--vbm[path to VirtualBox management utility.]' \ |
||||
'(--vbox-share)--vbox-share[(defaults to "/Users=Users" if no shares are specified; use "disable" to explicitly prevent any shares from being created) List of directories to share during "up|start|boot" via VirtualBox Guest Additions, with optional labels]' \ |
||||
'(--verbose)'{-v,--verbose}'[display verbose command invocations.]' \ |
||||
'(--vm)--vm[virtual machine name.]' \ |
||||
'(--waittime)--waittime[Time in milliseconds to wait between port knocking retries during 'start']' \ |
||||
'*:: :->subcmds' && return 0 |
||||
|
||||
#_arguments '*:: :->command' |
||||
|
||||
if (( CURRENT == 1 )); then |
||||
_describe -t commands "boot2docker command" _1st_arguments |
||||
return |
||||
fi |
||||
@ -1 +1,4 @@ |
||||
alias brews='brew list -1' |
||||
alias bubo='brew update && brew outdated' |
||||
alias bubc='brew upgrade && brew cleanup' |
||||
alias bubu='bubo && bubc' |
||||
|
||||
@ -0,0 +1,49 @@ |
||||
# Bundler |
||||
|
||||
- adds completion for basic bundler commands |
||||
- adds short aliases for common bundler commands |
||||
- `be` aliased to `bundle exec` |
||||
- `bl` aliased to `bundle list` |
||||
- `bp` aliased to `bundle package` |
||||
- `bo` aliased to `bundle open` |
||||
- `bu` aliased to `bundle update` |
||||
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`) |
||||
- adds a wrapper for common gems: |
||||
- looks for a binstub under `./bin/` and executes it (if present) |
||||
- calls `bundle exec <gem executable>` otherwise |
||||
|
||||
For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file. |
||||
|
||||
## Configuration |
||||
|
||||
Please use the exact name of the executable and not the gem name. |
||||
|
||||
### Add additional gems to be wrapped |
||||
|
||||
Add this before the plugin-list in your `.zshrc`: |
||||
```sh |
||||
BUNDLED_COMMANDS=(rubocop) |
||||
plugins=(... bundler ...) |
||||
``` |
||||
This will add the wrapper for the `rubocop` gem (i.e. the executable). |
||||
|
||||
|
||||
### Exclude gems from being wrapped |
||||
|
||||
Add this before the plugin-list in your `.zshrc`: |
||||
```sh |
||||
UNBUNDLED_COMMANDS=(foreman spin) |
||||
plugins=(... bundler ...) |
||||
``` |
||||
This will exclude the `foreman` and `spin` gems (i.e. their executable) from being wrapped. |
||||
|
||||
## Excluded gems |
||||
|
||||
These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/robbyrussell/oh-my-zsh/pull/2923) on GitHub for clarification. |
||||
|
||||
`berks` |
||||
`foreman` |
||||
`mailcatcher` |
||||
`rails` |
||||
`ruby` |
||||
`spin` |
||||
@ -0,0 +1,19 @@ |
||||
# CakePHP 3 basic command completion |
||||
_cakephp3_get_command_list () { |
||||
cakephp3commands=($(bin/cake completion commands));printf "%s\n" "${cakephp3commands[@]}" |
||||
} |
||||
|
||||
_cakephp3 () { |
||||
if [ -f bin/cake ]; then |
||||
compadd `_cakephp3_get_command_list` |
||||
fi |
||||
} |
||||
|
||||
compdef _cakephp3 bin/cake |
||||
compdef _cakephp3 cake |
||||
|
||||
#Alias |
||||
alias c3='bin/cake' |
||||
|
||||
alias c3cache='bin/cake orm_cache clear' |
||||
alias c3migrate='bin/cake migrations migrate' |
||||
@ -0,0 +1,5 @@ |
||||
if which cask &> /dev/null; then |
||||
source $(dirname $(which cask))/../etc/cask_completion.zsh |
||||
else |
||||
print "zsh cask plugin: cask not found" |
||||
fi |
||||
@ -0,0 +1 @@ |
||||
fortunes/chucknorris.dat |
||||
@ -0,0 +1,2 @@ |
||||
License: GPL v2 |
||||
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file. |
||||
@ -0,0 +1,6 @@ |
||||
if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then |
||||
strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat |
||||
fi |
||||
|
||||
alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes" |
||||
alias chuck_cow="chuck | cowthink" |
||||
@ -0,0 +1,31 @@ |
||||
## Coffeescript Plugin |
||||
|
||||
This plugin provides aliases for quickly compiling and previewing your |
||||
cofeescript code. |
||||
|
||||
When writing Coffeescript it's very common to want to preview the output of a |
||||
certain snippet of code, either because you want to test the output or because |
||||
you'd like to execute it in a browser console which doesn't accept Coffeescript. |
||||
|
||||
Preview the compiled result of your coffeescript with `cf "code"` as per the |
||||
following: |
||||
|
||||
```zsh |
||||
$ cf 'if a then be else c' |
||||
if (a) { |
||||
b; |
||||
} else { |
||||
c; |
||||
} |
||||
``` |
||||
|
||||
Also provides the following aliases: |
||||
|
||||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want |
||||
to run the code in a JS console. |
||||
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want |
||||
to compile large/multi-line snippets |
||||
|
||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the |
||||
the result back to clipboard. |
||||
@ -0,0 +1,16 @@ |
||||
#!/bin/zsh |
||||
|
||||
# compile a string of coffeescript and print to output |
||||
cf () { |
||||
coffee -peb $1 |
||||
} |
||||
# compile & copy to clipboard |
||||
cfc () { |
||||
cf $1 | pbcopy |
||||
} |
||||
|
||||
# compile from pasteboard & print |
||||
alias cfp='coffeeMe "$(pbpaste)"' |
||||
|
||||
# compile from pasteboard and copy to clipboard |
||||
alias cfpc='cfp | pbcopy' |
||||
@ -1,10 +1,37 @@ |
||||
## |
||||
# dircycle plugin: enables cycling through the directory |
||||
# stack using Ctrl+Shift+Left/Right |
||||
# enables cycling through the directory stack using |
||||
# Ctrl+Shift+Left/Right |
||||
# |
||||
# left/right direction follows the order in which directories |
||||
# were visited, like left/right arrows do in a browser |
||||
|
||||
eval "insert-cycledleft () { zle push-line; LBUFFER='pushd -q +1'; zle accept-line }" |
||||
# NO_PUSHD_MINUS syntax: |
||||
# pushd +N: start counting from left of `dirs' output |
||||
# pushd -N: start counting from right of `dirs' output |
||||
|
||||
insert-cycledleft () { |
||||
emulate -L zsh |
||||
setopt nopushdminus |
||||
|
||||
builtin pushd -q +1 &>/dev/null || true |
||||
zle reset-prompt |
||||
} |
||||
zle -N insert-cycledleft |
||||
bindkey "\e[1;6D" insert-cycledleft |
||||
eval "insert-cycledright () { zle push-line; LBUFFER='pushd -q -0'; zle accept-line }" |
||||
|
||||
insert-cycledright () { |
||||
emulate -L zsh |
||||
setopt nopushdminus |
||||
|
||||
builtin pushd -q -0 &>/dev/null || true |
||||
zle reset-prompt |
||||
} |
||||
zle -N insert-cycledright |
||||
bindkey "\e[1;6C" insert-cycledright |
||||
|
||||
|
||||
# add key bindings for iTerm2 |
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then |
||||
bindkey "^[[1;6D" insert-cycledleft |
||||
bindkey "^[[1;6C" insert-cycledright |
||||
else |
||||
bindkey "\e[1;6D" insert-cycledleft |
||||
bindkey "\e[1;6C" insert-cycledright |
||||
fi |
||||
@ -0,0 +1,5 @@ |
||||
# Docker-compose plugin for oh my zsh |
||||
|
||||
A copy of the completion script from the [docker-compose](1) git repo. |
||||
|
||||
[1]:[https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose] |
||||
@ -0,0 +1,308 @@ |
||||
#compdef docker-compose |
||||
|
||||
# Description |
||||
# ----------- |
||||
# zsh completion for docker-compose |
||||
# https://github.com/sdurrheimer/docker-compose-zsh-completion |
||||
# ------------------------------------------------------------------------- |
||||
# Version |
||||
# ------- |
||||
# 0.1.0 |
||||
# ------------------------------------------------------------------------- |
||||
# Authors |
||||
# ------- |
||||
# * Steve Durrheimer <s.durrheimer@gmail.com> |
||||
# ------------------------------------------------------------------------- |
||||
# Inspiration |
||||
# ----------- |
||||
# * @albers docker-compose bash completion script |
||||
# * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion |
||||
# ------------------------------------------------------------------------- |
||||
|
||||
# For compatibility reasons, Compose and therefore its completion supports several |
||||
# stack compositon files as listed here, in descending priority. |
||||
# Support for these filenames might be dropped in some future version. |
||||
__docker-compose_compose_file() { |
||||
local file |
||||
for file in docker-compose.y{,a}ml fig.y{,a}ml ; do |
||||
[ -e $file ] && { |
||||
echo $file |
||||
return |
||||
} |
||||
done |
||||
echo docker-compose.yml |
||||
} |
||||
|
||||
# Extracts all service names from docker-compose.yml. |
||||
___docker-compose_all_services_in_compose_file() { |
||||
local already_selected |
||||
local -a services |
||||
already_selected=$(echo ${words[@]} | tr " " "|") |
||||
awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | grep -Ev "$already_selected" |
||||
} |
||||
|
||||
# All services, even those without an existing container |
||||
__docker-compose_services_all() { |
||||
services=$(___docker-compose_all_services_in_compose_file) |
||||
_alternative "args:services:($services)" |
||||
} |
||||
|
||||
# All services that have an entry with the given key in their docker-compose.yml section |
||||
___docker-compose_services_with_key() { |
||||
local already_selected |
||||
local -a buildable |
||||
already_selected=$(echo ${words[@]} | tr " " "|") |
||||
# flatten sections to one line, then filter lines containing the key and return section name. |
||||
awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' 2>/dev/null | grep -Ev "$already_selected" |
||||
} |
||||
|
||||
# All services that are defined by a Dockerfile reference |
||||
__docker-compose_services_from_build() { |
||||
buildable=$(___docker-compose_services_with_key build) |
||||
_alternative "args:buildable services:($buildable)" |
||||
} |
||||
|
||||
# All services that are defined by an image |
||||
__docker-compose_services_from_image() { |
||||
pullable=$(___docker-compose_services_with_key image) |
||||
_alternative "args:pullable services:($pullable)" |
||||
} |
||||
|
||||
__docker-compose_get_services() { |
||||
local kind expl |
||||
declare -a running stopped lines args services |
||||
|
||||
docker_status=$(docker ps > /dev/null 2>&1) |
||||
if [ $? -ne 0 ]; then |
||||
_message "Error! Docker is not running." |
||||
return 1 |
||||
fi |
||||
|
||||
kind=$1 |
||||
shift |
||||
[[ $kind = (stopped|all) ]] && args=($args -a) |
||||
|
||||
lines=(${(f)"$(_call_program commands docker ps ${args})"}) |
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"}) |
||||
|
||||
# Parse header line to find columns |
||||
local i=1 j=1 k header=${lines[1]} |
||||
declare -A begin end |
||||
while (( $j < ${#header} - 1 )) { |
||||
i=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 1)) |
||||
j=$(( $i + ${${header[$i,-1]}[(i) ]} - 1)) |
||||
k=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 2)) |
||||
begin[${header[$i,$(($j-1))]}]=$i |
||||
end[${header[$i,$(($j-1))]}]=$k |
||||
} |
||||
lines=(${lines[2,-1]}) |
||||
|
||||
# Container ID |
||||
local line s name |
||||
local -a names |
||||
for line in $lines; do |
||||
if [[ $services == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then |
||||
names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}}) |
||||
for name in $names; do |
||||
s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" |
||||
s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}" |
||||
s="$s, ${${${line[$begin[IMAGE],$end[IMAGE]]}/:/\\:}%% ##}" |
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then |
||||
stopped=($stopped $s) |
||||
else |
||||
running=($running $s) |
||||
fi |
||||
done |
||||
fi |
||||
done |
||||
|
||||
[[ $kind = (running|all) ]] && _describe -t services-running "running services" running |
||||
[[ $kind = (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped |
||||
} |
||||
|
||||
__docker-compose_stoppedservices() { |
||||
__docker-compose_get_services stopped "$@" |
||||
} |
||||
|
||||
__docker-compose_runningservices() { |
||||
__docker-compose_get_services running "$@" |
||||
} |
||||
|
||||
__docker-compose_services () { |
||||
__docker-compose_get_services all "$@" |
||||
} |
||||
|
||||
__docker-compose_caching_policy() { |
||||
oldp=( "$1"(Nmh+1) ) # 1 hour |
||||
(( $#oldp )) |
||||
} |
||||
|
||||
__docker-compose_commands () { |
||||
local cache_policy |
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy |
||||
if [[ -z "$cache_policy" ]]; then |
||||
zstyle ":completion:${curcontext}:" cache-policy __docker-compose_caching_policy |
||||
fi |
||||
|
||||
if ( [[ ${+_docker_compose_subcommands} -eq 0 ]] || _cache_invalid docker_compose_subcommands) \ |
||||
&& ! _retrieve_cache docker_compose_subcommands; |
||||
then |
||||
local -a lines |
||||
lines=(${(f)"$(_call_program commands docker-compose 2>&1)"}) |
||||
_docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) |
||||
_store_cache docker_compose_subcommands _docker_compose_subcommands |
||||
fi |
||||
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands |
||||
} |
||||
|
||||
__docker-compose_subcommand () { |
||||
local -a _command_args |
||||
integer ret=1 |
||||
case "$words[1]" in |
||||
(build) |
||||
_arguments \ |
||||
'--no-cache[Do not use cache when building the image]' \ |
||||
'*:services:__docker-compose_services_from_build' && ret=0 |
||||
;; |
||||
(help) |
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0 |
||||
;; |
||||
(kill) |
||||
_arguments \ |
||||
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \ |
||||
'*:running services:__docker-compose_runningservices' && ret=0 |
||||
;; |
||||
(logs) |
||||
_arguments \ |
||||
'--no-color[Produce monochrome output.]' \ |
||||
'*:services:__docker-compose_services_all' && ret=0 |
||||
;; |
||||
(migrate-to-labels) |
||||
_arguments \ |
||||
'(-):Recreate containers to add labels' && ret=0 |
||||
;; |
||||
(port) |
||||
_arguments \ |
||||
'--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \ |
||||
'--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \ |
||||
'1:running services:__docker-compose_runningservices' \ |
||||
'2:port:_ports' && ret=0 |
||||
;; |
||||
(ps) |
||||
_arguments \ |
||||
'-q[Only display IDs]' \ |
||||
'*:services:__docker-compose_services_all' && ret=0 |
||||
;; |
||||
(pull) |
||||
_arguments \ |
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ |
||||
'*:services:__docker-compose_services_from_image' && ret=0 |
||||
;; |
||||
(rm) |
||||
_arguments \ |
||||
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \ |
||||
'-v[Remove volumes associated with containers]' \ |
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0 |
||||
;; |
||||
(run) |
||||
_arguments \ |
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ |
||||
'-d[Detached mode: Run container in the background, print new container name.]' \ |
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ |
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ |
||||
'(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \ |
||||
"--no-deps[Don't start linked services.]" \ |
||||
'--rm[Remove container after run. Ignored in detached mode.]' \ |
||||
"--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ |
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ |
||||
'(-):services:__docker-compose_services' \ |
||||
'(-):command: _command_names -e' \ |
||||
'*::arguments: _normal' && ret=0 |
||||
;; |
||||
(scale) |
||||
_arguments '*:running services:__docker-compose_runningservices' && ret=0 |
||||
;; |
||||
(start) |
||||
_arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0 |
||||
;; |
||||
(stop|restart) |
||||
_arguments \ |
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \ |
||||
'*:running services:__docker-compose_runningservices' && ret=0 |
||||
;; |
||||
(up) |
||||
_arguments \ |
||||
'--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ |
||||
'-d[Detached mode: Run containers in the background, print new container names.]' \ |
||||
'--no-color[Produce monochrome output.]' \ |
||||
"--no-deps[Don't start linked services.]" \ |
||||
"--no-recreate[If containers already exist, don't recreate them.]" \ |
||||
"--no-build[Don't build an image, even if it's missing]" \ |
||||
'(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \ |
||||
"--x-smart-recreate[Only recreate containers whose configuration or image needs to be updated. (EXPERIMENTAL)]" \ |
||||
'*:services:__docker-compose_services_all' && ret=0 |
||||
;; |
||||
(version) |
||||
_arguments \ |
||||
"--short[Shows only Compose's version number.]" && ret=0 |
||||
;; |
||||
(*) |
||||
_message 'Unknown sub command' |
||||
esac |
||||
|
||||
return ret |
||||
} |
||||
|
||||
_docker-compose () { |
||||
# Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. |
||||
# Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. |
||||
if [[ $service != docker-compose ]]; then |
||||
_call_function - _$service |
||||
return |
||||
fi |
||||
|
||||
local curcontext="$curcontext" state line ret=1 |
||||
typeset -A opt_args |
||||
|
||||
_arguments -C \ |
||||
'(- :)'{-h,--help}'[Get help]' \ |
||||
'--verbose[Show more output]' \ |
||||
'(- :)'{-v,--version}'[Print version and exit]' \ |
||||
'(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \ |
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ |
||||
'(-): :->command' \ |
||||
'(-)*:: :->option-or-argument' && ret=0 |
||||
|
||||
local counter=1 |
||||
#local compose_file compose_project |
||||
while [ $counter -lt ${#words[@]} ]; do |
||||
case "${words[$counter]}" in |
||||
-f|--file) |
||||
(( counter++ )) |
||||
compose_file="${words[$counter]}" |
||||
;; |
||||
-p|--project-name) |
||||
(( counter++ )) |
||||
compose_project="${words[$counter]}" |
||||
;; |
||||
*) |
||||
;; |
||||
esac |
||||
(( counter++ )) |
||||
done |
||||
|
||||
case $state in |
||||
(command) |
||||
__docker-compose_commands && ret=0 |
||||
;; |
||||
(option-or-argument) |
||||
curcontext=${curcontext%:*:*}:docker-compose-$words[1]: |
||||
__docker-compose_subcommand && ret=0 |
||||
;; |
||||
esac |
||||
|
||||
return ret |
||||
} |
||||
|
||||
_docker-compose "$@" |
||||
@ -0,0 +1,22 @@ |
||||
# Ember-cli |
||||
|
||||
**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani) |
||||
|
||||
Ember-cli (http://www.ember-cli.com/) |
||||
|
||||
### List of Aliases |
||||
|
||||
alias es='ember serve' |
||||
alias ea='ember addon' |
||||
alias eb='ember build' |
||||
alias ed='ember destroy' |
||||
alias eg='ember generate' |
||||
alias eh='ember help' |
||||
alias ein='ember init' |
||||
alias eia='ember install:addon' |
||||
alias eib='ember install:bower' |
||||
alias ein='ember install:npm' |
||||
alias ei='ember install' |
||||
alias et='ember test' |
||||
alias eu='ember update' |
||||
alias ev='ember version' |
||||
@ -0,0 +1,19 @@ |
||||
# Ember ClI |
||||
# visit http://www.ember-cli.com/ to view user guid |
||||
|
||||
alias es='ember serve' |
||||
alias ea='ember addon' |
||||
alias eb='ember build' |
||||
alias ed='ember destroy' |
||||
alias eg='ember generate' |
||||
alias eh='ember help' |
||||
alias ein='ember init' |
||||
alias eia='ember install:addon' |
||||
alias eib='ember install:bower' |
||||
alias ein='ember install:npm' |
||||
alias ei='ember install' |
||||
alias et='ember test' |
||||
alias eu='ember update' |
||||
|
||||
# version |
||||
alias ev='ember version' |
||||
@ -0,0 +1,135 @@ |
||||
# emoji plugin |
||||
|
||||
Support for conveniently working with Unicode emoji in Zsh. |
||||
|
||||
## Features |
||||
|
||||
This plugin provides support for working with Unicode emoji characters in `zsh` using human-readable identifiers. It provides global variables which map emoji names to the actual characters, country names to their flags, and some named groupings of emoji. It also provides associated functions for displaying them. |
||||
|
||||
#### Variables |
||||
|
||||
Variable | Description |
||||
----------------- | -------------------------------- |
||||
$emoji | Maps emoji names to characters |
||||
$emoji_flags | Maps country names to flag characters (using region indicators) |
||||
$emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names |
||||
|
||||
You may define new emoji groups at run time by modifying `$emoji_groups`. The special group name `all` is reserved for use by the plugin. You should not modify `$emoji` or `$emoji_flags`. |
||||
|
||||
#### Functions |
||||
|
||||
Function | Description |
||||
---------------- | ------------------------------- |
||||
random_emoji | Prints a random emoji character |
||||
display_emoji | Displays emoji, along with their names |
||||
|
||||
## Usage and Examples |
||||
|
||||
To output a specific emoji, use: |
||||
``` |
||||
$> echo $emoji[<name>] |
||||
``` |
||||
E.g.: |
||||
``` |
||||
$> echo $emoji[mouse_face] |
||||
``` |
||||
|
||||
To output a random emoji, use: |
||||
``` |
||||
$> random_emoji |
||||
``` |
||||
To output a random emoji from a particular group, use: |
||||
``` |
||||
$> random_emoji <group> |
||||
``` |
||||
E.g.: |
||||
``` |
||||
$> random_emoji fruits |
||||
$> random_emoji animals |
||||
$> random_emoji vehicles |
||||
$> random_emoji faces |
||||
``` |
||||
|
||||
The defined group names can be found with `echo ${(k)emoji_groups}`. |
||||
|
||||
To list all available emoji with their names, use: |
||||
``` |
||||
$> display_emoji |
||||
$> display_emoji fruits |
||||
$> display_emoji animals |
||||
$> display_emoji vehicles |
||||
$> display_emoji faces |
||||
``` |
||||
|
||||
To use emoji in a prompt: |
||||
``` |
||||
PROMPT="$emoji[penguin] > "" |
||||
PROMPT='$(random_emoji fruits) > ' |
||||
surfer=$emoji[surfer] |
||||
PROMPT="$surfer > " |
||||
``` |
||||
|
||||
## Technical Details |
||||
|
||||
The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at http://www.unicode.org/reports/tr51/index.html. |
||||
|
||||
The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke) |
||||
|
||||
The values in the `$emoji*` maps are the emoji characters themselves, not escape sequences or other forms that require interpretation. They can be used in any context and do not require escape sequence support from commands like `echo` or `print`. |
||||
|
||||
The emoji in the main `$emoji` map are standalone character sequences which can all be output on their own, without worrying about combining characters. The values may actually be multi-code-point sequences, instead of a single code point, and may include combining characters in those sequences. But they're arranged so their effects do not extend beyond that sequence. |
||||
|
||||
The exception to this is the skin tone variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.) |
||||
|
||||
|
||||
## Experimental Features |
||||
|
||||
This defines some additional variables and functions, but these are experimental and subject to change at any time. You shouldn't rely on them being available. They're mostly for the use of emoji plugin developers to help decide what to include in future revisions. |
||||
|
||||
Variables: |
||||
|
||||
Variable | Description |
||||
----------------- | -------------------------------- |
||||
$emoji2 | Auxiliary and combining characters |
||||
$emoji_skintone | Skin tone modifiers (from Unicode 8.0) |
||||
|
||||
|
||||
#### Skin Tone Variation Selection |
||||
|
||||
This includes experimental support for the skin tone Variation Selectors introduced with Unicode 8.0, which let you select different skin tones for emoji involving humans. |
||||
|
||||
NOTE: This really is experimental. The skin tone selectors are a relatively new feature and may not be supported by all systems. And the support in this plugin is a work in progress. It may not work in all places. In fact, I haven't gotten it to work anywhere yet. -apjanke |
||||
|
||||
The "variation selectors" are combining characters which change the appearance of the preceding character. A variation selector character can be output immediately following a human emoji to change its skin tone color. You can also output a variation selector on its own to display a color swatch of that skin tone. |
||||
|
||||
The `$emoji_skintone` associative array maps skin tone IDs to the variation selector characters. To use one, output it immediately following a smiley or other human emoji. |
||||
|
||||
``` |
||||
echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]" |
||||
``` |
||||
|
||||
Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](http://www.unicode.org/reports/tr51/index.html#Diversity) for details. |
||||
|
||||
## TODO |
||||
|
||||
These are things that could be enhanced in future revisions of the plugin. |
||||
|
||||
* Incorporate CLDR data for ordering and groupings |
||||
* Short :bracket: style names (from gemoji) |
||||
* Incorporate `gemoji` data |
||||
* Country codes for flags |
||||
* ZWJ combining function? |
||||
|
||||
#### Gemoji support |
||||
|
||||
The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. (I'm saying this just from looking at the google results for "emoji short names" and related searches. -apjanke) |
||||
|
||||
If this plugin is updated to provide short names, CLDR sorting data, and similar stuff, it should probably be changed to use the Gemoji project, and the `update_emoji.pl` script be rewritten in Ruby so it can use the Gemoji library directly instead of parsing its data files. |
||||
|
||||
This does *not* mean that it should use Gemoji at run time. None of the `zsh` plugin stuff should call Gemoji or Ruby code. Rather, the "build time" `update_emoji.pl` script should be rewritten to use Gemoji to generate a pure-native-`zsh` character definition file which would be checked in to the repo and can be called by OMZ users without having Gemoji installed. |
||||
|
||||
#### ZWJ combining function |
||||
|
||||
One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](http://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences). |
||||
|
||||
These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears. |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,289 @@ |
||||
# emoji plugin |
||||
# |
||||
# Makes emoji support available within ZSH |
||||
# |
||||
# See the README for documentation. |
||||
|
||||
_omz_emoji_plugin_dir="${0:h}" |
||||
|
||||
() { |
||||
|
||||
local LC_ALL=en_US.UTF-8 |
||||
|
||||
typeset -gAH emoji_groups |
||||
typeset -gAH emoji_con |
||||
typeset -gAH emoji2 |
||||
typeset -gAH emoji_skintone |
||||
|
||||
source "$_omz_emoji_plugin_dir/emoji-char-definitions.zsh" |
||||
unset _omz_emoji_plugin_dir |
||||
|
||||
# These additional emoji are not in the definition file, but are useful in conjunction with it |
||||
|
||||
# This is a combinin character that can be placed after any other character to surround |
||||
# it in a "keycap" symbol. |
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc. |
||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones |
||||
# which can be displayed on their own. |
||||
#emoji[combining_enclosing_keycap]="\U20E3" |
||||
|
||||
emoji[regional_indicator_symbol_letter_d_regional_indicator_symbol_letter_e]=$'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA' |
||||
emoji[regional_indicator_symbol_letter_g_regional_indicator_symbol_letter_b]=$'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7' |
||||
emoji[regional_indicator_symbol_letter_c_regional_indicator_symbol_letter_n]=$'\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3' |
||||
emoji[regional_indicator_symbol_letter_j_regional_indicator_symbol_letter_p]=$'\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5' |
||||
emoji[regional_indicator_symbol_letter_k_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7' |
||||
emoji[regional_indicator_symbol_letter_f_regional_indicator_symbol_letter_r]=$'\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7' |
||||
emoji[regional_indicator_symbol_letter_e_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8' |
||||
emoji[regional_indicator_symbol_letter_i_regional_indicator_symbol_letter_t]=$'\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9' |
||||
emoji[regional_indicator_symbol_letter_u_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8' |
||||
emoji[regional_indicator_symbol_letter_r_regional_indicator_symbol_letter_u]=$'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA' |
||||
|
||||
# Nonstandard alias names |
||||
emoji[vulcan_salute]=$'\U1F596' |
||||
|
||||
|
||||
# Emoji combining and auxiliary characters |
||||
|
||||
# "Variation Selectors" for controlling text vs emoji style presentation |
||||
# These apply to the immediately preceding character |
||||
emoji2[text_style]=$'\UFE0E' |
||||
emoji2[emoji_style]=$'\UFE0F' |
||||
# Joiner that indicates a single combined-form glyph (ligature) should be used |
||||
emoji2[zero_width_joiner]=$'\U200D' |
||||
# Skin tone modifiers |
||||
emoji2[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB' |
||||
emoji2[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC' |
||||
emoji2[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD' |
||||
emoji2[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE' |
||||
emoji2[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF' |
||||
# Various other combining characters. (Incomplete list; I selected ones that sound useful) |
||||
emoji2[combining_enclosing_circle]=$'\U20DD' |
||||
emoji2[combining_enclosing_square]=$'\U20DE' |
||||
emoji2[combining_enclosing_diamond]=$'\U20DF' |
||||
emoji2[combining_enclosing_circle_backslash]=$'\U20E0' |
||||
emoji2[combining_enclosing_screen]=$'\U20E2' |
||||
emoji2[combining_enclosing_keycap]=$'\U20E3' |
||||
emoji2[combining_enclosing_upward_pointing_triangle]=$'\U20E4' |
||||
|
||||
# Easier access to skin tone modifiers |
||||
emoji_skintone[1_2]=$'\U1F3FB' |
||||
emoji_skintone[3]=$'\U1F3FC' |
||||
emoji_skintone[4]=$'\U1F3FD' |
||||
emoji_skintone[5]=$'\U1F3FE' |
||||
emoji_skintone[6]=$'\U1F3FF' |
||||
|
||||
# Emoji groups |
||||
# These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global |
||||
# namespace, and to allow adding additional group definitions at run time. |
||||
# The keys are the group names, and the values are whitespace-separated lists of emoji character names. |
||||
# |
||||
# These extra local arrays are used to allow more convenient formatting of the source code. |
||||
|
||||
emoji_groups[fruits]=" |
||||
tomato |
||||
aubergine |
||||
grapes |
||||
melon |
||||
watermelon |
||||
tangerine |
||||
banana |
||||
pineapple |
||||
red_apple |
||||
green_apple |
||||
peach |
||||
cherries |
||||
strawberry |
||||
lemon |
||||
pear |
||||
" |
||||
|
||||
emoji_groups[vehicles]=" |
||||
airplane |
||||
rocket |
||||
railway_car |
||||
high_speed_train |
||||
high_speed_train_with_bullet_nose |
||||
bus |
||||
ambulance |
||||
fire_engine |
||||
police_car |
||||
taxi |
||||
automobile |
||||
recreational_vehicle |
||||
delivery_truck |
||||
ship |
||||
speedboat |
||||
bicycle |
||||
helicopter |
||||
steam_locomotive |
||||
train |
||||
light_rail |
||||
tram |
||||
oncoming_bus |
||||
trolleybus |
||||
minibus |
||||
oncoming_police_car |
||||
oncoming_taxi |
||||
oncoming_automobile |
||||
articulated_lorry |
||||
tractor |
||||
monorail |
||||
mountain_railway |
||||
suspension_railway |
||||
mountain_cableway |
||||
aerial_tramway |
||||
rowboat |
||||
bicyclist |
||||
mountain_bicyclist |
||||
sailboat |
||||
" |
||||
|
||||
emoji_groups[animals]=" |
||||
snail |
||||
snake |
||||
horse |
||||
sheep |
||||
monkey |
||||
chicken |
||||
boar |
||||
elephant |
||||
octopus |
||||
spiral_shell |
||||
bug |
||||
ant |
||||
honeybee |
||||
lady_beetle |
||||
fish |
||||
tropical_fish |
||||
blowfish |
||||
turtle |
||||
hatching_chick |
||||
baby_chick |
||||
front_facing_baby_chick |
||||
bird |
||||
penguin |
||||
koala |
||||
poodle |
||||
bactrian_camel |
||||
dolphin |
||||
mouse_face |
||||
cow_face |
||||
tiger_face |
||||
rabbit_face |
||||
cat_face |
||||
dragon_face |
||||
spouting_whale |
||||
horse_face |
||||
monkey_face |
||||
dog_face |
||||
pig_face |
||||
frog_face |
||||
hamster_face |
||||
wolf_face |
||||
bear_face |
||||
panda_face |
||||
rat |
||||
mouse |
||||
ox |
||||
water_buffalo |
||||
cow |
||||
tiger |
||||
leopard |
||||
rabbit |
||||
cat |
||||
dragon |
||||
crocodile |
||||
whale |
||||
ram |
||||
goat |
||||
rooster |
||||
dog |
||||
pig |
||||
dromedary_camel |
||||
" |
||||
|
||||
emoji_groups[faces]=" |
||||
grinning_face_with_smiling_eyes |
||||
face_with_tears_of_joy |
||||
smiling_face_with_open_mouth |
||||
smiling_face_with_open_mouth_and_smiling_eyes |
||||
smiling_face_with_open_mouth_and_cold_sweat |
||||
smiling_face_with_open_mouth_and_tightly_closed_eyes |
||||
winking_face |
||||
smiling_face_with_smiling_eyes |
||||
face_savouring_delicious_food |
||||
relieved_face |
||||
smiling_face_with_heart_shaped_eyes |
||||
smirking_face |
||||
unamused_face |
||||
face_with_cold_sweat |
||||
pensive_face |
||||
confounded_face |
||||
face_throwing_a_kiss |
||||
kissing_face_with_closed_eyes |
||||
face_with_stuck_out_tongue_and_winking_eye |
||||
face_with_stuck_out_tongue_and_tightly_closed_eyes |
||||
disappointed_face |
||||
angry_face |
||||
pouting_face |
||||
crying_face |
||||
persevering_face |
||||
face_with_look_of_triumph |
||||
disappointed_but_relieved_face |
||||
fearful_face |
||||
weary_face |
||||
sleepy_face |
||||
tired_face |
||||
loudly_crying_face |
||||
face_with_open_mouth_and_cold_sweat |
||||
face_screaming_in_fear |
||||
astonished_face |
||||
flushed_face |
||||
dizzy_face |
||||
face_with_medical_mask |
||||
" |
||||
|
||||
} |
||||
|
||||
# Prints a random emoji character |
||||
# |
||||
# random_emoji [group] |
||||
# |
||||
function random_emoji() { |
||||
local group=$1 |
||||
local names |
||||
if [[ -z "$group" || "$group" == "all" ]]; then |
||||
names=(${(k)emoji}) |
||||
else |
||||
names=(${=emoji_groups[$group_name]}) |
||||
fi |
||||
local list_size=$#names |
||||
local random_index=$(( ( RANDOM % $list_size ) + 1 )) |
||||
local name=${names[$random_index]} |
||||
echo ${emoji[$name]} |
||||
} |
||||
|
||||
# Displays a listing of emoji with their names |
||||
# |
||||
# display_emoji [group] |
||||
# |
||||
function display_emoji() { |
||||
local group=$1 |
||||
local names |
||||
if [[ -z "$group" || "$group" == "all" ]]; then |
||||
names=(${(k)emoji}) |
||||
else |
||||
names=(${=emoji_groups[$group]}) |
||||
fi |
||||
# The extra spaces in output here are a hack for readability, since some |
||||
# terminals treat these emoji chars as single-width. |
||||
for i in $names; do |
||||
printf '%s ' "$emoji[$i]" |
||||
done |
||||
print |
||||
for i in $names; do |
||||
echo "${emoji[$i]} = $i" |
||||
done |
||||
} |
||||
|
||||
|
||||
@ -0,0 +1,113 @@ |
||||
#!/usr/bin/perl -w |
||||
# |
||||
# update_emoji.pl |
||||
# |
||||
# This script generates the emoji.plugin.zsh emoji definitions from the Unicode |
||||
# character data for the emoji characters. |
||||
# |
||||
# The data file can be found at http://unicode.org/Public/emoji/latest/emoji-data.txt |
||||
# as referenced in Unicode TR51 (http://www.unicode.org/reports/tr51/index.html). |
||||
# |
||||
# This is known to work with the data file from version 1.0. It may not work with later |
||||
# versions if the format changes. In particular, this reads line comments to get the |
||||
# emoji character name and unicode version. |
||||
# |
||||
# Country names have punctuation and other non-letter characters removed from their name, |
||||
# to avoid possible complications with having to escape the strings when using them as |
||||
# array subscripts. The definition file seems to use some combining characters like accents |
||||
# that get stripped during this process. |
||||
|
||||
use strict; |
||||
use warnings; |
||||
use 5.010; |
||||
use autodie; |
||||
|
||||
use Path::Class; |
||||
use File::Copy; |
||||
|
||||
# Parse definitions out of the data file and convert |
||||
sub process_emoji_data_file { |
||||
my ( $infile, $outfilename ) = @_; |
||||
my $file = file($infile); |
||||
my $outfile = file($outfilename); |
||||
my $outfilebase = $outfile->basename(); |
||||
my $tempfilename = "$outfilename.tmp"; |
||||
my $tempfile = file($tempfilename); |
||||
my $outfh = $tempfile->openw(); |
||||
$outfh->print(" |
||||
# $outfilebase - Emoji character definitions for oh-my-zsh emoji plugin |
||||
# |
||||
# This file is auto-generated by update_emoji.pl. Do not edit it manually. |
||||
# |
||||
# This contains the definition for: |
||||
# \$emoji - which maps character names to Unicode characters |
||||
# \$emoji_flags - maps country names to Unicode flag characters using region indicators |
||||
|
||||
# Main emoji |
||||
typeset -gAH emoji |
||||
# National flags |
||||
typeset -gAH emoji_flags |
||||
# Combining modifiers |
||||
typeset -gAH emoji_mod |
||||
|
||||
"); |
||||
|
||||
my $fh = $file->openr(); |
||||
my $line_num = 0; |
||||
while ( my $line = $fh->getline() ) { |
||||
$line_num++; |
||||
$_ = $line; |
||||
# Skip all-comment lines (from the header) and blank lines |
||||
# (But don't strip comments on normal lines; we need to parse those for |
||||
# the emoji names.) |
||||
next if /^\s*#/ or /^\s*$/; |
||||
|
||||
if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) { |
||||
my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name) |
||||
= ($1, $2, $3, $4, $5, $6, $7); |
||||
#print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n"; |
||||
my @code_points = split /\s+/, $code; |
||||
my @sources = split /\s+/, $sources; |
||||
|
||||
my $flag_country = ""; |
||||
if ( $keycap_name =~ /^flag for (\S.*?)\s*$/) { |
||||
$flag_country = $1; |
||||
} |
||||
|
||||
my $zsh_code = join '', map { "\\U$_" } @code_points; |
||||
# Convert keycap names to valid associative array names that do not require any |
||||
# quoting. Works fine for most stuff, but is clumsy for flags. |
||||
my $omz_name = lc($keycap_name); |
||||
$omz_name =~ s/[^A-Za-z0-9]/_/g; |
||||
my $zsh_flag_country = $flag_country; |
||||
$zsh_flag_country =~ s/[^\p{Letter}]/_/g; |
||||
if ($flag_country) { |
||||
$outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n"); |
||||
} else { |
||||
$outfh->print("emoji[$omz_name]=\$'$zsh_code'\n"); |
||||
} |
||||
# Modifiers are included in both the main set and their separate map, |
||||
# because they have a standalone representation as a color swatch. |
||||
if ( $modifier_status == "modifier" ) { |
||||
$outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n"); |
||||
} |
||||
} else { |
||||
die "Failed parsing line $line_num: '$_'"; |
||||
} |
||||
} |
||||
$fh->close(); |
||||
$outfh->print("\n"); |
||||
$outfh->close(); |
||||
|
||||
move($tempfilename, $outfilename) |
||||
or die "Failed moving temp file to $outfilename: $!"; |
||||
} |
||||
|
||||
my $datafile = "emoji-data.txt"; |
||||
my $zsh_def_file = "emoji-char-definitions.zsh"; |
||||
process_emoji_data_file($datafile, $zsh_def_file); |
||||
|
||||
print "Updated definition file $zsh_def_file\n"; |
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@ |
||||
# start fbterm automatically in /dev/tty* |
||||
|
||||
if [[ $(tty|grep -o '/dev/tty') = /dev/tty ]] ; then |
||||
fbterm |
||||
exit |
||||
if (( ${+commands[fbterm]} )); then |
||||
if [[ "$TTY" = /dev/tty* ]] ; then |
||||
fbterm && exit |
||||
fi |
||||
fi |
||||
|
||||
@ -0,0 +1,13 @@ |
||||
## forklift |
||||
|
||||
Plugin for ForkLift, an FTP application for OS X. |
||||
|
||||
### Requirements |
||||
|
||||
* [ForkLift](http://forkliftapp.com/forklift/) |
||||
|
||||
### Usage |
||||
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .` |
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift |
||||
@ -0,0 +1,81 @@ |
||||
## Rationale ## |
||||
|
||||
> Searches for your Frontend contents more easier |
||||
|
||||
|
||||
## Instalation ## |
||||
|
||||
|
||||
Open your `.zshrc` file and load `frontend-search` plugin |
||||
|
||||
```bash |
||||
... |
||||
plugins=( <your-plugins-list>... frontend-search) |
||||
... |
||||
``` |
||||
|
||||
|
||||
## Commands ## |
||||
|
||||
All command searches are accept only in format |
||||
|
||||
* `frontend <search-content> <search-term>` |
||||
|
||||
The search content are |
||||
|
||||
* `jquery <api.jquery.com>` |
||||
* `mdn <developer.mozilla.org>` |
||||
* `compass <compass-style.org>` |
||||
* `html5please <html5please.com>` |
||||
* `caniuse <caniuse.com>` |
||||
* `aurajs <aurajs.com>` |
||||
* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>` |
||||
* `lodash <search>` |
||||
* `qunit <api.qunitjs.com>` |
||||
* `fontello <fontello.com>` |
||||
* `bootsnipp <bootsnipp.com>` |
||||
* `cssflow <cssflow.com>` |
||||
* `codepen <codepen.io>` |
||||
* `unheap <www.unheap.com>` |
||||
* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>` |
||||
* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>` |
||||
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>` |
||||
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>` |
||||
* `emberjs <emberjs.com>` |
||||
* `stackoverflow <stackoverflow.com>` |
||||
|
||||
|
||||
## Aliases ## |
||||
|
||||
There are a few aliases presented as well: |
||||
|
||||
* `jquery` A shorthand for `frontend jquery` |
||||
* `mdn` A shorthand for `frontend mdn` |
||||
* `compass` A shorthand for `frontend compass` |
||||
* `html5please` A shorthand for `frontend html5please` |
||||
* `caniuse` A shorthand for `frontend caniuse` |
||||
* `aurajs` A shorthand for `frontend aurajs` |
||||
* `dartlang` A shorthand for `frontend dartlang` |
||||
* `lodash` A shorthand for `frontend lodash` |
||||
* `qunit` A shorthand for `frontend qunit` |
||||
* `fontello` A shorthand for `frontend fontello` |
||||
* `bootsnipp` A shorthand for `frontend bootsnipp` |
||||
* `cssflow` A shorthand for `frontend cssflow` |
||||
* `codepen` A shorthand for `frontend codepen` |
||||
* `unheap` A shorthand for `frontend unheap` |
||||
* `bem` A shorthand for `frontend bem` |
||||
* `smacss` A shorthand for `frontend smacss` |
||||
* `angularjs` A shorthand for `frontend angularjs` |
||||
* `reactjs` A shorthand for `frontend reactjs` |
||||
* `emberjs` A shorthand for `frontend emberjs` |
||||
* `stackoverflow` A shorthand for `frontend stackoverflow` |
||||
|
||||
|
||||
## Author |
||||
|
||||
**Wilson Mendes (willmendesneto)** |
||||
+ <https://plus.google.com/+WilsonMendes> |
||||
+ <https://twitter.com/willmendesneto> |
||||
+ <http://github.com/willmendesneto> |
||||
|
||||
New features comming soon. |
||||
@ -0,0 +1,128 @@ |
||||
#compdef frontend |
||||
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b' |
||||
zstyle ':completion::complete:frontend:*:commands' group-name commands |
||||
zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points |
||||
zstyle ':completion::complete:frontend::' list-grouped |
||||
|
||||
zmodload zsh/mapfile |
||||
|
||||
function _frontend() { |
||||
local CONFIG=$HOME/.frontend-search |
||||
local ret=1 |
||||
|
||||
local -a commands |
||||
local -a frontend_points |
||||
|
||||
frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" ) |
||||
|
||||
commands=( |
||||
'jquery: Search in jQuery website' |
||||
'mdn: Search in MDN website' |
||||
'compass: Search in COMPASS website' |
||||
'html5please: Search in HTML5 Please website' |
||||
'caniuse: Search in Can I Use website' |
||||
'aurajs: Search in AuraJs website' |
||||
'dartlang: Search in Dart website' |
||||
'lodash: Search in Lo-Dash website' |
||||
'qunit: Search in Qunit website' |
||||
'fontello: Search in fontello website' |
||||
'bootsnipp: Search in bootsnipp website' |
||||
'cssflow: Search in cssflow website' |
||||
'codepen: Search in codepen website' |
||||
'unheap: Search in unheap website' |
||||
'bem: Search in BEM website' |
||||
'smacss: Search in SMACSS website' |
||||
'angularjs: Search in Angular website' |
||||
'reactjs: Search in React website' |
||||
'emberjs: Search in Ember website' |
||||
'stackoverflow: Search in StackOverflow website' |
||||
) |
||||
|
||||
_arguments -C \ |
||||
'1: :->first_arg' \ |
||||
'2: :->second_arg' && ret=0 |
||||
|
||||
case $state in |
||||
first_arg) |
||||
_describe -t frontend_points "Warp points" frontend_points && ret=0 |
||||
_describe -t commands "Commands" commands && ret=0 |
||||
;; |
||||
second_arg) |
||||
case $words[2] in |
||||
jquery) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
mdn) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
compass) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
html5please) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
caniuse) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
aurajs) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
dartlang) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
lodash) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
qunit) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
fontello) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
bootsnipp) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
cssflow) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
codepen) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
unheap) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
bem) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
smacss) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
angularjs) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
reactjs) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
emberjs) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
stackoverflow) |
||||
_describe -t points "Warp points" frontend_points && ret=0 |
||||
;; |
||||
esac |
||||
;; |
||||
esac |
||||
|
||||
return $ret |
||||
} |
||||
|
||||
_frontend "$@" |
||||
|
||||
# Local Variables: |
||||
# mode: Shell-Script |
||||
# sh-indentation: 2 |
||||
# indent-tabs-mode: nil |
||||
# sh-basic-offset: 2 |
||||
# End: |
||||
# vim: ft=zsh sw=2 ts=2 et |
||||
@ -0,0 +1,150 @@ |
||||
# frontend from terminal |
||||
|
||||
function frontend() { |
||||
|
||||
# no keyword provided, simply show how call methods |
||||
if [[ $# -le 1 ]]; then |
||||
echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n" |
||||
return 1 |
||||
fi |
||||
|
||||
# check whether the search engine is supported |
||||
if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]]; |
||||
then |
||||
echo "Search valid search content $1 not supported." |
||||
echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')" |
||||
echo "* jquery" |
||||
echo "* mdn" |
||||
echo "* compass" |
||||
echo "* html5please" |
||||
echo "* caniuse" |
||||
echo "* aurajs" |
||||
echo "* dartlang" |
||||
echo "* lodash" |
||||
echo "* qunit" |
||||
echo "* fontello" |
||||
echo "* bootsnipp" |
||||
echo "* cssflow" |
||||
echo "* codepen" |
||||
echo "* unheap" |
||||
echo "* bem" |
||||
echo "* smacss" |
||||
echo "* angularjs" |
||||
echo "* reactjs" |
||||
echo "* emberjs" |
||||
echo "* stackoverflow" |
||||
echo "" |
||||
|
||||
return 1 |
||||
fi |
||||
|
||||
local url="http://" |
||||
local query="" |
||||
|
||||
case "$1" in |
||||
"jquery") |
||||
url="${url}api.jquery.com" |
||||
url="${url}/?s=$2" ;; |
||||
"mdn") |
||||
url="${url}developer.mozilla.org" |
||||
url="${url}/search?q=$2" ;; |
||||
"compass") |
||||
url="${url}compass-style.org" |
||||
url="${url}/search?q=$2" ;; |
||||
"html5please") |
||||
url="${url}html5please.com" |
||||
url="${url}/#$2" ;; |
||||
"caniuse") |
||||
url="${url}caniuse.com" |
||||
url="${url}/#search=$2" ;; |
||||
"aurajs") |
||||
url="${url}aurajs.com" |
||||
url="${url}/api/#stq=$2" ;; |
||||
"dartlang") |
||||
url="${url}api.dartlang.org/apidocs/channels/stable/dartdoc-viewer" |
||||
url="${url}/dart-$2" ;; |
||||
"qunit") |
||||
url="${url}api.qunitjs.com" |
||||
url="${url}/?s=$2" ;; |
||||
"fontello") |
||||
url="${url}fontello.com" |
||||
url="${url}/#search=$2" ;; |
||||
"bootsnipp") |
||||
url="${url}bootsnipp.com" |
||||
url="${url}/search?q=$2" ;; |
||||
"cssflow") |
||||
url="${url}cssflow.com" |
||||
url="${url}/search?q=$2" ;; |
||||
"codepen") |
||||
url="${url}codepen.io" |
||||
url="${url}/search?q=$2" ;; |
||||
"unheap") |
||||
url="${url}www.unheap.com" |
||||
url="${url}/?s=$2" ;; |
||||
"bem") |
||||
url="${url}google.com" |
||||
url="${url}/search?as_q=$2&as_sitesearch=bem.info" ;; |
||||
"smacss") |
||||
url="${url}google.com" |
||||
url="${url}/search?as_q=$2&as_sitesearch=smacss.com" ;; |
||||
"angularjs") |
||||
url="${url}google.com" |
||||
url="${url}/search?as_q=$2&as_sitesearch=angularjs.org" ;; |
||||
"reactjs") |
||||
url="${url}google.com" |
||||
url="${url}/search?as_q=$2&as_sitesearch=facebook.github.io/react" ;; |
||||
"emberjs") |
||||
url="${url}emberjs.com" |
||||
url="${url}/api/#stq=$2&stp=1" ;; |
||||
"stackoverflow") |
||||
url="${url}stackoverflow.com" |
||||
url="${url}/search?q=$2" ;; |
||||
*) echo "INVALID PARAM!" |
||||
return ;; |
||||
esac |
||||
|
||||
echo "$url" |
||||
|
||||
open_command "$url" |
||||
|
||||
} |
||||
|
||||
# javascript |
||||
alias jquery='frontend jquery' |
||||
alias mdn='frontend mdn' |
||||
|
||||
# pre processors frameworks |
||||
alias compassdoc='frontend compass' |
||||
|
||||
# important links |
||||
alias html5please='frontend html5please' |
||||
alias caniuse='frontend caniuse' |
||||
|
||||
# components and libraries |
||||
alias aurajs='frontend aurajs' |
||||
alias dartlang='frontend dartlang' |
||||
alias lodash='frontend lodash' |
||||
|
||||
#tests |
||||
alias qunit='frontend qunit' |
||||
|
||||
#fonts |
||||
alias fontello='frontend fontello' |
||||
|
||||
# snippets |
||||
alias bootsnipp='frontend bootsnipp' |
||||
alias cssflow='frontend cssflow' |
||||
alias codepen='frontend codepen' |
||||
alias unheap='frontend unheap' |
||||
|
||||
# css architecture |
||||
alias bem='frontend bem' |
||||
alias smacss='frontend smacss' |
||||
|
||||
# frameworks |
||||
alias angularjs='frontend angularjs' |
||||
alias reactjs='frontend reactjs' |
||||
alias emberjs='frontend emberjs' |
||||
|
||||
# search websites |
||||
alias stackoverflow='frontend stackoverflow' |
||||
@ -1,4 +1,10 @@ |
||||
## git |
||||
**Maintainer:** [Stibbons](https://github.com/Stibbons) |
||||
|
||||
This plugin adds several git aliases and increase the completion function provided by zsh |
||||
**Maintainer:** [@ncanceill](https://github.com/ncanceill) |
||||
|
||||
This plugin adds many useful aliases and functions. |
||||
|
||||
### Usage |
||||
|
||||
See the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) for a list of aliases and functions provided by the plugin. |
||||
|
||||
|
||||
@ -1,83 +0,0 @@ |
||||
#compdef git-branch |
||||
|
||||
_git-branch () |
||||
{ |
||||
declare l c m d |
||||
|
||||
l='--color --no-color -r -a --all -v --verbose --abbrev --no-abbrev' |
||||
c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged' |
||||
m='-m -M' |
||||
d='-d -D' |
||||
|
||||
declare -a dependent_creation_args |
||||
if (( words[(I)-r] == 0 )); then |
||||
dependent_creation_args=( |
||||
"($l $m $d): :__git_branch_names" |
||||
"::start-point:__git_revisions") |
||||
fi |
||||
|
||||
declare -a dependent_deletion_args |
||||
if (( words[(I)-d] || words[(I)-D] )); then |
||||
dependent_creation_args= |
||||
dependent_deletion_args=( |
||||
'-r[delete only remote-tracking branches]') |
||||
if (( words[(I)-r] )); then |
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names' |
||||
else |
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names' |
||||
fi |
||||
fi |
||||
|
||||
declare -a dependent_modification_args |
||||
if (( words[(I)-m] || words[(I)-M] )); then |
||||
dependent_creation_args= |
||||
dependent_modification_args=( |
||||
':old or new branch name:__git_branch_names' |
||||
'::new branch name:__git_branch_names') |
||||
fi |
||||
|
||||
_arguments -w -S -s \ |
||||
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \ |
||||
"($c $m $d : --color)--no-color[turn off branch coloring]" \ |
||||
"($c $m -a --all)-r[list or delete only remote-tracking branches]" \ |
||||
"($c $m $d : -r)"{-a,--all}"[list both remote-tracking branches and local branches]" \ |
||||
"($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \ |
||||
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ |
||||
"($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \ |
||||
"($l $m $d)-l[create the branch's reflog]" \ |
||||
"($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \ |
||||
"($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \ |
||||
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \ |
||||
"($l $m $d)--set-upstream[set up configuration so that pull merges]" \ |
||||
"($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ |
||||
"($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ |
||||
"($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \ |
||||
$dependent_creation_args \ |
||||
"($l $c $d -M)-m[rename a branch and the corresponding reflog]" \ |
||||
"($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \ |
||||
$dependent_modification_args \ |
||||
"($l $c $m -D)-d[delete a fully merged branch]" \ |
||||
"($l $c $m -d)-D[delete a branch]" \ |
||||
$dependent_deletion_args |
||||
} |
||||
|
||||
(( $+functions[__git_ignore_line] )) || |
||||
__git_ignore_line () { |
||||
declare -a ignored |
||||
ignored=() |
||||
((CURRENT > 1)) && |
||||
ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) |
||||
((CURRENT < $#line)) && |
||||
ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) |
||||
$* -F ignored |
||||
} |
||||
|
||||
(( $+functions[__git_ignore_line_inside_arguments] )) || |
||||
__git_ignore_line_inside_arguments () { |
||||
declare -a compadd_opts |
||||
|
||||
zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: |
||||
|
||||
__git_ignore_line $* $compadd_opts |
||||
} |
||||
|
||||
@ -1,74 +0,0 @@ |
||||
#compdef git-remote |
||||
|
||||
# NOTE: --track is undocumented. |
||||
# TODO: --track, -t, --master, and -m should take remote branches, I guess. |
||||
# NOTE: --master is undocumented. |
||||
# NOTE: --fetch is undocumented. |
||||
_git-remote () { |
||||
local curcontext=$curcontext state line |
||||
declare -A opt_args |
||||
|
||||
_arguments -C \ |
||||
':command:->command' \ |
||||
'*::options:->options' && ret=0 |
||||
|
||||
case $state in |
||||
(command) |
||||
declare -a commands |
||||
|
||||
commands=( |
||||
'add:add a new remote' |
||||
'show:show information about a given remote' |
||||
'prune:delete all stale tracking branches for a given remote' |
||||
'update:fetch updates for a set of remotes' |
||||
'rm:remove a remote from .git/config and all associated tracking branches' |
||||
'rename:rename a remote from .git/config and update all associated tracking branches' |
||||
'set-head:sets or deletes the default branch' |
||||
'set-branches:changes the list of branches tracked by the named remote.' |
||||
'set-url:changes URL remote points to.' |
||||
) |
||||
|
||||
_describe -t commands 'sub-command' commands && ret=0 |
||||
;; |
||||
(options) |
||||
case $line[1] in |
||||
(add) |
||||
_arguments \ |
||||
'*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \ |
||||
'(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \ |
||||
'(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \ |
||||
':branch name:__git_remotes' \ |
||||
':url:_urls' && ret=0 |
||||
;; |
||||
(show) |
||||
_arguments \ |
||||
'-n[do not contact the remote for a list of branches]' \ |
||||
':remote:__git_remotes' && ret=0 |
||||
;; |
||||
(prune) |
||||
_arguments \ |
||||
'(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \ |
||||
':remote:__git_remotes' && ret=0 |
||||
;; |
||||
(update) |
||||
__git_remote-groups && ret=0 |
||||
;; |
||||
(rm) |
||||
__git_remotes && ret=0 |
||||
;; |
||||
(rename) |
||||
__git_remotes && ret=0 |
||||
;; |
||||
(set-url) |
||||
_arguments \ |
||||
'*--push[manipulate push URLs]' \ |
||||
'(--add)--add[add URL]' \ |
||||
'(--delete)--delete[delete URLs]' \ |
||||
':branch name:__git_remotes' \ |
||||
':url:_urls' && ret=0 |
||||
;; |
||||
|
||||
esac |
||||
;; |
||||
esac |
||||
} |
||||
@ -1,162 +1,221 @@ |
||||
# Query/use custom command for `git`. |
||||
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd |
||||
: ${_omz_git_git_cmd:=git} |
||||
|
||||
# |
||||
# Functions |
||||
# |
||||
|
||||
# The current branch name |
||||
# Usage example: git pull origin $(current_branch) |
||||
# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if |
||||
# it's not a symbolic ref, but in a Git repo. |
||||
function current_branch() { |
||||
local ref |
||||
ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null) |
||||
local ret=$? |
||||
if [[ $ret != 0 ]]; then |
||||
[[ $ret == 128 ]] && return # no git repo. |
||||
ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return |
||||
fi |
||||
echo ${ref#refs/heads/} |
||||
} |
||||
# The list of remotes |
||||
function current_repository() { |
||||
if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then |
||||
return |
||||
fi |
||||
echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2) |
||||
} |
||||
# Pretty log messages |
||||
function _git_log_prettily(){ |
||||
if ! [ -z $1 ]; then |
||||
git log --pretty=$1 |
||||
fi |
||||
} |
||||
# Warn if the current branch is a WIP |
||||
function work_in_progress() { |
||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then |
||||
echo "WIP!!" |
||||
fi |
||||
} |
||||
|
||||
# |
||||
# Aliases |
||||
# (sorted alphabetically) |
||||
# |
||||
|
||||
alias g='git' |
||||
compdef g=git |
||||
alias gst='git status' |
||||
compdef _git gst=git-status |
||||
alias gd='git diff' |
||||
compdef _git gd=git-diff |
||||
alias gdc='git diff --cached' |
||||
compdef _git gdc=git-diff |
||||
alias gl='git pull' |
||||
compdef _git gl=git-pull |
||||
alias gup='git pull --rebase' |
||||
compdef _git gup=git-fetch |
||||
alias gp='git push' |
||||
compdef _git gp=git-push |
||||
alias gd='git diff' |
||||
gdv() { git diff -w "$@" | view - } |
||||
compdef _git gdv=git-diff |
||||
|
||||
alias ga='git add' |
||||
alias gaa='git add --all' |
||||
alias gapa='git add --patch' |
||||
|
||||
alias gb='git branch' |
||||
alias gba='git branch -a' |
||||
alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d' |
||||
alias gbl='git blame -b -w' |
||||
alias gbnm='git branch --no-merged' |
||||
alias gbr='git branch --remote' |
||||
alias gbs='git bisect' |
||||
alias gbsb='git bisect bad' |
||||
alias gbsg='git bisect good' |
||||
alias gbsr='git bisect reset' |
||||
alias gbss='git bisect start' |
||||
|
||||
alias gc='git commit -v' |
||||
compdef _git gc=git-commit |
||||
alias gc!='git commit -v --amend' |
||||
compdef _git gc!=git-commit |
||||
alias gca='git commit -v -a' |
||||
compdef _git gc=git-commit |
||||
alias gca!='git commit -v -a --amend' |
||||
compdef _git gca!=git-commit |
||||
alias gcan!='git commit -v -a -s --no-edit --amend' |
||||
alias gcb='git checkout -b' |
||||
alias gcf='git config --list' |
||||
alias gcl='git clone --recursive' |
||||
alias gclean='git reset --hard && git clean -dfx' |
||||
alias gcm='git checkout master' |
||||
alias gcmsg='git commit -m' |
||||
compdef _git gcmsg=git-commit |
||||
alias gco='git checkout' |
||||
compdef _git gco=git-checkout |
||||
alias gcm='git checkout master' |
||||
alias gr='git remote' |
||||
compdef _git gr=git-remote |
||||
alias grv='git remote -v' |
||||
compdef _git grv=git-remote |
||||
alias grmv='git remote rename' |
||||
compdef _git grmv=git-remote |
||||
alias grrm='git remote remove' |
||||
compdef _git grrm=git-remote |
||||
alias grset='git remote set-url' |
||||
compdef _git grset=git-remote |
||||
alias grup='git remote update' |
||||
compdef _git grset=git-remote |
||||
alias grbi='git rebase -i' |
||||
compdef _git grbi=git-rebase |
||||
alias grbc='git rebase --continue' |
||||
compdef _git grbc=git-rebase |
||||
alias grba='git rebase --abort' |
||||
compdef _git grba=git-rebase |
||||
alias gb='git branch' |
||||
compdef _git gb=git-branch |
||||
alias gba='git branch -a' |
||||
compdef _git gba=git-branch |
||||
alias gcount='git shortlog -sn' |
||||
compdef gcount=git |
||||
alias gcl='git config --list' |
||||
alias gcp='git cherry-pick' |
||||
compdef _git gcp=git-cherry-pick |
||||
alias glg='git log --stat --max-count=10' |
||||
compdef _git glg=git-log |
||||
alias glgg='git log --graph --max-count=10' |
||||
compdef _git glgg=git-log |
||||
alias glgga='git log --graph --decorate --all' |
||||
compdef _git glgga=git-log |
||||
alias glo='git log --oneline --decorate --color' |
||||
compdef _git glo=git-log |
||||
alias glog='git log --oneline --decorate --color --graph' |
||||
compdef _git glog=git-log |
||||
alias gss='git status -s' |
||||
compdef _git gss=git-status |
||||
alias ga='git add' |
||||
compdef _git ga=git-add |
||||
alias gm='git merge' |
||||
compdef _git gm=git-merge |
||||
alias grh='git reset HEAD' |
||||
alias grhh='git reset HEAD --hard' |
||||
alias gclean='git reset --hard && git clean -dfx' |
||||
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' |
||||
alias gcs='git commit -S' |
||||
|
||||
#remove the gf alias |
||||
#alias gf='git ls-files | grep' |
||||
alias gd='git diff' |
||||
alias gdca='git diff --cached' |
||||
alias gdt='git diff-tree --no-commit-id --name-only -r' |
||||
gdv() { git diff -w "$@" | view - } |
||||
compdef _git gdv=git-diff |
||||
alias gdw='git diff --word-diff' |
||||
|
||||
alias gpoat='git push origin --all && git push origin --tags' |
||||
alias gmt='git mergetool --no-prompt' |
||||
compdef _git gm=git-mergetool |
||||
alias gf='git fetch' |
||||
alias gfa='git fetch --all --prune' |
||||
function gfg() { git ls-files | grep $@ } |
||||
compdef gfg=grep |
||||
alias gfo='git fetch origin' |
||||
|
||||
alias gg='git gui citool' |
||||
alias gga='git gui citool --amend' |
||||
alias gk='gitk --all --branches' |
||||
|
||||
alias gsts='git stash show --text' |
||||
alias gsta='git stash' |
||||
alias gstp='git stash pop' |
||||
alias gstd='git stash drop' |
||||
|
||||
# Will cd into the top of the current repository |
||||
# or submodule. |
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")' |
||||
|
||||
# Git and svn mix |
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' |
||||
compdef git-svn-dcommit-push=git |
||||
|
||||
alias gsr='git svn rebase' |
||||
alias gsd='git svn dcommit' |
||||
# |
||||
# Will return the current branch name |
||||
# Usage example: git pull origin $(current_branch) |
||||
# |
||||
function current_branch() { |
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \ |
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return |
||||
echo ${ref#refs/heads/} |
||||
ggf() { |
||||
[[ "$#" != 1 ]] && local b="$(current_branch)" |
||||
git push --force origin "${b:=$1}" |
||||
} |
||||
|
||||
function current_repository() { |
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \ |
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return |
||||
echo $(git remote -v | cut -d':' -f 2) |
||||
compdef _git ggf=git-checkout |
||||
ggl() { |
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
||||
git pull origin "${*}" |
||||
else |
||||
[[ "$#" == 0 ]] && local b="$(current_branch)" |
||||
git pull origin "${b:=$1}" |
||||
fi |
||||
} |
||||
|
||||
# these aliases take advantage of the previous function |
||||
compdef _git ggl=git-checkout |
||||
alias ggpull='git pull origin $(current_branch)' |
||||
compdef ggpull=git |
||||
alias ggpur='git pull --rebase origin $(current_branch)' |
||||
compdef ggpur=git |
||||
compdef _git ggpull=git-checkout |
||||
ggp() { |
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then |
||||
git push origin "${*}" |
||||
else |
||||
[[ "$#" == 0 ]] && local b="$(current_branch)" |
||||
git push origin "${b:=$1}" |
||||
fi |
||||
} |
||||
compdef _git ggp=git-checkout |
||||
alias ggpush='git push origin $(current_branch)' |
||||
compdef ggpush=git |
||||
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' |
||||
compdef ggpnp=git |
||||
|
||||
# Pretty log messages |
||||
function _git_log_prettily(){ |
||||
if ! [ -z $1 ]; then |
||||
git log --pretty=$1 |
||||
fi |
||||
compdef _git ggpush=git-checkout |
||||
ggpnp() { |
||||
if [[ "$#" == 0 ]]; then |
||||
ggl && ggp |
||||
else |
||||
ggl "${*}" && ggp "${*}" |
||||
fi |
||||
} |
||||
alias glp="_git_log_prettily" |
||||
compdef _git glp=git-log |
||||
|
||||
# Work In Progress (wip) |
||||
# These features allow to pause a branch development and switch to another one (wip) |
||||
# When you want to go back to work, just unwip it |
||||
# |
||||
# This function return a warning if the current branch is a wip |
||||
function work_in_progress() { |
||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then |
||||
echo "WIP!!" |
||||
fi |
||||
compdef _git ggpnp=git-checkout |
||||
alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' |
||||
ggu() { |
||||
[[ "$#" != 1 ]] && local b="$(current_branch)" |
||||
git pull --rebase origin "${b:=$1}" |
||||
} |
||||
# these alias commit and uncomit wip branches |
||||
alias gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"' |
||||
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' |
||||
compdef _git ggu=git-checkout |
||||
alias ggpur='ggu' |
||||
compdef _git ggpur=git-checkout |
||||
|
||||
# these alias ignore changes to file |
||||
alias gignore='git update-index --assume-unchanged' |
||||
alias gunignore='git update-index --no-assume-unchanged' |
||||
# list temporarily ignored files |
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"' |
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' |
||||
compdef git-svn-dcommit-push=git |
||||
|
||||
alias gk='\gitk --all --branches' |
||||
compdef _git gk='gitk' |
||||
alias gke='\gitk --all $(git log -g --pretty=format:%h)' |
||||
compdef _git gke='gitk' |
||||
|
||||
alias gl='git pull' |
||||
alias glg='git log --stat --color' |
||||
alias glgp='git log --stat --color -p' |
||||
alias glgg='git log --graph --color' |
||||
alias glgga='git log --graph --decorate --all' |
||||
alias glgm='git log --graph --max-count=10' |
||||
alias glo='git log --oneline --decorate --color' |
||||
alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
||||
alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" |
||||
alias glog='git log --oneline --decorate --color --graph' |
||||
alias glp="_git_log_prettily" |
||||
compdef _git glp=git-log |
||||
|
||||
alias gm='git merge' |
||||
alias gmom='git merge origin/master' |
||||
alias gmt='git mergetool --no-prompt' |
||||
alias gmtvim='git mergetool --no-prompt --tool=vimdiff' |
||||
alias gmum='git merge upstream/master' |
||||
|
||||
alias gp='git push' |
||||
alias gpd='git push --dry-run' |
||||
alias gpoat='git push origin --all && git push origin --tags' |
||||
compdef _git gpoat=git-push |
||||
alias gpu='git push upstream' |
||||
alias gpv='git push -v' |
||||
|
||||
alias gr='git remote' |
||||
alias gra='git remote add' |
||||
alias grb='git rebase' |
||||
alias grba='git rebase --abort' |
||||
alias grbc='git rebase --continue' |
||||
alias grbi='git rebase -i' |
||||
alias grbm='git rebase master' |
||||
alias grbs='git rebase --skip' |
||||
alias grh='git reset HEAD' |
||||
alias grhh='git reset HEAD --hard' |
||||
alias grmv='git remote rename' |
||||
alias grrm='git remote remove' |
||||
alias grset='git remote set-url' |
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")' |
||||
alias gru='git reset --' |
||||
alias grup='git remote update' |
||||
alias grv='git remote -v' |
||||
|
||||
alias gsb='git status -sb' |
||||
alias gsd='git svn dcommit' |
||||
alias gsi='git submodule init' |
||||
alias gsps='git show --pretty=short --show-signature' |
||||
alias gsr='git svn rebase' |
||||
alias gss='git status -s' |
||||
alias gst='git status' |
||||
alias gsta='git stash' |
||||
alias gstaa='git stash apply' |
||||
alias gstd='git stash drop' |
||||
alias gstl='git stash list' |
||||
alias gstp='git stash pop' |
||||
alias gsts='git stash show --text' |
||||
alias gsu='git submodule update' |
||||
|
||||
alias gts='git tag -s' |
||||
|
||||
alias gunignore='git update-index --no-assume-unchanged' |
||||
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' |
||||
alias gup='git pull --rebase' |
||||
alias gupv='git pull --rebase -v' |
||||
|
||||
alias gvt='git verify-tag' |
||||
|
||||
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' |
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' |
||||
|
||||
@ -1,12 +1,12 @@ |
||||
function gi() { curl http://www.gitignore.io/api/$@ ;} |
||||
function gi() { curl -sL https://www.gitignore.io/api/$@ ;} |
||||
|
||||
_gitignireio_get_command_list() { |
||||
curl -s http://www.gitignore.io/api/list | tr "," "\n" |
||||
_gitignoreio_get_command_list() { |
||||
curl -sL https://www.gitignore.io/api/list | tr "," "\n" |
||||
} |
||||
|
||||
_gitignireio () { |
||||
_gitignoreio () { |
||||
compset -P '*,' |
||||
compadd -S '' `_gitignireio_get_command_list` |
||||
compadd -S '' `_gitignoreio_get_command_list` |
||||
} |
||||
|
||||
compdef _gitignireio gi |
||||
compdef _gitignoreio gi |
||||
|
||||
@ -0,0 +1,255 @@ |
||||
#compdef grunt |
||||
#autoload |
||||
# ----------------------------------------------------------------------------- |
||||
# _grunt |
||||
# |
||||
# Completion script for grunt. |
||||
# - https://github.com/gruntjs/grunt |
||||
# - https://github.com/gruntjs/grunt-cli |
||||
# |
||||
# ----------------------------------------------------------------------------- |
||||
# |
||||
# Version : 0.1.2 |
||||
# Author : Yonchu <yuyuchu3333@gmail.com> |
||||
# License : MIT License |
||||
# Repository : https://github.com/yonchu/grunt-zsh-completion |
||||
# Last Change : 20 Aug 2014. |
||||
# |
||||
# Copyright (c) 2013 Yonchu. |
||||
# |
||||
# ----------------------------------------------------------------------------- |
||||
# USAGE |
||||
# ----- |
||||
# |
||||
# Enable caching: |
||||
# |
||||
# If you want to use the cache, set the followings in your .zshrc: |
||||
# |
||||
# zstyle ':completion:*' use-cache yes |
||||
# |
||||
# |
||||
# Settings: |
||||
# |
||||
# - Show grunt file path: |
||||
# zstyle ':completion::complete:grunt::options:' show_grunt_path yes |
||||
# |
||||
# - Cache expiration days (default: 7): |
||||
# zstyle ':completion::complete:grunt::options:' expire 1 |
||||
# |
||||
# - Not update options cache if target gruntfile is changed. |
||||
# zstyle ':completion::complete:grunt::options:' no_update_options yes |
||||
# |
||||
# Note that if you change the zstyle settings, |
||||
# you should delete the cache file and restart zsh. |
||||
# |
||||
# $ rm ~/.zcompcache/grunt |
||||
# $ exec zsh |
||||
# |
||||
# ----------------------------------------------------------------------------- |
||||
|
||||
function __grunt() { |
||||
local curcontext="$curcontext" update_policy state |
||||
local show_grunt_path update_msg gruntfile opts tasks |
||||
|
||||
# Setup cache-policy. |
||||
zstyle -s ":completion:${curcontext}:" cache-policy update_policy |
||||
if [[ -z $update_policy ]]; then |
||||
zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy |
||||
fi |
||||
|
||||
# Check show_path option. |
||||
zstyle -b ":completion:${curcontext}:options:" show_grunt_path show_grunt_path |
||||
|
||||
# Get current gruntfile. |
||||
gruntfile=$(__grunt_get_gruntfile) |
||||
|
||||
# Initialize opts and tasks. |
||||
opts=() |
||||
tasks=() |
||||
|
||||
# Add help options. |
||||
opts+=('(- 1 *)'{-h,--help}'[Display this help text.]') |
||||
|
||||
## Complete without gruntfile. |
||||
if [[ ! -f $gruntfile ]]; then |
||||
_arguments "${opts[@]}" |
||||
return |
||||
fi |
||||
|
||||
## Complete with gruntfile. |
||||
# Retrieve cache. |
||||
if ! __grunt_update_cache "$gruntfile"; then |
||||
update_msg=' (cache updated)' |
||||
fi |
||||
|
||||
# Make optioins completion. |
||||
if [[ ${#__grunt_opts} -gt 0 ]]; then |
||||
opts+=("${__grunt_opts[@]}") |
||||
fi |
||||
|
||||
# Complete arguments. |
||||
_arguments \ |
||||
"${opts[@]}" \ |
||||
'*: :->tasks' \ |
||||
&& return |
||||
|
||||
case $state in |
||||
tasks) |
||||
if [[ $show_grunt_path == 'yes' ]]; then |
||||
update_msg="$update_msg: ${${gruntfile/#$HOME/~}%/}" |
||||
fi |
||||
# Make tasks completion. |
||||
if [[ ${#__grunt_tasks} -gt 0 ]]; then |
||||
tasks+=("${__grunt_tasks[@]}") |
||||
_describe -t grunt-task "$verbose grunt task$update_msg" tasks || return 1 |
||||
fi |
||||
;; |
||||
esac |
||||
|
||||
return 0 |
||||
} |
||||
|
||||
# Cache policy: |
||||
# The cache file name: grunt |
||||
# The cache variable name: __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks |
||||
function __grunt_update_cache() { |
||||
# TODO |
||||
local version='0.1.2' |
||||
local is_updating=0 |
||||
local gruntfile="$1" |
||||
local grunt_info no_update_options cache_path |
||||
|
||||
# Check no_update_options option. |
||||
zstyle -b ":completion:${curcontext}:options:" no_update_options no_update_options |
||||
|
||||
|
||||
if ! ( (( $+__grunt_gruntfile )) \ |
||||
&& (( $+__grunt_opts )) \ |
||||
&& (( $+__grunt_tasks )) ) \ |
||||
&& ! _retrieve_cache 'grunt'; then |
||||
is_updating=1 |
||||
fi |
||||
|
||||
if [[ $gruntfile != $__grunt_gruntfile ]]; then |
||||
# Except for --help options. |
||||
__grunt_gruntfile=$gruntfile |
||||
if [[ $no_update_options == 'yes' ]]; then |
||||
if [[ $PREFIX == ${PREFIX#-} ]]; then |
||||
# Not options completions. |
||||
is_updating=1 |
||||
elif [[ ${#__grunt_opts} -lt 2 ]]; then |
||||
is_updating=1 |
||||
else |
||||
unset __grunt_gruntfile |
||||
fi |
||||
else |
||||
is_updating=1 |
||||
fi |
||||
else |
||||
if [[ $PREFIX != ${PREFIX#-} && ${#__grunt_opts} -gt 1 ]]; then |
||||
unset __grunt_gruntfile |
||||
fi |
||||
fi |
||||
|
||||
if _cache_invalid 'grunt'; then |
||||
is_updating=1 |
||||
fi |
||||
|
||||
# Check _grunt version. |
||||
if [[ $__grunt_version != $version ]]; then |
||||
is_updating=1 |
||||
fi |
||||
|
||||
if [[ $is_updating -ne 0 ]]; then |
||||
# Update caceh. |
||||
__grunt_version=$version |
||||
__grunt_gruntfile=$gruntfile |
||||
is_updating=1 |
||||
grunt_info=$(grunt --help --no-color --gruntfile "$__grunt_gruntfile" 2>/dev/null) |
||||
__grunt_opts=(${(f)"$(__grunt_get_opts "$grunt_info")"}) |
||||
__grunt_tasks=(${(f)"$(__grunt_get_tasks "$grunt_info")"}) |
||||
_store_cache 'grunt' __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks |
||||
fi |
||||
return $is_updating |
||||
} |
||||
|
||||
function __grunt_get_tasks() { |
||||
echo -E "$1" \ |
||||
| grep 'Available tasks' -A 100 \ |
||||
| grep '^ ' \ |
||||
| sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' \ |
||||
| sed -e 's/:/\\:/g' \ |
||||
| sed -e 's/ /:/' |
||||
} |
||||
|
||||
function __grunt_get_opts() { |
||||
local opt_hunk opt_sep opt_num line opt |
||||
opt_hunk=$(echo -E "$1" \ |
||||
| grep 'Options$' -A 100 \ |
||||
| sed '1 d' \ |
||||
| sed -e 's/[[:blank:]]*$//' \ |
||||
) |
||||
|
||||
opt_sep=() |
||||
opt_hunk=(${(f)opt_hunk}) |
||||
opt_num=0 |
||||
for line in "$opt_hunk[@]"; do |
||||
opt=$(echo -E "$line" | sed -e 's/^[[:blank:]]*//') |
||||
if [[ $line == $opt ]]; then |
||||
break |
||||
fi |
||||
if [[ $opt != ${opt#-} ]]; then |
||||
# Start with - |
||||
(( opt_num++ )) |
||||
opt=$(echo -E "$opt" | sed 's/^\(\(--[^ ]*\)\(, \(-[^ ]*\)\)*\) */\2\\t\4\\\t/') |
||||
fi |
||||
opt_sep[$opt_num]=("${opt_sep[$opt_num]}${opt}") |
||||
done |
||||
|
||||
for line in "$opt_sep[@]"; do |
||||
opt=(${(s:\t:)line}) |
||||
if [[ ${opt[1]} == '--help' ]]; then |
||||
continue |
||||
fi |
||||
if [[ ${#opt} -eq 2 ]]; then |
||||
echo -E "(${opt[1]})${opt[1]}[${opt[2]}]" |
||||
else |
||||
echo -E "(${opt[1]},${opt[2]})${opt[1]}[${opt[3]}]" |
||||
echo -E "(${opt[1]},${opt[2]})${opt[2]}[${opt[3]}]" |
||||
fi |
||||
done |
||||
} |
||||
|
||||
function __grunt_get_gruntfile() { |
||||
local gruntfile |
||||
local curpath="$PWD" |
||||
while [ "$curpath" ]; do |
||||
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do |
||||
if [[ -e "$gruntfile" ]]; then |
||||
echo "$gruntfile" |
||||
return |
||||
fi |
||||
done |
||||
curpath=${curpath%/*} |
||||
done |
||||
return 1 |
||||
} |
||||
|
||||
function __grunt_caching_policy() { |
||||
# Returns status zero if the completions cache needs rebuilding. |
||||
|
||||
# Rebuild if .agignore more recent than cache. |
||||
if [[ -f $__grunt_gruntfile && $__grunt_gruntfile -nt $1 ]]; then |
||||
# Invalid cache because gruntfile is old. |
||||
return 0 |
||||
fi |
||||
|
||||
local -a oldp |
||||
local expire |
||||
zstyle -s ":completion:${curcontext}:options:" expire expire || expire=7 |
||||
# Rebuild if cache is more than $expire days. |
||||
oldp=( "$1"(Nm+$expire) ) |
||||
(( $#oldp )) |
||||
} |
||||
|
||||
compdef __grunt grunt |
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue