mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
This commit is contained in:
commit
4a3d543d51
169 changed files with 8811 additions and 1690 deletions
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
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 interface 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.
|
||||
__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.
|
||||
To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
|
@ -15,9 +15,9 @@ To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com
|
|||
__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)
|
||||
* This is commonly pre-installed. (`zsh --version` to confirm)
|
||||
* [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
|
||||
|
||||
|
|
@ -25,11 +25,15 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
|||
|
||||
#### via curl
|
||||
|
||||
`curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh`
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### via wget
|
||||
|
||||
`wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh`
|
||||
```shell
|
||||
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||
```
|
||||
|
||||
## Using Oh My Zsh
|
||||
|
||||
|
|
@ -43,7 +47,9 @@ If you spot a plugin (or several) that you would like to use with Oh My Zsh, you
|
|||
|
||||
For example, this line might begin to look like...
|
||||
|
||||
`plugins=(git bundler osx rake ruby)`
|
||||
```shell
|
||||
plugins=(git bundler osx rake ruby)
|
||||
```
|
||||
|
||||
#### Using Plugins
|
||||
|
||||
|
|
@ -51,7 +57,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
|
|||
|
||||
### Themes
|
||||
|
||||
We'll admit it. Early in the Oh My Zsh world... we may have gotten a far 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!
|
||||
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
|
||||
|
||||
|
|
@ -59,21 +65,37 @@ _Robby's theme is the default one. It's not the fanciest one. It's not the simpl
|
|||
|
||||
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:
|
||||
|
||||
`ZSH_THEME="robbyrussell"`
|
||||
```shell
|
||||
ZSH_THEME="robbyrussell"
|
||||
```
|
||||
|
||||
To use a different theme, simple change the value to match the name of your desired theme. For example:
|
||||
To use a different theme, simply change the value to match the name of your desired theme. For example:
|
||||
|
||||
`ZSH_THEME="agnoster"` (this is one of the fancy ones)
|
||||
```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).
|
||||
|
||||
If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
|
||||
|
||||
|
||||
```shell
|
||||
ZSH_THEME="random" # (...please let it be pie... please be some pie..)
|
||||
```
|
||||
|
||||
|
||||
## Advanced Topics
|
||||
|
||||
If you're the type that likes to get their hands dirty... these sections might resonate.
|
||||
If you're the type that likes to get their hands dirty, these sections might resonate.
|
||||
|
||||
### Advanced Installation
|
||||
|
||||
For those who want to install this manually and/or set custom paths.
|
||||
Some users may want to change the default path, or manually install Oh My Zsh.
|
||||
|
||||
#### Custom Directory
|
||||
|
||||
|
|
@ -81,27 +103,37 @@ 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:
|
||||
|
||||
`curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh`
|
||||
```shell
|
||||
export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
```
|
||||
|
||||
#### Manual Installation
|
||||
|
||||
##### 1. Clone the repository:
|
||||
|
||||
`git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh`
|
||||
```shell
|
||||
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
```
|
||||
|
||||
##### 2. *Optionally*, backup your existing @~/.zshrc@ file:
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
|
||||
|
||||
`cp ~/.zshrc ~/.zshrc.orig`
|
||||
```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.
|
||||
|
||||
`cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc`
|
||||
```shell
|
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
```
|
||||
|
||||
##### 4. Change your default shell
|
||||
|
||||
`chsh -s /bin/zsh`
|
||||
```shell
|
||||
chsh -s /bin/zsh
|
||||
```
|
||||
|
||||
##### 5. Initialize your new zsh configuration
|
||||
|
||||
|
|
@ -118,7 +150,7 @@ If you have any hiccups installing, here are a few common fixes.
|
|||
|
||||
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 `abcyzeae.plugin.zsh` file in the `custom/plugins/` directory and then enable this plugin.
|
||||
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/`.
|
||||
|
||||
|
|
@ -126,17 +158,23 @@ If you would like to override the functionality of a plugin distributed with Oh
|
|||
|
||||
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`:
|
||||
|
||||
`DISABLE_UPDATE_PROMPT=true`
|
||||
```shell
|
||||
DISABLE_UPDATE_PROMPT=true
|
||||
```
|
||||
|
||||
To disable automatic upgrades, set the following in your `~/.zshrc`:
|
||||
|
||||
`DISABLE_AUTO_UPDATE=true`
|
||||
```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:
|
||||
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:
|
||||
|
||||
`upgrade_oh_my_zsh`
|
||||
```shell
|
||||
upgrade_oh_my_zsh
|
||||
```
|
||||
|
||||
Magic!
|
||||
|
||||
|
|
@ -152,9 +190,9 @@ I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are man
|
|||
|
||||
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
|
||||
### Do NOT send us themes
|
||||
|
||||
We have (more than) enough themes for the time being. Please fork the project and add one in there – you can let people know how to grab it from there.
|
||||
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
|
||||
|
||||
|
|
@ -164,12 +202,12 @@ Thank you so much!
|
|||
|
||||
## Follow Us
|
||||
|
||||
We have an [ohmyzsh](https://twitter.com/ohmyzsh) account. You should follow it.
|
||||
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
|
||||
## License
|
||||
|
||||
Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt).
|
||||
|
|
|
|||
86
lib/clipboard.zsh
Normal file
86
lib/clipboard.zsh
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
# System clipboard integration
|
||||
#
|
||||
# This file has support for doing system clipboard copy and paste operations
|
||||
# from the command line in a generic cross-platform fashion.
|
||||
#
|
||||
# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
|
||||
# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
|
||||
# "system clipboard", and the X Windows `xclip` command must be installed.
|
||||
|
||||
# clipcopy - Copy data to clipboard
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# <command> | clipcopy - copies stdin to clipboard
|
||||
#
|
||||
# clipcopy <file> - copies a file's contents to clipboard
|
||||
#
|
||||
function clipcopy() {
|
||||
emulate -L zsh
|
||||
local file=$1
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
if [[ -z $file ]]; then
|
||||
pbcopy
|
||||
else
|
||||
cat $file | pbcopy
|
||||
fi
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
if [[ -z $file ]]; then
|
||||
cat > /dev/clipboard
|
||||
else
|
||||
cat $file > /dev/clipboard
|
||||
fi
|
||||
else
|
||||
if which xclip &>/dev/null; then
|
||||
if [[ -z $file ]]; then
|
||||
xclip -in -selection clipboard
|
||||
else
|
||||
xclip -in -selection clipboard $file
|
||||
fi
|
||||
elif which xsel &>/dev/null; then
|
||||
if [[ -z $file ]]; then
|
||||
xsel --clipboard --input
|
||||
else
|
||||
cat "$file" | xsel --clipboard --input
|
||||
fi
|
||||
else
|
||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# clippaste - "Paste" data from clipboard to stdout
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# clippaste - writes clipboard's contents to stdout
|
||||
#
|
||||
# clippaste | <command> - pastes contents and pipes it to another process
|
||||
#
|
||||
# clippaste > <file> - paste contents to a file
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# # Pipe to another process
|
||||
# clippaste | grep foo
|
||||
#
|
||||
# # Paste to a file
|
||||
# clippaste > file.txt
|
||||
function clippaste() {
|
||||
emulate -L zsh
|
||||
if [[ $OSTYPE == darwin* ]]; then
|
||||
pbpaste
|
||||
elif [[ $OSTYPE == cygwin* ]]; then
|
||||
cat /dev/clipboard
|
||||
else
|
||||
if which xclip &>/dev/null; then
|
||||
xclip -out -selection clipboard
|
||||
elif which xsel &>/dev/null; then
|
||||
xsel --clipboard --output
|
||||
else
|
||||
print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
60
lib/compfix.zsh
Normal file
60
lib/compfix.zsh
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Handle completions insecurities (i.e., completion-dependent directories with
|
||||
# insecure ownership or permissions) by:
|
||||
#
|
||||
# * Human-readably notifying the user of these insecurities.
|
||||
# * Moving away all existing completion caches to a temporary directory. Since
|
||||
# any of these caches may have been generated from insecure directories, they
|
||||
# are all suspect now. Failing to do so typically causes subsequent compinit()
|
||||
# calls to fail with "command not found: compdef" errors. (That's bad.)
|
||||
function handle_completion_insecurities() {
|
||||
# List of the absolute paths of all unique insecure directories, split on
|
||||
# newline from compaudit()'s output resembling:
|
||||
#
|
||||
# There are insecure directories:
|
||||
# /usr/share/zsh/site-functions
|
||||
# /usr/share/zsh/5.0.6/functions
|
||||
# /usr/share/zsh
|
||||
# /usr/share/zsh/5.0.6
|
||||
#
|
||||
# Since the ignorable first line is printed to stderr and thus not captured,
|
||||
# stderr is squelched to prevent this output from leaking to the user.
|
||||
local -aU insecure_dirs
|
||||
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
|
||||
|
||||
# If no such directories exist, get us out of here.
|
||||
if (( ! ${#insecure_dirs} )); then
|
||||
print "[oh-my-zsh] No insecure completion-dependent directories detected."
|
||||
return
|
||||
fi
|
||||
|
||||
# List ownership and permissions of all insecure directories.
|
||||
print "[oh-my-zsh] Insecure completion-dependent directories detected:"
|
||||
ls -ld "${(@)insecure_dirs}"
|
||||
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
|
||||
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
|
||||
print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
|
||||
|
||||
# Locally enable the "NULL_GLOB" option, thus removing unmatched filename
|
||||
# globs from argument lists *AND* printing no warning when doing so. Failing
|
||||
# to do so prints an unreadable warning if no completion caches exist below.
|
||||
setopt local_options null_glob
|
||||
|
||||
# List of the absolute paths of all unique existing completion caches.
|
||||
local -aU zcompdump_files
|
||||
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
|
||||
|
||||
# Move such caches to a temporary directory.
|
||||
if (( ${#zcompdump_files} )); then
|
||||
# Absolute path of the directory to which such files will be moved.
|
||||
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
|
||||
|
||||
# List such files first.
|
||||
print "[oh-my-zsh] Insecure completion caches also detected:"
|
||||
ls -l "${(@)zcompdump_files}"
|
||||
|
||||
# For safety, move rather than permanently remove such files.
|
||||
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
|
||||
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
|
||||
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
|
||||
fi
|
||||
}
|
||||
|
|
@ -15,7 +15,12 @@ if [ "x$CASE_SENSITIVE" = "xtrue" ]; then
|
|||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset CASE_SENSITIVE
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unset HYPHEN_INSENSITIVE
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
fi
|
||||
fi
|
||||
|
||||
zstyle ':completion:*' list-colors ''
|
||||
|
|
@ -53,9 +58,13 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
|
|||
# ... unless we really want to.
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
|
||||
if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||
expand-or-complete-with-dots() {
|
||||
echo -n "\e[31m......\e[0m"
|
||||
# toggle line-wrapping off and back on again
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
|
||||
print -Pn "%{%F{red}......%f%}"
|
||||
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
|
||||
|
||||
zle expand-or-complete
|
||||
zle redisplay
|
||||
}
|
||||
|
|
|
|||
353
lib/diagnostics.zsh
Normal file
353
lib/diagnostics.zsh
Normal file
|
|
@ -0,0 +1,353 @@
|
|||
# diagnostics.zsh
|
||||
#
|
||||
# Diagnostic and debugging support for oh-my-zsh
|
||||
|
||||
# omz_diagnostic_dump()
|
||||
#
|
||||
# Author: Andrew Janke <andrew@apjanke.net>
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# omz_diagnostic_dump [-v] [-V] [file]
|
||||
#
|
||||
# NOTE: This is a work in progress. Its interface and behavior are going to change,
|
||||
# and probably in non-back-compatible ways.
|
||||
#
|
||||
# Outputs a bunch of information about the state and configuration of
|
||||
# oh-my-zsh, zsh, and the user's system. This is intended to provide a
|
||||
# bunch of context for diagnosing your own or a third party's problems, and to
|
||||
# be suitable for posting to public bug reports.
|
||||
#
|
||||
# The output is human-readable and its format may change over time. It is not
|
||||
# suitable for parsing. All the output is in one single file so it can be posted
|
||||
# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs
|
||||
# or other files to bugs; otherwise, this would probably have an option to produce
|
||||
# tarballs that contain copies of the config and customization files instead of
|
||||
# catting them all in to one file.
|
||||
#
|
||||
# This is intended to be widely portable, and run anywhere that oh-my-zsh does.
|
||||
# Feel free to report any portability issues as bugs.
|
||||
#
|
||||
# This is written in a defensive style so it still works (and can detect) cases when
|
||||
# basic functionality like echo and which have been redefined. In particular, almost
|
||||
# everything is invoked with "builtin" or "command", to work in the face of user
|
||||
# redefinitions.
|
||||
#
|
||||
# OPTIONS
|
||||
#
|
||||
# [file] Specifies the output file. If not given, a file in the current directory
|
||||
# is selected automatically.
|
||||
#
|
||||
# -v Increase the verbosity of the dump output. May be specified multiple times.
|
||||
# Verbosity levels:
|
||||
# 0 - Basic info, shell state, omz configuration, git state
|
||||
# 1 - (default) Adds key binding info and configuration file contents
|
||||
# 2 - Adds zcompdump file contents
|
||||
#
|
||||
# -V Reduce the verbosity of the dump output. May be specified multiple times.
|
||||
#
|
||||
# TODO:
|
||||
# * Multi-file capture
|
||||
# * Add automatic gist uploading
|
||||
# * Consider whether to move default output file location to TMPDIR. More robust
|
||||
# but less user friendly.
|
||||
#
|
||||
|
||||
autoload -Uz is-at-least
|
||||
|
||||
function omz_diagnostic_dump() {
|
||||
emulate -L zsh
|
||||
|
||||
builtin echo "Generating diagnostic dump; please be patient..."
|
||||
|
||||
local thisfcn=omz_diagnostic_dump
|
||||
local -A opts
|
||||
local opt_verbose opt_noverbose opt_outfile
|
||||
local timestamp=$(date +%Y%m%d-%H%M%S)
|
||||
local outfile=omz_diagdump_$timestamp.txt
|
||||
builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose"
|
||||
local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose}
|
||||
(( verbose = 1 + n_verbose - n_noverbose ))
|
||||
|
||||
if [[ ${#*} > 0 ]]; then
|
||||
opt_outfile=$1
|
||||
fi
|
||||
if [[ ${#*} > 1 ]]; then
|
||||
builtin echo "$thisfcn: error: too many arguments" >&2
|
||||
return 1
|
||||
fi
|
||||
if [[ -n "$opt_outfile" ]]; then
|
||||
outfile="$opt_outfile"
|
||||
fi
|
||||
|
||||
# Always write directly to a file so terminal escape sequences are
|
||||
# captured cleanly
|
||||
_omz_diag_dump_one_big_text &> "$outfile"
|
||||
if [[ $? != 0 ]]; then
|
||||
builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details"
|
||||
fi
|
||||
|
||||
builtin echo
|
||||
builtin echo Diagnostic dump file created at: "$outfile"
|
||||
builtin echo
|
||||
builtin echo To share this with OMZ developers, post it as a gist on GitHub
|
||||
builtin echo at "https://gist.github.com" and share the link to the gist.
|
||||
builtin echo
|
||||
builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
|
||||
builtin echo "so don't share it publicly if there's sensitive information in them."
|
||||
builtin echo
|
||||
|
||||
}
|
||||
|
||||
function _omz_diag_dump_one_big_text() {
|
||||
local program programs progfile md5
|
||||
|
||||
builtin echo oh-my-zsh diagnostic dump
|
||||
builtin echo
|
||||
builtin echo $outfile
|
||||
builtin echo
|
||||
|
||||
# Basic system and zsh information
|
||||
command date
|
||||
command uname -a
|
||||
builtin echo OSTYPE=$OSTYPE
|
||||
builtin echo ZSH_VERSION=$ZSH_VERSION
|
||||
builtin echo User: $USER
|
||||
builtin echo umask: $(umask)
|
||||
builtin echo
|
||||
_omz_diag_dump_os_specific_version
|
||||
builtin echo
|
||||
|
||||
# Installed programs
|
||||
programs=(sh zsh ksh bash sed cat grep ls find git posh)
|
||||
local progfile="" extra_str="" sha_str=""
|
||||
for program in $programs; do
|
||||
extra_str="" sha_str=""
|
||||
progfile=$(builtin which $program)
|
||||
if [[ $? == 0 ]]; then
|
||||
if [[ -e $progfile ]]; then
|
||||
if builtin whence shasum &>/dev/null; then
|
||||
sha_str=($(command shasum $progfile))
|
||||
sha_str=$sha_str[1]
|
||||
extra_str+=" SHA $sha_str"
|
||||
fi
|
||||
if [[ -h "$progfile" ]]; then
|
||||
extra_str+=" ( -> ${progfile:A} )"
|
||||
fi
|
||||
fi
|
||||
builtin printf '%-9s %-20s %s\n' "$program is" "$progfile" "$extra_str"
|
||||
else
|
||||
builtin echo "$program: not found"
|
||||
fi
|
||||
done
|
||||
builtin echo
|
||||
builtin echo Command Versions:
|
||||
builtin echo "zsh: $(zsh --version)"
|
||||
builtin echo "this zsh session: $ZSH_VERSION"
|
||||
builtin echo "bash: $(bash --version | command grep bash)"
|
||||
builtin echo "git: $(git --version)"
|
||||
builtin echo "grep: $(grep --version)"
|
||||
builtin echo
|
||||
|
||||
# Core command definitions
|
||||
_omz_diag_dump_check_core_commands || return 1
|
||||
builtin echo
|
||||
|
||||
# ZSH Process state
|
||||
builtin echo Process state:
|
||||
builtin echo pwd: $PWD
|
||||
if builtin whence pstree &>/dev/null; then
|
||||
builtin echo Process tree for this shell:
|
||||
pstree -p $$
|
||||
else
|
||||
ps -fT
|
||||
fi
|
||||
builtin set | command grep -a '^\(ZSH\|plugins\|TERM\|LC_\|LANG\|precmd\|chpwd\|preexec\|FPATH\|TTY\|DISPLAY\|PATH\)\|OMZ'
|
||||
builtin echo
|
||||
#TODO: Should this include `env` instead of or in addition to `export`?
|
||||
builtin echo Exported:
|
||||
builtin echo $(builtin export | command sed 's/=.*//')
|
||||
builtin echo
|
||||
builtin echo Locale:
|
||||
command locale
|
||||
builtin echo
|
||||
|
||||
# Zsh installation and configuration
|
||||
builtin echo Zsh configuration:
|
||||
builtin echo setopt: $(builtin setopt)
|
||||
builtin echo
|
||||
builtin echo zstyle:
|
||||
builtin zstyle
|
||||
builtin echo
|
||||
builtin echo 'compaudit output:'
|
||||
compaudit
|
||||
builtin echo
|
||||
builtin echo '$fpath directories:'
|
||||
command ls -lad $fpath
|
||||
builtin echo
|
||||
|
||||
# Oh-my-zsh installation
|
||||
builtin echo oh-my-zsh installation:
|
||||
command ls -ld ~/.z*
|
||||
command ls -ld ~/.oh*
|
||||
builtin echo
|
||||
builtin echo oh-my-zsh git state:
|
||||
(cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
|
||||
if [[ $verbose -ge 1 ]]; then
|
||||
(cd $ZSH && git reflog --date=default | command grep pull)
|
||||
fi
|
||||
builtin echo
|
||||
if [[ -e $ZSH_CUSTOM ]]; then
|
||||
local custom_dir=$ZSH_CUSTOM
|
||||
if [[ -h $custom_dir ]]; then
|
||||
custom_dir=$(cd $custom_dir && pwd -P)
|
||||
fi
|
||||
builtin echo "oh-my-zsh custom dir:"
|
||||
builtin echo " $ZSH_CUSTOM ($custom_dir)"
|
||||
(cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
|
||||
builtin echo
|
||||
fi
|
||||
|
||||
# Key binding and terminal info
|
||||
if [[ $verbose -ge 1 ]]; then
|
||||
builtin echo "bindkey:"
|
||||
builtin bindkey
|
||||
builtin echo
|
||||
builtin echo "infocmp:"
|
||||
command infocmp -L
|
||||
builtin echo
|
||||
fi
|
||||
|
||||
# Configuration file info
|
||||
local zdotdir=${ZDOTDIR:-$HOME}
|
||||
builtin echo "Zsh configuration files:"
|
||||
local cfgfile cfgfiles
|
||||
# Some files for bash that zsh does not use are intentionally included
|
||||
# to help with diagnosing behavior differences between bash and zsh
|
||||
cfgfiles=( /etc/zshenv /etc/zprofile /etc/zshrc /etc/zlogin /etc/zlogout
|
||||
$zdotdir/.zshenv $zdotdir/.zprofile $zdotdir/.zshrc $zdotdir/.zlogin $zdotdir/.zlogout
|
||||
~/.zsh.pre-oh-my-zsh
|
||||
/etc/bashrc /etc/profile ~/.bashrc ~/.profile ~/.bash_profile ~/.bash_logout )
|
||||
command ls -lad $cfgfiles 2>&1
|
||||
builtin echo
|
||||
if [[ $verbose -ge 1 ]]; then
|
||||
for cfgfile in $cfgfiles; do
|
||||
_omz_diag_dump_echo_file_w_header $cfgfile
|
||||
done
|
||||
fi
|
||||
builtin echo
|
||||
builtin echo "Zsh compdump files:"
|
||||
local dumpfile dumpfiles
|
||||
command ls -lad $zdotdir/.zcompdump*
|
||||
dumpfiles=( $zdotdir/.zcompdump*(N) )
|
||||
if [[ $verbose -ge 2 ]]; then
|
||||
for dumpfile in $dumpfiles; do
|
||||
_omz_diag_dump_echo_file_w_header $dumpfile
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function _omz_diag_dump_check_core_commands() {
|
||||
builtin echo "Core command check:"
|
||||
local redefined name builtins externals reserved_words
|
||||
redefined=()
|
||||
# All the zsh non-module builtin commands
|
||||
# These are taken from the zsh reference manual for 5.0.2
|
||||
# Commands from modules should not be included.
|
||||
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||
# or at least made conditional on the version of the current running zsh.)
|
||||
# "history" is also excluded because OMZ is known to redefine that
|
||||
reserved_words=( do done esac then elif else fi for case if while function
|
||||
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||
)
|
||||
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||
comptry compvalues continue dirs disable disown echo echotc echoti emulate
|
||||
enable eval exec exit false fc fg functions getln getopts hash
|
||||
jobs kill let limit log logout noglob popd print printf
|
||||
pushd pushln pwd r read rehash return sched set setopt shift
|
||||
source suspend test times trap true ttyctl type ulimit umask unalias
|
||||
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
|
||||
zle zmodload zparseopts zregexparse zstyle )
|
||||
if is-at-least 5.1; then
|
||||
reserved_word+=( declare export integer float local readonly typeset )
|
||||
else
|
||||
builtins+=( declare export integer float local readonly typeset )
|
||||
fi
|
||||
builtins_fatal=( builtin command local )
|
||||
externals=( zsh )
|
||||
for name in $reserved_words; do
|
||||
if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then
|
||||
builtin echo "reserved word '$name' has been redefined"
|
||||
builtin which $name
|
||||
redefined+=$name
|
||||
fi
|
||||
done
|
||||
for name in $builtins; do
|
||||
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
|
||||
builtin echo "builtin '$name' has been redefined"
|
||||
builtin which $name
|
||||
redefined+=$name
|
||||
fi
|
||||
done
|
||||
for name in $externals; do
|
||||
if [[ $(builtin whence -w $name) != "$name: command" ]]; then
|
||||
builtin echo "command '$name' has been redefined"
|
||||
builtin which $name
|
||||
redefined+=$name
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -n "$redefined" ]]; then
|
||||
builtin echo "SOME CORE COMMANDS HAVE BEEN REDEFINED: $redefined"
|
||||
else
|
||||
builtin echo "All core commands are defined normally"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function _omz_diag_dump_echo_file_w_header() {
|
||||
local file=$1
|
||||
if [[ ( -f $file || -h $file ) ]]; then
|
||||
builtin echo "========== $file =========="
|
||||
if [[ -h $file ]]; then
|
||||
builtin echo "========== ( => ${file:A} ) =========="
|
||||
fi
|
||||
command cat $file
|
||||
builtin echo "========== end $file =========="
|
||||
builtin echo
|
||||
elif [[ -d $file ]]; then
|
||||
builtin echo "File '$file' is a directory"
|
||||
elif [[ ! -e $file ]]; then
|
||||
builtin echo "File '$file' does not exist"
|
||||
else
|
||||
command ls -lad "$file"
|
||||
fi
|
||||
}
|
||||
|
||||
function _omz_diag_dump_os_specific_version() {
|
||||
local osname osver version_file version_files
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
osname=$(command sw_vers -productName)
|
||||
osver=$(command sw_vers -productVersion)
|
||||
builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
|
||||
;;
|
||||
cygwin)
|
||||
command systeminfo | command head -4 | command tail -2
|
||||
;;
|
||||
esac
|
||||
|
||||
if builtin which lsb_release >/dev/null; then
|
||||
builtin echo "OS Release: $(command lsb_release -s -d)"
|
||||
fi
|
||||
|
||||
version_files=( /etc/*-release(N) /etc/*-version(N) /etc/*_version(N) )
|
||||
for version_file in $version_files; do
|
||||
builtin echo "$version_file:"
|
||||
command cat "$version_file"
|
||||
builtin echo
|
||||
done
|
||||
}
|
||||
|
||||
|
|
@ -15,6 +15,22 @@ function take() {
|
|||
cd $1
|
||||
}
|
||||
|
||||
function open_command() {
|
||||
local open_cmd
|
||||
|
||||
# define the open command
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd="open" ;;
|
||||
cygwin*) open_cmd="cygstart" ;;
|
||||
linux*) open_cmd="xdg-open" ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
nohup $open_cmd "$@" &>/dev/null
|
||||
}
|
||||
|
||||
#
|
||||
# Get the value of an alias.
|
||||
#
|
||||
|
|
@ -73,3 +89,135 @@ function env_default() {
|
|||
env | grep -q "^$1=" && return 0
|
||||
export "$1=$2" && return 3
|
||||
}
|
||||
|
||||
|
||||
# Required for $langinfo
|
||||
zmodload zsh/langinfo
|
||||
|
||||
# URL-encode a string
|
||||
#
|
||||
# Encodes a string using RFC 2396 URL-encoding (%-escaped).
|
||||
# See: https://www.ietf.org/rfc/rfc2396.txt
|
||||
#
|
||||
# By default, reserved characters and unreserved "mark" characters are
|
||||
# not escaped by this function. This allows the common usage of passing
|
||||
# an entire URL in, and encoding just special characters in it, with
|
||||
# the expectation that reserved and mark characters are used appropriately.
|
||||
# The -r and -m options turn on escaping of the reserved and mark characters,
|
||||
# respectively, which allows arbitrary strings to be fully escaped for
|
||||
# embedding inside URLs, where reserved characters might be misinterpreted.
|
||||
#
|
||||
# Prints the encoded string on stdout.
|
||||
# Returns nonzero if encoding failed.
|
||||
#
|
||||
# Usage:
|
||||
# omz_urlencode [-r] [-m] <string>
|
||||
#
|
||||
# -r causes reserved characters (;/?:@&=+$,) to be escaped
|
||||
#
|
||||
# -m causes "mark" characters (_.!~*''()-) to be escaped
|
||||
#
|
||||
# -P causes spaces to be encoded as '%20' instead of '+'
|
||||
function omz_urlencode() {
|
||||
emulate -L zsh
|
||||
zparseopts -D -E -a opts r m P
|
||||
|
||||
local in_str=$1
|
||||
local url_str=""
|
||||
local spaces_as_plus
|
||||
if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
|
||||
local str="$in_str"
|
||||
|
||||
# URLs must use UTF-8 encoding; convert str to UTF-8 if required
|
||||
local encoding=$langinfo[CODESET]
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
|
||||
str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from $encoding to UTF-8" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Use LC_CTYPE=C to process text byte-by-byte
|
||||
local i byte ord LC_ALL=C
|
||||
export LC_ALL
|
||||
local reserved=';/?:@&=+$,'
|
||||
local mark='_.!~*''()-'
|
||||
local dont_escape="[A-Za-z0-9"
|
||||
if [[ -z $opts[(r)-r] ]]; then
|
||||
dont_escape+=$reserved
|
||||
fi
|
||||
# $mark must be last because of the "-"
|
||||
if [[ -z $opts[(r)-m] ]]; then
|
||||
dont_escape+=$mark
|
||||
fi
|
||||
dont_escape+="]"
|
||||
|
||||
# Implemented to use a single printf call and avoid subshells in the loop,
|
||||
# for performance (primarily on Windows).
|
||||
local url_str=""
|
||||
for (( i = 1; i <= ${#str}; ++i )); do
|
||||
byte="$str[i]"
|
||||
if [[ "$byte" =~ "$dont_escape" ]]; then
|
||||
url_str+="$byte"
|
||||
else
|
||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||
url_str+="+"
|
||||
else
|
||||
ord=$(( [##16] #byte ))
|
||||
url_str+="%$ord"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo -E "$url_str"
|
||||
}
|
||||
|
||||
# URL-decode a string
|
||||
#
|
||||
# Decodes a RFC 2396 URL-encoded (%-escaped) string.
|
||||
# This decodes the '+' and '%' escapes in the input string, and leaves
|
||||
# other characters unchanged. Does not enforce that the input is a
|
||||
# valid URL-encoded string. This is a convenience to allow callers to
|
||||
# pass in a full URL or similar strings and decode them for human
|
||||
# presentation.
|
||||
#
|
||||
# Outputs the encoded string on stdout.
|
||||
# Returns nonzero if encoding failed.
|
||||
#
|
||||
# Usage:
|
||||
# omz_urldecode <urlstring> - prints decoded string followed by a newline
|
||||
function omz_urldecode {
|
||||
emulate -L zsh
|
||||
local encoded_url=$1
|
||||
|
||||
# Work bytewise, since URLs escape UTF-8 octets
|
||||
local caller_encoding=$langinfo[CODESET]
|
||||
local LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
# Change + back to ' '
|
||||
local tmp=${encoded_url:gs/+/ /}
|
||||
# Protect other escapes to pass through the printf unchanged
|
||||
tmp=${tmp:gs/\\/\\\\/}
|
||||
# Handle %-escapes by turning them into `\xXX` printf escapes
|
||||
tmp=${tmp:gs/%/\\x/}
|
||||
local decoded
|
||||
eval "decoded=\$'$tmp'"
|
||||
|
||||
# Now we have a UTF-8 encoded string in the variable. We need to re-encode
|
||||
# it if caller is in a non-UTF-8 locale.
|
||||
local safe_encodings
|
||||
safe_encodings=(UTF-8 utf8 US-ASCII)
|
||||
if [[ -z ${safe_encodings[(r)$caller_encoding]} ]]; then
|
||||
decoded=$(echo -E "$decoded" | iconv -f UTF-8 -t $caller_encoding)
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Error converting string from UTF-8 to $caller_encoding" >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -E "$decoded"
|
||||
}
|
||||
|
||||
|
|
|
|||
51
lib/git.zsh
51
lib/git.zsh
|
|
@ -36,24 +36,30 @@ git_remote_status() {
|
|||
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
|
||||
|
||||
if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
|
||||
if [ $ahead -eq 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
|
||||
elif [ $behind -gt 0 ] && [ $ahead -eq 0 ]
|
||||
then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
|
||||
then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
|
||||
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks if there are commits ahead from remote
|
||||
function git_prompt_ahead() {
|
||||
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]
|
||||
then
|
||||
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
|
||||
fi
|
||||
|
||||
echo $git_remote_status
|
||||
fi
|
||||
}
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
|
|
@ -64,6 +70,29 @@ function git_commits_ahead() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is ahead of remote
|
||||
function git_prompt_ahead() {
|
||||
if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch is behind remote
|
||||
function git_prompt_behind() {
|
||||
if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
|
||||
fi
|
||||
}
|
||||
|
||||
# Outputs if current branch exists on remote or not
|
||||
function git_prompt_remote() {
|
||||
if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
|
||||
fi
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_sha() {
|
||||
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ if grep-flag-available --color=auto; then
|
|||
fi
|
||||
|
||||
# ignore VCS folders (if the necessary grep flags are available)
|
||||
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
|
||||
VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
|
||||
|
||||
if grep-flag-available --exclude-dir=.cvs; then
|
||||
GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
|
||||
|
|
|
|||
28
lib/misc.zsh
28
lib/misc.zsh
|
|
@ -1,6 +1,19 @@
|
|||
## smart urls
|
||||
autoload -U url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
## Load smart urls if available
|
||||
# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
|
||||
autoload -Uz is-at-least
|
||||
if [[ $ZSH_VERSION != 5.1.1 ]]; then
|
||||
for d in $fpath; do
|
||||
if [[ -e "$d/url-quote-magic" ]]; then
|
||||
if is-at-least 5.1; then
|
||||
autoload -Uz bracketed-paste-magic
|
||||
zle -N bracketed-paste bracketed-paste-magic
|
||||
fi
|
||||
autoload -Uz url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
## jobs
|
||||
setopt long_list_jobs
|
||||
|
|
@ -14,9 +27,16 @@ alias _='sudo'
|
|||
alias please='sudo'
|
||||
|
||||
## more intelligent acking for ubuntu users
|
||||
alias afind='ack-grep -il'
|
||||
if which ack-grep &> /dev/null; then
|
||||
alias afind='ack-grep -il'
|
||||
else
|
||||
alias afind='ack -il'
|
||||
fi
|
||||
|
||||
# only define LC_CTYPE if undefined
|
||||
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
|
||||
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
|
||||
fi
|
||||
|
||||
# recognize comments
|
||||
setopt interactivecomments
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
# (In screen, only short_tab_title is used)
|
||||
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
|
||||
function title {
|
||||
emulate -L zsh
|
||||
setopt prompt_subst
|
||||
|
||||
[[ "$EMACS" == *term* ]] && return
|
||||
|
||||
# if $2 is unset use $1 as default
|
||||
|
|
@ -23,9 +26,14 @@ function title {
|
|||
|
||||
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
|
||||
|
||||
# Runs before showing the prompt
|
||||
function omz_termsupport_precmd {
|
||||
emulate -L zsh
|
||||
if [[ $DISABLE_AUTO_TITLE == true ]]; then
|
||||
return
|
||||
fi
|
||||
|
|
@ -35,15 +43,15 @@ function omz_termsupport_precmd {
|
|||
|
||||
# Runs before executing the command
|
||||
function omz_termsupport_preexec {
|
||||
emulate -L zsh
|
||||
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%<<'
|
||||
|
|
@ -53,14 +61,28 @@ 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
|
||||
}
|
||||
# Keep Apple Terminal.app's current working directory updated
|
||||
# Based on this answer: http://superuser.com/a/315029
|
||||
# With extra fixes to handle multibyte chars and non-UTF-8 locales
|
||||
|
||||
precmd_functions+=(omz_termsupport_cwd)
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
|
||||
# Emits the control sequence to notify Terminal.app of the cwd
|
||||
function update_terminalapp_cwd() {
|
||||
emulate -L zsh
|
||||
# Identify the directory using a "file:" scheme URL, including
|
||||
# the host name to disambiguate local vs. remote paths.
|
||||
|
||||
# Percent-encode the pathname.
|
||||
local URL_PATH=$(omz_urlencode -P $PWD)
|
||||
[[ $? != 0 ]] && return 1
|
||||
local PWD_URL="file://$HOST$URL_PATH"
|
||||
# Undocumented Terminal.app-specific control sequence
|
||||
printf '\e]7;%s\a' $PWD_URL
|
||||
}
|
||||
|
||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||
precmd_functions+=(update_terminalapp_cwd)
|
||||
# Run once to get initial cwd set
|
||||
update_terminalapp_cwd
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,8 +11,11 @@ then
|
|||
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
|
||||
# On OpenBSD, test if "colorls" is installed (this one supports colors);
|
||||
# otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
|
||||
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
|
||||
# with color and multibyte support) are available from ports. "colorls"
|
||||
# will be installed on purpose and can't be pulled in by installing
|
||||
# coreutils, so prefer it to "gls".
|
||||
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
|
||||
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
|
||||
else
|
||||
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
|
||||
|
|
|
|||
22
oh-my-zsh.sh
22
oh-my-zsh.sh
|
|
@ -8,13 +8,18 @@ fi
|
|||
# add a function path
|
||||
fpath=($ZSH/functions $ZSH/completions $fpath)
|
||||
|
||||
# Load all stock functions (from $fpath files) called below.
|
||||
autoload -U compaudit compinit
|
||||
|
||||
: ${ZSH_DISABLE_COMPFIX:=true}
|
||||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||
ZSH_CUSTOM="$ZSH/custom"
|
||||
fi
|
||||
|
||||
# Set ZSH_CACHE_DIR to the path where cache files sould be created
|
||||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache/"
|
||||
|
|
@ -59,9 +64,18 @@ if [ -z "$ZSH_COMPDUMP" ]; then
|
|||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
# Load and run compinit
|
||||
autoload -U compinit
|
||||
compinit -i -d "${ZSH_COMPDUMP}"
|
||||
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
|
||||
# If completion insecurities exist, warn the user without enabling completions.
|
||||
if ! compaudit &>/dev/null; then
|
||||
# This function resides in the "lib/compfix.zsh" script sourced above.
|
||||
handle_completion_insecurities
|
||||
# Else, enable and cache completions to the desired file.
|
||||
else
|
||||
compinit -d "${ZSH_COMPDUMP}"
|
||||
fi
|
||||
else
|
||||
compinit -i -d "${ZSH_COMPDUMP}"
|
||||
fi
|
||||
|
||||
# Load all of the plugins that were defined in ~/.zshrc
|
||||
for plugin ($plugins); do
|
||||
|
|
|
|||
|
|
@ -16,14 +16,22 @@ _1st_arguments=(
|
|||
'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'
|
||||
'logcat:View device log'
|
||||
'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)'
|
||||
‘tcpip:restart host adb in tcpip mode’
|
||||
'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
|
||||
|
|
|
|||
19
plugins/apache2-macports/README.md
Normal file
19
plugins/apache2-macports/README.md
Normal file
|
|
@ -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)
|
||||
|
||||
---
|
||||
64
plugins/archlinux/README.md
Normal file
64
plugins/archlinux/README.md
Normal file
|
|
@ -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
|
||||
|
||||
---
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
|
||||
|
||||
# Look for yaourt, and add some useful functions if we have it.
|
||||
if [[ -x `which yaourt` ]]; then
|
||||
if [[ -x `command -v yaourt` ]]; then
|
||||
upgrade () {
|
||||
yaourt -Syu
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ if [[ -x `which yaourt` ]]; then
|
|||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
if [[ -x `which abs` && -x `which aur` ]]; then
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `which abs` ]]; then
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which aur` ]]; then
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
|
|
@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
|
|||
alias pacloc='pacman -Qi' # Display information about a given package in the local database
|
||||
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||
# Additional pacman alias examples
|
||||
if [[ -x `which abs` && -x `which aur` ]]; then
|
||||
if [[ -x `command -v abs` && -x `command -v aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif [[ -x `which abs` ]]; then
|
||||
elif [[ -x `command -v abs` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which aur` ]]; then
|
||||
elif [[ -x `command -v aur` ]]; then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
local _atom_paths > /dev/null 2>&1
|
||||
_atom_paths=(
|
||||
"$HOME/Applications/Atom.app"
|
||||
"/Applications/Atom.app"
|
||||
)
|
||||
|
||||
for _atom_path in $_atom_paths; do
|
||||
if [[ -a $_atom_path ]]; then
|
||||
alias at="open -a '$_atom_path'"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
alias att='at .'
|
||||
|
|
@ -1,12 +1,26 @@
|
|||
# Activates autoenv or reports its failure
|
||||
if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then
|
||||
echo '-------- AUTOENV ---------'
|
||||
echo 'Could not find ~/.autoenv/activate.sh.'
|
||||
echo 'Please check if autoenv is correctly installed.'
|
||||
echo 'In the meantime the autoenv plugin is DISABLED.'
|
||||
echo '--------------------------'
|
||||
return 1
|
||||
() {
|
||||
if ! type autoenv_init >/dev/null; then
|
||||
for d (~/.autoenv /usr/local/opt/autoenv); do
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
cat <<END >&2
|
||||
-------- AUTOENV ---------
|
||||
Could not locate autoenv installation.
|
||||
Please check if autoenv is correctly installed.
|
||||
In the meantime the autoenv plugin is DISABLED.
|
||||
--------------------------
|
||||
END
|
||||
return 1
|
||||
fi
|
||||
source $autoenv_dir/activate.sh
|
||||
fi
|
||||
}
|
||||
[[ $? != 0 ]] && return $?
|
||||
|
||||
# The use_env call below is a reusable command to activate/create a new Python
|
||||
# virtualenv, requiring only a single declarative line of code in your .env files.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed
|
|||
. /usr/local/share/autojump/autojump.zsh
|
||||
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
|
||||
. /opt/local/etc/profile.d/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.zsh
|
||||
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
|
||||
. `brew --prefix`/etc/autojump.sh
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,10 +11,16 @@ export AWS_HOME=~/.aws
|
|||
function agp {
|
||||
echo $AWS_DEFAULT_PROFILE
|
||||
}
|
||||
|
||||
function asp {
|
||||
local rprompt=${RPROMPT/<aws:$(agp)>/}
|
||||
|
||||
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/'))
|
||||
}
|
||||
|
|
@ -22,7 +28,7 @@ function aws_profiles {
|
|||
compctl -K aws_profiles asp
|
||||
|
||||
if _homebrew-installed && _awscli-homebrew-installed ; then
|
||||
_aws_zsh_completer_path=$(brew --prefix)/opt/awscli/libexec/bin/aws_zsh_completer.sh
|
||||
_aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh
|
||||
else
|
||||
_aws_zsh_completer_path=$(which aws_zsh_completer.sh)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -11,31 +11,38 @@ autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return }
|
|||
|
||||
## 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"
|
||||
if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override
|
||||
function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds)
|
||||
elapsed="$(( $3 % 60 ))s"
|
||||
(( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
[ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$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 }'
|
||||
elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu!
|
||||
xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0"
|
||||
else
|
||||
echo $EPOCHSECONDS #fallback for windows
|
||||
fi
|
||||
}
|
||||
|
||||
bgnotify () {
|
||||
bgnotify () { ## args: (title, subtitle)
|
||||
if hash terminal-notifier 2>/dev/null; then #osx
|
||||
terminal-notifier -message "$2" -title "$1"
|
||||
[[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
|
||||
[[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal';
|
||||
## now call terminal-notifier, (hopefully with $term_id!)
|
||||
[ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null ||
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
|
||||
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
|
||||
growlnotify -m "$1" "$2"
|
||||
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
||||
notify-send "$1" "$2"
|
||||
elif hash kdialog 2>/dev/null; then #ubuntu kde!
|
||||
kdialog -title "$1" --passivepopup "$2" 5
|
||||
elif hash notifu 2>/dev/null; then #cygwyn support!
|
||||
notifu /m "$2" /p "$1"
|
||||
fi
|
||||
|
|
@ -46,7 +53,7 @@ bgnotify () {
|
|||
|
||||
bgnotify_begin() {
|
||||
bgnotify_timestamp=$EPOCHSECONDS
|
||||
bgnotify_lastcmd=$1
|
||||
bgnotify_lastcmd="$1"
|
||||
bgnotify_windowid=$(currentWindowId)
|
||||
}
|
||||
|
||||
|
|
@ -63,5 +70,8 @@ bgnotify_end() {
|
|||
bgnotify_timestamp=0 #reset it to 0!
|
||||
}
|
||||
|
||||
add-zsh-hook preexec bgnotify_begin
|
||||
add-zsh-hook precmd bgnotify_end
|
||||
## only enable if a local (non-ssh) connection
|
||||
if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
|
||||
add-zsh-hook preexec bgnotify_begin
|
||||
add-zsh-hook precmd bgnotify_end
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -35,11 +35,14 @@ _1st_arguments=(
|
|||
|
||||
_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.]' \
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ _1st_arguments=(
|
|||
'info:information about a formula'
|
||||
'install:install a formula'
|
||||
'reinstall:install a formula anew; re-using its current options'
|
||||
'leaves:show installed formulae that are not dependencies of another installed formula'
|
||||
'link:link a formula'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
|
|||
|
||||
## Excluded gems
|
||||
|
||||
These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
|
||||
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`
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ alias bp="bundle package"
|
|||
alias bo="bundle open"
|
||||
alias bu="bundle update"
|
||||
alias bi="bundle_install"
|
||||
alias bcn="bundle clean"
|
||||
|
||||
<<<<<<< HEAD
|
||||
# The following is based on https://github.com/gma/bundler-exec
|
||||
|
|
|
|||
|
|
@ -1,10 +1,49 @@
|
|||
#compdef cap
|
||||
#compdef shipit
|
||||
#autoload
|
||||
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then
|
||||
if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
|
||||
echo "\nGenerating .cap_tasks~..." > /dev/stderr
|
||||
cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
|
||||
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local -a _configs
|
||||
|
||||
_arguments -C \
|
||||
'1: :->cmds' \
|
||||
'2:: :->args' && ret=0
|
||||
|
||||
_cap_tasks() {
|
||||
if [[ -f config/deploy.rb || -f Capfile ]]; then
|
||||
if [[ ! -f .cap_tasks~ ]]; then
|
||||
shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
|
||||
fi
|
||||
|
||||
OLD_IFS=$IFS
|
||||
IFS=$'\n'
|
||||
_values 'cap commands' $(< .cap_tasks~)
|
||||
IFS=$OLD_IFS
|
||||
# zmodload zsh/mapfile
|
||||
# _values ${(f)mapfile[.cap_tasks~]}
|
||||
fi
|
||||
compadd `cat .cap_tasks~`
|
||||
fi
|
||||
}
|
||||
|
||||
_cap_stages() {
|
||||
compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g)
|
||||
}
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
# check if it uses multistage
|
||||
if [[ -d config/deploy ]]; then
|
||||
_cap_stages
|
||||
else
|
||||
_cap_tasks
|
||||
fi
|
||||
ret=0
|
||||
;;
|
||||
args)
|
||||
_cap_tasks
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
|
|
|
|||
11
plugins/capistrano/capistrano.plugin.zsh
Normal file
11
plugins/capistrano/capistrano.plugin.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
|
||||
# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
|
||||
|
||||
func shipit() {
|
||||
if [ -f Gemfile ]
|
||||
then
|
||||
bundle exec cap $*
|
||||
else
|
||||
cap $*
|
||||
fi
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ _homebrew-installed() {
|
|||
}
|
||||
|
||||
_chruby-from-homebrew-installed() {
|
||||
[ -r $(brew --prefix chruby)] &> /dev/null
|
||||
[ -r $(brew --prefix chruby) ] &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-build_installed() {
|
||||
|
|
@ -45,11 +45,11 @@ _source_from_omz_settings() {
|
|||
zstyle -s :omz:plugins:chruby path _chruby_path
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto
|
||||
|
||||
if ${_chruby_path} && [[ -r ${_chruby_path} ]]; then
|
||||
if [[ -r ${_chruby_path} ]]; then
|
||||
source ${_chruby_path}
|
||||
fi
|
||||
|
||||
if ${_chruby_auto} && [[ -r ${_chruby_auto} ]]; then
|
||||
if [[ -r ${_chruby_auto} ]]; then
|
||||
source ${_chruby_auto}
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,28 @@
|
|||
if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then
|
||||
strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat
|
||||
# chucknorris: Chuck Norris fortunes
|
||||
|
||||
# Automatically generate or update Chuck's compiled fortune data file
|
||||
# $0 must be used outside a local function. This variable name is unlikly to collide.
|
||||
CHUCKNORRIS_PLUGIN_DIR=${0:h}
|
||||
|
||||
() {
|
||||
local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes
|
||||
if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then
|
||||
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
|
||||
local strfile=strfile
|
||||
if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then
|
||||
strfile=/usr/sbin/strfile
|
||||
fi
|
||||
if which $strfile &> /dev/null; then
|
||||
$strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null
|
||||
else
|
||||
echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
|
||||
echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes"
|
||||
# Aliases
|
||||
alias chuck="fortune -a $DIR"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
}
|
||||
|
||||
unset CHUCKNORRIS_PLUGIN_DIR
|
||||
|
|
|
|||
|
|
@ -17,9 +17,11 @@ Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only wit
|
|||
Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
|
||||
%
|
||||
In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten.
|
||||
%
|
||||
There is no chin behind Chuck Norris' beard. There is only another fist.
|
||||
%
|
||||
Chuck Norris does not teabag the ladies. He potato-sacks them.
|
||||
%
|
||||
Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
|
||||
%
|
||||
When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.
|
||||
|
|
@ -127,6 +129,7 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds.
|
|||
Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
|
||||
%
|
||||
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
|
||||
%
|
||||
The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
|
||||
%
|
||||
It takes Chuck Norris 20 minutes to watch 60 Minutes.
|
||||
|
|
@ -281,6 +284,7 @@ In a recent survey it was discovered the 94% of American women lost their virgin
|
|||
Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat.
|
||||
%
|
||||
If at first you don't succeed, you're not Chuck Norris.
|
||||
%
|
||||
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
|
||||
%
|
||||
Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris."
|
||||
|
|
@ -349,7 +353,7 @@ As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck
|
|||
%
|
||||
Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
|
||||
%
|
||||
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.
|
||||
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
|
||||
%
|
||||
Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
|
||||
%
|
||||
|
|
@ -497,7 +501,8 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been
|
|||
%
|
||||
Chuck Norris can skeletize a cow in two minutes.
|
||||
%
|
||||
The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||
The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||
%
|
||||
Chuck Norris' first job was as a paperboy. There were no survivors.
|
||||
%
|
||||
With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
|
||||
|
|
@ -527,8 +532,6 @@ Chuck Norris uses 8'x10' sheets of plywood as toilet paper.
|
|||
Noah was the only man notified before Chuck Norris relieved himself in the Atlantic Ocean.
|
||||
%
|
||||
Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver.
|
||||
%
|
||||
|
||||
%
|
||||
MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
|
||||
%
|
||||
|
|
|
|||
82
plugins/codeclimate/_codeclimate
Normal file
82
plugins/codeclimate/_codeclimate
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#compdef codeclimate
|
||||
|
||||
_codeclimate_all_engines() {
|
||||
engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`)
|
||||
}
|
||||
|
||||
_codeclimate_installed_engines() {
|
||||
_codeclimate_all_engines
|
||||
|
||||
engines_installed=()
|
||||
|
||||
if [ -e .codeclimate.yml ]
|
||||
then
|
||||
for engine in $engines_all
|
||||
do
|
||||
if grep -q $engine ".codeclimate.yml"
|
||||
then
|
||||
engines_installed+=$engine
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_codeclimate_not_installed_engines() {
|
||||
_codeclimate_all_engines
|
||||
|
||||
engines_not_installed=()
|
||||
|
||||
if [ -e .codeclimate.yml ]
|
||||
then
|
||||
for engine in $engines_all
|
||||
do
|
||||
if ! grep -q $engine ".codeclimate.yml"
|
||||
then
|
||||
engines_not_installed+=$engine
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
local curcontext="$curcontext" state line ret=1
|
||||
local expl
|
||||
local -a engines_all engines_installed engines_not_installed
|
||||
|
||||
_arguments \
|
||||
'1: :->cmds' \
|
||||
'*:: :->args' && ret=0
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_values "bundle command" \
|
||||
"analyze[Analyze all relevant files in the current working directory]" \
|
||||
"console[Start an interactive session providing access to the classes within the CLI]" \
|
||||
"engines\:disable[Prevents the engine from being used in this project]" \
|
||||
"engines\:enable[This engine will be run the next time your project is analyzed]" \
|
||||
"engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \
|
||||
"engines\:list[Lists all available engines in the Code Climate Docker Hub]" \
|
||||
"engines\:remove[Removes an engine from your .codeclimate.yml file]" \
|
||||
"help[Displays a list of commands that can be passed to the Code Climate CLI]" \
|
||||
"init[Generates a new .codeclimate.yml file in the current working directory]" \
|
||||
"validate-config[Validates the .codeclimate.yml file in the current working directory]" \
|
||||
"version[Displays the current version of the Code Climate CLI]"
|
||||
ret=0
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
engines:enable)
|
||||
_codeclimate_not_installed_engines
|
||||
_wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;;
|
||||
engines:disable|engines:remove)
|
||||
_codeclimate_installed_engines
|
||||
_wanted engines_installed expl 'installed engines' compadd -a engines_installed ;;
|
||||
analyze)
|
||||
_arguments \
|
||||
'-f:Output Format:(text json)'
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
31
plugins/coffee/README.md
Normal file
31
plugins/coffee/README.md
Normal file
|
|
@ -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 b 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.
|
||||
16
plugins/coffee/coffee.plugin.zsh
Normal file
16
plugins/coffee/coffee.plugin.zsh
Normal file
|
|
@ -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" | clipcopy
|
||||
}
|
||||
|
||||
# compile from clipboard & print
|
||||
alias cfp='cf "$(clippaste)"'
|
||||
|
||||
# compile from clipboard and copy to clipboard
|
||||
alias cfpc='cfp | clipcopy'
|
||||
|
|
@ -13,7 +13,7 @@ alias lS='ls -1FSsh'
|
|||
alias lart='ls -1Fcart'
|
||||
alias lrt='ls -1Fcrt'
|
||||
|
||||
alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file
|
||||
alias zshrc='$EDITOR ~/.zshrc' # Quick access to the ~/.zshrc file
|
||||
|
||||
alias grep='grep --color'
|
||||
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# Copies the pathname of the current directory to the system or X Windows clipboard
|
||||
function copydir {
|
||||
pwd | tr -d "\r\n" | pbcopy
|
||||
}
|
||||
emulate -L zsh
|
||||
print -n $PWD | clipcopy
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# Copies the contents of a given file to the system or X Windows clipboard
|
||||
#
|
||||
# copyfile <file>
|
||||
function copyfile {
|
||||
[[ "$#" != 1 ]] && return 1
|
||||
local file_to_copy=$1
|
||||
cat $file_to_copy | pbcopy
|
||||
emulate -L zsh
|
||||
clipcopy $1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@
|
|||
# You can just set apt_pref='apt-get' to override it.
|
||||
if [[ -e $( which -p aptitude 2>&1 ) ]]; then
|
||||
apt_pref='aptitude'
|
||||
apt_upgr='safe-upgrade'
|
||||
else
|
||||
apt_pref='apt-get'
|
||||
apt_upgr='upgrade'
|
||||
fi
|
||||
|
||||
# Use sudo by default if it's installed
|
||||
|
|
@ -45,10 +47,10 @@ if [[ $use_sudo -eq 1 ]]; then
|
|||
alias abd='sudo $apt_pref build-dep'
|
||||
alias ac='sudo $apt_pref clean'
|
||||
alias ad='sudo $apt_pref update'
|
||||
alias adg='sudo $apt_pref update && sudo $apt_pref upgrade'
|
||||
alias adg='sudo $apt_pref update && sudo $apt_pref $apt_upgr'
|
||||
alias adu='sudo $apt_pref update && sudo $apt_pref dist-upgrade'
|
||||
alias afu='sudo apt-file update'
|
||||
alias ag='sudo $apt_pref upgrade'
|
||||
alias ag='sudo $apt_pref $apt_upgr'
|
||||
alias ai='sudo $apt_pref install'
|
||||
# Install all packages given on the command line while using only the first word of each line:
|
||||
# acs ... | ail
|
||||
|
|
@ -80,10 +82,10 @@ else
|
|||
}
|
||||
alias ac='su -ls \'$apt_pref clean\' root'
|
||||
alias ad='su -lc \'$apt_pref update\' root'
|
||||
alias adg='su -lc \'$apt_pref update && aptitude safe-upgrade\' root'
|
||||
alias adg='su -lc \'$apt_pref update && aptitude $apt_upgr\' root'
|
||||
alias adu='su -lc \'$apt_pref update && aptitude dist-upgrade\' root'
|
||||
alias afu='su -lc "apt-file update"'
|
||||
alias ag='su -lc \'$apt_pref safe-upgrade\' root'
|
||||
alias ag='su -lc \'$apt_pref $apt_upgr\' root'
|
||||
ai() {
|
||||
cmd="su -lc 'aptitude -P install $@' root"
|
||||
print "$cmd"
|
||||
|
|
@ -136,7 +138,7 @@ apt_pref_compdef abd "build-dep"
|
|||
apt_pref_compdef ac "clean"
|
||||
apt_pref_compdef ad "update"
|
||||
apt_pref_compdef afu "update"
|
||||
apt_pref_compdef ag "upgrade"
|
||||
apt_pref_compdef ag "$apt_upgr"
|
||||
apt_pref_compdef ai "install"
|
||||
apt_pref_compdef ail "install"
|
||||
apt_pref_compdef ap "purge"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ function push_future() {
|
|||
}
|
||||
|
||||
# Called by zsh when directory changes
|
||||
function chpwd() {
|
||||
chpwd_functions+=(chpwd_dirhistory)
|
||||
function chpwd_dirhistory() {
|
||||
push_past $PWD
|
||||
# If DIRHISTORY_CD is not set...
|
||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ if [[ -f ${dirstack_file} ]] && [[ ${#dirstack[*]} -eq 0 ]] ; then
|
|||
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
|
||||
fi
|
||||
|
||||
chpwd() {
|
||||
chpwd_functions+=(chpwd_dirpersist)
|
||||
chpwd_dirpersist() {
|
||||
if (( $DIRSTACKSIZE <= 0 )) || [[ -z $dirstack_file ]]; then return; fi
|
||||
local -ax my_stack
|
||||
my_stack=( ${PWD} ${dirstack} )
|
||||
|
|
|
|||
5
plugins/docker-compose/README.md
Normal file
5
plugins/docker-compose/README.md
Normal file
|
|
@ -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]
|
||||
308
plugins/docker-compose/_docker-compose
Normal file
308
plugins/docker-compose/_docker-compose
Normal file
|
|
@ -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 "$@"
|
||||
|
|
@ -27,7 +27,7 @@ __docker_all_containers() {
|
|||
# output a selectable list of all docker images
|
||||
__docker_images() {
|
||||
declare -a img_cmd
|
||||
img_cmd=($(docker images | awk 'NR>1{print $1}'))
|
||||
img_cmd=($(docker images | awk 'NR>1{print $1}'| sed 's/:/\\:/g'))
|
||||
_describe 'images' img_cmd
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ __docker_images() {
|
|||
# ---------------------------
|
||||
__attach() {
|
||||
_arguments \
|
||||
'--no-stdin[Do not attach stdin]' \
|
||||
'--no-stdin[Do not attach STDIN]' \
|
||||
'--sig-proxy[Proxify all received signal to the process (even in non-tty mode)]'
|
||||
__docker_containers
|
||||
}
|
||||
|
|
@ -52,16 +52,59 @@ __build() {
|
|||
|
||||
__commit() {
|
||||
_arguments \
|
||||
'(-a,--author=)'{-a,--author=}'[Author (eg. "John Hannibal Smith <hannibal@a-team.com>"]' \
|
||||
'(-a,--author=)'{-a,--author=}'[Author (e.g. "John Hannibal Smith <hannibal@a-team.com>")]' \
|
||||
'(-c,--change=)'{-c,--change=}'[Apply Dockerfile instruction to the created image]' \
|
||||
'(-m,--message=)'{-m,--message=}'[Commit message]' \
|
||||
'--run=[Config automatically applied when the image is run.]'
|
||||
__docker_containers
|
||||
'(-p,--pause=)'{-p,--pause=}'[Pause container during commit]' \
|
||||
}
|
||||
|
||||
__cp() {
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
__create() {
|
||||
_arguments \
|
||||
'(-P,--publish-all=)'{-P,--publish-all=}'[Publish all exposed ports to the host interfaces]' \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach to STDIN, STDOUT or STDERR]' \
|
||||
'--add-host=[Add a custom host-to-IP mapping]' \
|
||||
'--cap-add=[Add Linux capabilities]' \
|
||||
'--cap-drop=[Drop Linux capabilities]' \
|
||||
'--cpuset-cpus=[CPUs in which to allow execution (0-3, 0,1)]' \
|
||||
'(-c,--cpu-shares=)'{-c,--cpu-shares=}'[CPU shares (relative weight)]' \
|
||||
'--cidfile=[Write the container ID to the file]' \
|
||||
'--device=[Add a host device to the container]' \
|
||||
'--dns=[Set custom dns servers]' \
|
||||
'--dns-search=[Set custom DNS search domains]' \
|
||||
'(-e,--env=)'{-e,--env=}'[Set environment variables]' \
|
||||
'--env-file=[Read in a file of environment variables]' \
|
||||
'--entrypoint=[Overwrite the default entrypoint of the image]' \
|
||||
'--expose=[Expose a port from the container without publishing it to your host]' \
|
||||
'(-h,--hostname=)'{-h,--hostname=}'[Container host name]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Keep STDIN open even if not attached]' \
|
||||
'--ipc=[IPC namespace to use]' \
|
||||
'(-l,--label=)'{-l,--label=}'[Set meta data on a container]' \
|
||||
'--link=[Add link to another container (name:alias)]' \
|
||||
'--log-driver=[Logging driver for the container]' \
|
||||
'--lxc-conf=[Add custom LXC options]' \
|
||||
'--mac-address=[Container MAC address (e.g. 92:d0:c6:0a:29:33)]' \
|
||||
'(-m,--memory=)'{-m,--memory=}'[Memory limit (format: <number><optional unit>, where unit = b, k, m or g)]' \
|
||||
'--net=[Set the Network mode for the container]' \
|
||||
'--name=[Assign a name to the container]' \
|
||||
'--pid=[PID namespace to use]' \
|
||||
'(-p,--publish=)'{-p,--publish=}'[Publish a container''s port to the host (format: ip:hostPort:containerPort/protocol)]' \
|
||||
'--privileged=[Give extended privileges to this container]' \
|
||||
'--restart=[Restart policy to apply when a container exits]' \
|
||||
'--security-opt=[Security Options]' \
|
||||
'--sig-proxy=[Proxify all received signal to the process (even in non-tty mode)]' \
|
||||
'(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-tty]' \
|
||||
'(-u,--user=)'{-u,--user=}'[Username or UID]' \
|
||||
'--ulimit=[Ulimit options]' \
|
||||
'(-v,--volume=)'{-v,--volume=}'[Bind mount a volume (e.g. -v /host:/container or -v /container)]' \
|
||||
'--volumes-from=[Mount volumes from the specified container(s)]' \
|
||||
'(-w,--workdir=)'{-w,--workdir=}'[Working directory inside the container]'
|
||||
__docker_images
|
||||
}
|
||||
|
||||
__diff() {
|
||||
__docker_containers
|
||||
}
|
||||
|
|
@ -100,11 +143,6 @@ __info() {
|
|||
# no arguments
|
||||
}
|
||||
|
||||
__insert() {
|
||||
__docker_images
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
__inspect() {
|
||||
__docker_images
|
||||
__docker_all_containers
|
||||
|
|
@ -185,28 +223,43 @@ __rmi() {
|
|||
__run() {
|
||||
_arguments \
|
||||
'(-P,--publish-all=)'{-P,--publish-all=}'[Publish all exposed ports to the host interfaces]' \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach to stdin, stdout or stderr.]' \
|
||||
'(-c,--cpu-shares=)'{-c,--cpu-shares=}': CPU shares (relative weight)]' \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach to STDIN, STDOUT or STDERR]' \
|
||||
'--add-host=[Add a custom host-to-IP mapping]' \
|
||||
'--cap-add=[Add Linux capabilities]' \
|
||||
'--cap-drop=[Drop Linux capabilities]' \
|
||||
'--cpuset-cpus=[CPUs in which to allow execution (0-3, 0,1)]' \
|
||||
'(-c,--cpu-shares=)'{-c,--cpu-shares=}'[CPU shares (relative weight)]' \
|
||||
'--cidfile=[Write the container ID to the file]' \
|
||||
'(-d,--detach=)'{-d,--detach=}'[Detached mode: Run container in the background, print new container id]' \
|
||||
'(-d,--detach=)'{-d,--detach=}'[Run container in the background, print new container id]' \
|
||||
'--device=[Add a host device to the container]' \
|
||||
'--dns=[Set custom dns servers]' \
|
||||
'--dns-search=[Set custom DNS search domains]' \
|
||||
'(-e,--env=)'{-e,--env=}'[Set environment variables]' \
|
||||
'--env-file=[Read in a file of environment variables]' \
|
||||
'--entrypoint=[Overwrite the default entrypoint of the image]' \
|
||||
'--expose=[Expose a port from the container without publishing it to your host]' \
|
||||
'(-h,--hostname=)'{-h,--hostname=}'[Container host name]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Keep stdin open even if not attached]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Keep STDIN open even if not attached]' \
|
||||
'--ipc=[IPC namespace to use]' \
|
||||
'(-l,--label=)'{-l,--label=}'[Set meta data on a container]' \
|
||||
'--link=[Add link to another container (name:alias)]' \
|
||||
'--lxc-conf=[Add custom lxc options -lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"]' \
|
||||
'--log-driver=[Logging driver for the container]' \
|
||||
'--lxc-conf=[Add custom LXC options]' \
|
||||
'--mac-address=[Container MAC address (e.g. 92:d0:c6:0a:29:33)]' \
|
||||
'(-m,--memory=)'{-m,--memory=}'[Memory limit (format: <number><optional unit>, where unit = b, k, m or g)]' \
|
||||
'(-n,--networking=)'{-n,--networking=}'[Enable networking for this container]' \
|
||||
'--net=[Set the Network mode for the container]' \
|
||||
'--name=[Assign a name to the container]' \
|
||||
'(-p,--publish=)'{-p,--publish=}'[Publish a container''s port to the host (format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort) (use "docker port" to see the actual mapping)]' \
|
||||
'--pid=[PID namespace to use]' \
|
||||
'(-p,--publish=)'{-p,--publish=}'[Publish a container''s port to the host (format: ip:hostPort:containerPort/protocol)]' \
|
||||
'--privileged=[Give extended privileges to this container]' \
|
||||
'--restart=[Restart policy to apply when a container exits]' \
|
||||
'--rm=[Automatically remove the container when it exits (incompatible with -d)]' \
|
||||
'--security-opt=[Security Options]' \
|
||||
'--sig-proxy=[Proxify all received signal to the process (even in non-tty mode)]' \
|
||||
'(-t,--tty=)'{-t,--tty=}'[Allocate a pseudo-tty]' \
|
||||
'(-u,--user=)'{-u,--user=}'[Username or UID]' \
|
||||
'(-v,--volume=)'{-v,--volume=}'[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]' \
|
||||
'--ulimit=[Ulimit options]' \
|
||||
'(-v,--volume=)'{-v,--volume=}'[Bind mount a volume (e.g. -v /host:/container or -v /container)]' \
|
||||
'--volumes-from=[Mount volumes from the specified container(s)]' \
|
||||
'(-w,--workdir=)'{-w,--workdir=}'[Working directory inside the container]'
|
||||
__docker_images
|
||||
|
|
@ -225,8 +278,8 @@ __save() {
|
|||
|
||||
__start() {
|
||||
_arguments \
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach container''s stdout/stderr and forward all signals to the process]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s stdin]'
|
||||
'(-a,--attach=)'{-a,--attach=}'[Attach container''s STDOUT/STDERR and forward all signals to the process]' \
|
||||
'(-i,--interactive=)'{-i,--interactive=}'[Attach container''s STDIN]'
|
||||
__docker_all_containers
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +324,7 @@ _1st_arguments=(
|
|||
"build":"Build a container from a Dockerfile"
|
||||
"commit":"Create a new image from a container's changes"
|
||||
"cp":"Copy files/folders from the containers filesystem to the host path"
|
||||
"create":"Create new container without running it"
|
||||
"diff":"Inspect changes on a container's filesystem"
|
||||
"events":"Get real time events from the server"
|
||||
"export":"Stream the contents of a container as a tar archive"
|
||||
|
|
@ -278,7 +332,6 @@ _1st_arguments=(
|
|||
"images":"List images"
|
||||
"import":"Create a new filesystem image from the contents of a tarball"
|
||||
"info":"Display system-wide information"
|
||||
"insert":"Insert a file in an image"
|
||||
"inspect":"Return low-level information on a container"
|
||||
"kill":"Kill a running container"
|
||||
"load":"Load an image from a tar archive"
|
||||
|
|
@ -321,6 +374,8 @@ case "$words[1]" in
|
|||
__commit ;;
|
||||
cp)
|
||||
__cp ;;
|
||||
create)
|
||||
__create ;;
|
||||
diff)
|
||||
__diff ;;
|
||||
events)
|
||||
|
|
@ -335,8 +390,6 @@ case "$words[1]" in
|
|||
__import ;;
|
||||
info)
|
||||
__info ;;
|
||||
insert)
|
||||
__insert ;;
|
||||
inspect)
|
||||
__inspect ;;
|
||||
kill)
|
||||
|
|
|
|||
|
|
@ -1,22 +1,19 @@
|
|||
# Ember-cli
|
||||
# Ember CLI
|
||||
|
||||
**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani)
|
||||
**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa)
|
||||
|
||||
Ember-cli (http://www.ember-cli.com/)
|
||||
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'
|
||||
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 ei='ember install'
|
||||
alias et='ember test'
|
||||
alias eu='ember update'
|
||||
alias ev='ember version'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Ember ClI
|
||||
# visit http://www.ember-cli.com/ to view user guid
|
||||
# Ember CLI
|
||||
# Visit http://www.ember-cli.com/ to view user guide
|
||||
|
||||
alias es='ember serve'
|
||||
alias ea='ember addon'
|
||||
|
|
@ -8,9 +8,6 @@ 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'
|
||||
|
|
|
|||
135
plugins/emoji/README.md
Normal file
135
plugins/emoji/README.md
Normal file
|
|
@ -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.
|
||||
1303
plugins/emoji/emoji-char-definitions.zsh
Normal file
1303
plugins/emoji/emoji-char-definitions.zsh
Normal file
File diff suppressed because it is too large
Load diff
1308
plugins/emoji/emoji-data.txt
Normal file
1308
plugins/emoji/emoji-data.txt
Normal file
File diff suppressed because it is too large
Load diff
288
plugins/emoji/emoji.plugin.zsh
Normal file
288
plugins/emoji/emoji.plugin.zsh
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
# 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.
|
||||
|
||||
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]})
|
||||
fi
|
||||
local list_size=${#names}
|
||||
[[ $list_size -eq 0 ]] && return 1
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
113
plugins/emoji/update_emoji.pl
Normal file
113
plugins/emoji/update_emoji.pl
Normal file
|
|
@ -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 eq "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";
|
||||
|
||||
|
||||
|
||||
43
plugins/emotty/emotty.plugin.zsh
Normal file
43
plugins/emotty/emotty.plugin.zsh
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: emotty.plugin.zsh
|
||||
# DESCRIPTION: Return an emoji for the current $TTY number.
|
||||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||
# VERSION: 1.0.0
|
||||
# DEPENDS: emoji plugin
|
||||
#
|
||||
# There are different sets of emoji characters available, to choose a different
|
||||
# set export emotty_set to the name of the set you would like to use, e.g.:
|
||||
# % export emotty_set=nature
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
typeset -gAH _emotty_sets
|
||||
local _emotty_plugin_dir="${0:h}"
|
||||
source "$_emotty_plugin_dir/emotty_stellar_set.zsh"
|
||||
source "$_emotty_plugin_dir/emotty_floral_set.zsh"
|
||||
source "$_emotty_plugin_dir/emotty_zodiac_set.zsh"
|
||||
source "$_emotty_plugin_dir/emotty_nature_set.zsh"
|
||||
source "$_emotty_plugin_dir/emotty_emoji_set.zsh"
|
||||
source "$_emotty_plugin_dir/emotty_love_set.zsh"
|
||||
unset _emotty_plugin_dir
|
||||
|
||||
emotty_default_set=emoji
|
||||
|
||||
function emotty() {
|
||||
# Use emotty set defined by user, fallback to default
|
||||
local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
|
||||
# Parse $TTY number, normalizing it to an emotty set index
|
||||
(( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 ))
|
||||
local character_name=${${=emotty}[tty]}
|
||||
echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
|
||||
}
|
||||
|
||||
function display_emotty() {
|
||||
local name=$1
|
||||
for i in ${=_emotty_sets[$name]}; do
|
||||
printf "${emoji[$i]}${emoji2[emoji_style]} "
|
||||
done
|
||||
print
|
||||
for i in ${=_emotty_sets[$name]}; do
|
||||
print "${emoji[$i]}${emoji2[emoji_style]} = $i"
|
||||
done
|
||||
}
|
||||
24
plugins/emotty/emotty_emoji_set.zsh
Normal file
24
plugins/emotty/emotty_emoji_set.zsh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
_emotty_sets[emoji]="
|
||||
crystal_ball
|
||||
ghost
|
||||
jack_o_lantern
|
||||
see_no_evil_monkey
|
||||
hear_no_evil_monkey
|
||||
speak_no_evil_monkey
|
||||
smiling_cat_face_with_open_mouth
|
||||
extraterrestrial_alien
|
||||
rocket
|
||||
billiards
|
||||
bomb
|
||||
pill
|
||||
japanese_symbol_for_beginner
|
||||
direct_hit
|
||||
cyclone
|
||||
diamond_shape_with_a_dot_inside
|
||||
sparkle
|
||||
eight_spoked_asterisk
|
||||
eight_pointed_black_star
|
||||
"
|
||||
18
plugins/emotty/emotty_floral_set.zsh
Normal file
18
plugins/emotty/emotty_floral_set.zsh
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
_emotty_sets[floral]="
|
||||
hibiscus
|
||||
cherry_blossom
|
||||
blossom
|
||||
sunflower
|
||||
bouquet
|
||||
tulip
|
||||
rose
|
||||
four_leaf_clover
|
||||
seedling
|
||||
herb
|
||||
palm_tree
|
||||
evergreen_tree
|
||||
deciduous_tree
|
||||
"
|
||||
34
plugins/emotty/emotty_love_set.zsh
Normal file
34
plugins/emotty/emotty_love_set.zsh
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
# Note: The heavy_black_heart emoji requires $emoji2[emoji_style]
|
||||
# to be rendered as the emoji red heart.
|
||||
_emotty_sets[love]="
|
||||
green_heart
|
||||
blue_heart
|
||||
purple_heart
|
||||
yellow_heart
|
||||
heavy_black_heart
|
||||
broken_heart
|
||||
heart_with_arrow
|
||||
heart_with_ribbon
|
||||
sparkling_heart
|
||||
two_hearts
|
||||
revolving_hearts
|
||||
growing_heart
|
||||
beating_heart
|
||||
heart_decoration
|
||||
couple_with_heart
|
||||
kiss
|
||||
man_and_woman_holding_hands
|
||||
two_women_holding_hands
|
||||
two_men_holding_hands
|
||||
kiss_mark
|
||||
smiling_face_with_heart_shaped_eyes
|
||||
kissing_face
|
||||
face_throwing_a_kiss
|
||||
kissing_face_with_smiling_eyes
|
||||
kissing_face_with_closed_eyes
|
||||
smiling_cat_face_with_heart_shaped_eyes
|
||||
kissing_cat_face_with_closed_eyes
|
||||
"
|
||||
58
plugins/emotty/emotty_nature_set.zsh
Normal file
58
plugins/emotty/emotty_nature_set.zsh
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
_emotty_sets[nature]="
|
||||
mouse_face
|
||||
hamster_face
|
||||
rabbit_face
|
||||
dog_face
|
||||
cat_face
|
||||
tiger_face
|
||||
bear_face
|
||||
monkey_face
|
||||
koala
|
||||
panda_face
|
||||
chicken
|
||||
baby_chick
|
||||
bird
|
||||
penguin
|
||||
cow_face
|
||||
pig_face
|
||||
frog_face
|
||||
boar
|
||||
wolf_face
|
||||
horse_face
|
||||
snail
|
||||
bug
|
||||
ant
|
||||
honeybee
|
||||
lady_beetle
|
||||
spouting_whale
|
||||
dolphin
|
||||
octopus
|
||||
fish
|
||||
tropical_fish
|
||||
snake
|
||||
turtle
|
||||
lemon
|
||||
tangerine
|
||||
peach
|
||||
mushroom
|
||||
tomato
|
||||
strawberry
|
||||
red_apple
|
||||
cherries
|
||||
grapes
|
||||
aubergine
|
||||
watermelon
|
||||
banana
|
||||
pineapple
|
||||
melon
|
||||
pear
|
||||
green_apple
|
||||
ear_of_maize
|
||||
sunflower
|
||||
seedling
|
||||
herb
|
||||
four_leaf_clover
|
||||
"
|
||||
25
plugins/emotty/emotty_stellar_set.zsh
Normal file
25
plugins/emotty/emotty_stellar_set.zsh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
# NOTE: The following emoji show as $'character' in the title
|
||||
# white_medium_star
|
||||
# sparkles
|
||||
# dizzy_symbol
|
||||
|
||||
_emotty_sets[stellar]="
|
||||
full_moon_symbol
|
||||
waning_gibbous_moon_symbol
|
||||
waning_crescent_moon_symbol
|
||||
last_quarter_moon_symbol
|
||||
new_moon_symbol
|
||||
new_moon_with_face
|
||||
waxing_crescent_moon_symbol
|
||||
first_quarter_moon_symbol
|
||||
waxing_gibbous_moon_symbol
|
||||
full_moon_with_face
|
||||
sun_with_face
|
||||
glowing_star
|
||||
crescent_moon
|
||||
first_quarter_moon_with_face
|
||||
last_quarter_moon_with_face
|
||||
"
|
||||
29
plugins/emotty/emotty_zodiac_set.zsh
Normal file
29
plugins/emotty/emotty_zodiac_set.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env zsh
|
||||
# vim:ft=zsh ts=2 sw=2 sts=2
|
||||
|
||||
_emotty_sets[zodiac]="
|
||||
aries
|
||||
taurus
|
||||
gemini
|
||||
cancer
|
||||
leo
|
||||
virgo
|
||||
libra
|
||||
scorpius
|
||||
sagittarius
|
||||
capricorn
|
||||
aquarius
|
||||
pisces
|
||||
rat
|
||||
ox
|
||||
tiger
|
||||
rabbit
|
||||
dragon
|
||||
snake
|
||||
horse
|
||||
goat
|
||||
monkey
|
||||
rooster
|
||||
dog
|
||||
pig
|
||||
"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 --decode }
|
||||
encode64(){ printf '%s' $1 | base64 }
|
||||
decode64(){ printf '%s' $1 | base64 --decode }
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
14
plugins/fancy-ctrl-z/README.md
Normal file
14
plugins/fancy-ctrl-z/README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Use Ctrl-Z to switch back to Vim
|
||||
|
||||
I frequently need to execute random command in my shell. To achieve it I pause
|
||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
||||
The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back
|
||||
to Vim. I could not find a solution, so I developed one on my own that
|
||||
works wonderfully with ZSH
|
||||
|
||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||
|
||||
Credits:
|
||||
- original idea by @sheerun
|
||||
- added to OMZ by @mbologna
|
||||
|
||||
12
plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
Normal file
12
plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
fancy-ctrl-z () {
|
||||
if [[ $#BUFFER -eq 0 ]]; then
|
||||
BUFFER="fg"
|
||||
zle accept-line
|
||||
else
|
||||
zle push-input
|
||||
zle clear-screen
|
||||
fi
|
||||
}
|
||||
zle -N fancy-ctrl-z
|
||||
bindkey '^Z' fancy-ctrl-z
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
if [ $commands[fasd] ]; then # check if fasd is installed
|
||||
fasd_cache="$HOME/.fasd-init-cache"
|
||||
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
|
||||
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
|
||||
fasd --init auto >| "$fasd_cache"
|
||||
fi
|
||||
source "$fasd_cache"
|
||||
unset fasd_cache
|
||||
alias v='f -e vim'
|
||||
alias o='a -e open'
|
||||
fi
|
||||
|
||||
alias v='f -e vim'
|
||||
alias o='a -e open_command'
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
3
plugins/fedora/README.md
Normal file
3
plugins/fedora/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
This is a plugin based on yum plugin, but using dnf as main frontend
|
||||
(from Fedora 22 onwards, yum is deprecated in favor of dnf).
|
||||
|
||||
16
plugins/fedora/fedora.plugin.zsh
Normal file
16
plugins/fedora/fedora.plugin.zsh
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
## Aliases
|
||||
|
||||
alias dnfs="dnf search" # search package
|
||||
alias dnfp="dnf info" # show package info
|
||||
alias dnfl="dnf list" # list packages
|
||||
alias dnfgl="dnf grouplist" # list package groups
|
||||
alias dnfli="dnf list installed" # print all installed packages
|
||||
alias dnfmc="dnf makecache" # rebuilds the dnf package list
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # upgrade packages
|
||||
alias dnfi="sudo dnf install" # install package
|
||||
alias dnfgi="sudo dnf groupinstall" # install package group
|
||||
alias dnfr="sudo dnf remove" # remove package
|
||||
alias dnfgr="sudo dnf groupremove" # remove pagage group
|
||||
alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
|
||||
alias dnfc="sudo dnf clean all" # clean cache
|
||||
13
plugins/forklift/README.md
Normal file
13
plugins/forklift/README.md
Normal file
|
|
@ -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
|
||||
|
|
@ -1,74 +1,60 @@
|
|||
## Rationale ##
|
||||
## Introduction ##
|
||||
|
||||
> Searches for your Frontend contents more easier
|
||||
> Searches for your frontend web development made easier
|
||||
|
||||
|
||||
## Instalation ##
|
||||
## Installation ##
|
||||
|
||||
Open your `~/.zshrc` file and enable the `frontend-search` plugin:
|
||||
|
||||
Open your `.zshrc` file and load `frontend-search` plugin
|
||||
```zsh
|
||||
|
||||
plugins=( ... frontend-search)
|
||||
|
||||
```bash
|
||||
...
|
||||
plugins=( <your-plugins-list>... frontend-search)
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## Commands ##
|
||||
## Usage ##
|
||||
|
||||
All command searches are accept only in format
|
||||
You can use the frontend-search plugin in these two forms:
|
||||
|
||||
* `frontend <search-content> <search-term>`
|
||||
* `frontend <context> <term> [more terms if you want]`
|
||||
* `<context> <term> [more terms if you want]`
|
||||
|
||||
The search content are
|
||||
For example, these two are equivalent:
|
||||
|
||||
* `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>`
|
||||
```zsh
|
||||
$ frontend angularjs dependency injection
|
||||
$ angularjs dependency injection
|
||||
```
|
||||
|
||||
Available search contexts are:
|
||||
|
||||
## Aliases ##
|
||||
| context | URL |
|
||||
|---------------|--------------------------------------------------------------------------|
|
||||
| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
|
||||
| aurajs | `http://aurajs.com/api/#stq=` |
|
||||
| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
|
||||
| bootsnipp | `http://bootsnipp.com/search?q=` |
|
||||
| caniuse | `http://caniuse.com/#search=` |
|
||||
| codepen | `http://codepen.io/search?q=` |
|
||||
| compass | `http://compass-style.org/search?q=` |
|
||||
| cssflow | `http://www.cssflow.com/search?q=` |
|
||||
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
|
||||
| emberjs | `http://emberjs.com/api/#stp=1&stq=` |
|
||||
| fontello | `http://fontello.com/#search=` |
|
||||
| html5please | `http://html5please.com/#` |
|
||||
| jquery | `https://api.jquery.com/?s=` |
|
||||
| lodash | `https://devdocs.io/lodash/index#` |
|
||||
| mdn | `https://developer.mozilla.org/search?q=` |
|
||||
| npmjs | `https://www.npmjs.com/search?q=` |
|
||||
| qunit | `https://api.qunitjs.com/?s=` |
|
||||
| reactjs | `https://google.com/search?as_sitesearch=facebook.github.io/react&as_q=` |
|
||||
| smacss | `https://google.com/search?as_sitesearch=smacss.com&as_q=` |
|
||||
| stackoverflow | `http://stackoverflow.com/search?q=` |
|
||||
| unheap | `http://www.unheap.com/?s=` |
|
||||
|
||||
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`
|
||||
If you want to have another context, open an Issue and tell us!
|
||||
|
||||
|
||||
## Author
|
||||
|
|
@ -77,5 +63,3 @@ There are a few aliases presented as well:
|
|||
+ <https://plus.google.com/+WilsonMendes>
|
||||
+ <https://twitter.com/willmendesneto>
|
||||
+ <http://github.com/willmendesneto>
|
||||
|
||||
New features comming soon.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ function _frontend() {
|
|||
'reactjs: Search in React website'
|
||||
'emberjs: Search in Ember website'
|
||||
'stackoverflow: Search in StackOverflow website'
|
||||
'npmjs: Search in NPMJS website'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
|
|
@ -110,6 +111,9 @@ function _frontend() {
|
|||
stackoverflow)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
npmjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -1,158 +1,91 @@
|
|||
# frontend from terminal
|
||||
|
||||
function frontend() {
|
||||
|
||||
# get the open command
|
||||
local open_cmd
|
||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
|
||||
# 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_cmd "$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 angularjs='frontend angularjs'
|
||||
alias aurajs='frontend aurajs'
|
||||
alias dartlang='frontend dartlang'
|
||||
alias lodash='frontend lodash'
|
||||
|
||||
#tests
|
||||
alias qunit='frontend qunit'
|
||||
|
||||
#fonts
|
||||
alias fontello='frontend fontello'
|
||||
|
||||
# snippets
|
||||
alias bem='frontend bem'
|
||||
alias bootsnipp='frontend bootsnipp'
|
||||
alias cssflow='frontend cssflow'
|
||||
alias caniuse='frontend caniuse'
|
||||
alias codepen='frontend codepen'
|
||||
alias compass='frontend compass'
|
||||
alias cssflow='frontend cssflow'
|
||||
alias dartlang='frontend dartlang'
|
||||
alias emberjs='frontend emberjs'
|
||||
alias fontello='frontend fontello'
|
||||
alias html5please='frontend html5please'
|
||||
alias jquery='frontend jquery'
|
||||
alias lodash='frontend lodash'
|
||||
alias mdn='frontend mdn'
|
||||
alias npmjs='frontend npmjs'
|
||||
alias qunit='frontend qunit'
|
||||
alias reactjs='frontend reactjs'
|
||||
alias smacss='frontend smacss'
|
||||
alias stackoverflow='frontend stackoverflow'
|
||||
alias unheap='frontend unheap'
|
||||
|
||||
# css architecture
|
||||
alias bem='frontend bem'
|
||||
alias smacss='frontend smacss'
|
||||
function frontend() {
|
||||
emulate -L zsh
|
||||
|
||||
# frameworks
|
||||
alias angularjs='frontend angularjs'
|
||||
alias reactjs='frontend reactjs'
|
||||
alias emberjs='frontend emberjs'
|
||||
# define search context URLS
|
||||
typeset -A urls
|
||||
urls=(
|
||||
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
|
||||
aurajs 'http://aurajs.com/api/#stq='
|
||||
bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
|
||||
bootsnipp 'http://bootsnipp.com/search?q='
|
||||
caniuse 'http://caniuse.com/#search='
|
||||
codepen 'http://codepen.io/search?q='
|
||||
compass 'http://compass-style.org/search?q='
|
||||
cssflow 'http://www.cssflow.com/search?q='
|
||||
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
||||
emberjs 'http://emberjs.com/api/#stp=1&stq='
|
||||
fontello 'http://fontello.com/#search='
|
||||
html5please 'http://html5please.com/#'
|
||||
jquery 'https://api.jquery.com/?s='
|
||||
lodash 'https://devdocs.io/lodash/index#'
|
||||
mdn 'https://developer.mozilla.org/search?q='
|
||||
npmjs 'https://www.npmjs.com/search?q='
|
||||
qunit 'https://api.qunitjs.com/?s='
|
||||
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
|
||||
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
|
||||
stackoverflow 'http://stackoverflow.com/search?q='
|
||||
unheap 'http://www.unheap.com/?s='
|
||||
)
|
||||
|
||||
# search websites
|
||||
alias stackoverflow='frontend stackoverflow'
|
||||
# show help for command list
|
||||
if [[ $# -lt 2 ]]
|
||||
then
|
||||
print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
|
||||
print -P ""
|
||||
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
|
||||
print -P "and %Ucontext%u is one of the following:"
|
||||
print -P ""
|
||||
print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
|
||||
print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
|
||||
print -P " qunit, reactjs, smacss, stackoverflow, unheap"
|
||||
print -P ""
|
||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||
print -P ""
|
||||
return 1
|
||||
fi
|
||||
|
||||
# check whether the search context is supported
|
||||
if [[ -z "$urls[$1]" ]]
|
||||
then
|
||||
echo "Search context \"$1\" currently not supported."
|
||||
echo ""
|
||||
echo "Valid contexts are:"
|
||||
echo ""
|
||||
echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
|
||||
echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
|
||||
echo " qunit, reactjs, smacss, stackoverflow, unheap"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
|
||||
# build search url:
|
||||
# join arguments passed with '+', then append to search context URL
|
||||
# TODO substitute for proper urlencode method
|
||||
url="${urls[$1]}${(j:+:)@[2,-1]}"
|
||||
|
||||
echo "Opening $url ..."
|
||||
|
||||
open_command "$url"
|
||||
}
|
||||
|
|
|
|||
11
plugins/git-extras/README.md
Normal file
11
plugins/git-extras/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# git-extras
|
||||
|
||||
This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras).
|
||||
|
||||
## Setup notes
|
||||
|
||||
The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence.
|
||||
|
||||
### OS X Homebrew Setup
|
||||
|
||||
On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands.
|
||||
|
|
@ -1,45 +1,62 @@
|
|||
#compdef git
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for git-extras (http://github.com/visionmedia/git-extras).
|
||||
# Completion script for git-extras (http://github.com/tj/git-extras).
|
||||
#
|
||||
# This depends on and reueses some of the internals of the _git completion
|
||||
# function that ships with zsh itself. It will not work with the _git that ships
|
||||
# with git.
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Alexis GRIMALDI (https://github.com/agrimaldi)
|
||||
# * spacewander (https://github.com/spacewander)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Inspirations
|
||||
# -----------
|
||||
#
|
||||
# * git-extras (http://github.com/visionmedia/git-extras)
|
||||
# * git-extras (http://github.com/tj/git-extras)
|
||||
# * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
# Internal functions
|
||||
# These are a lot like their __git_* equivalents inside _git
|
||||
|
||||
__gitex_command_successful () {
|
||||
if (( ${#*:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
__gitex_commits() {
|
||||
declare -A commits
|
||||
git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
|
||||
do
|
||||
hash=$(echo $commit | cut -d':' -f1)
|
||||
commits[$hash]="$commit"
|
||||
done
|
||||
local ret=1
|
||||
_describe -t commits commit commits && ret=0
|
||||
}
|
||||
|
||||
__git_tag_names() {
|
||||
__gitex_tag_names() {
|
||||
local expl
|
||||
declare -a tag_names
|
||||
tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
|
||||
tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
|
||||
__git_command_successful || return
|
||||
_wanted tag-names expl tag-name compadd $* - $tag_names
|
||||
}
|
||||
|
||||
|
||||
__git_branch_names() {
|
||||
__gitex_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
|
||||
|
|
@ -47,44 +64,36 @@ __git_branch_names() {
|
|||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_feature_branch_names() {
|
||||
__gitex_specific_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
|
||||
__git_refactor_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
__gitex_feature_branch_names() {
|
||||
__gitex_specific_branch_names 'feature'
|
||||
}
|
||||
|
||||
|
||||
__git_bug_branch_names() {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
|
||||
__git_command_successful || return
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
__gitex_refactor_branch_names() {
|
||||
__gitex_specific_branch_names 'refactor'
|
||||
}
|
||||
|
||||
__gitex_bug_branch_names() {
|
||||
__gitex_specific_branch_names 'bug'
|
||||
}
|
||||
|
||||
__git_submodule_names() {
|
||||
__gitex_submodule_names() {
|
||||
local expl
|
||||
declare -a submodule_names
|
||||
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"})
|
||||
submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # '
|
||||
__git_command_successful || return
|
||||
_wanted submodule-names expl submodule-name compadd $* - $submodule_names
|
||||
}
|
||||
|
||||
|
||||
__git_author_names() {
|
||||
__gitex_author_names() {
|
||||
local expl
|
||||
declare -a author_names
|
||||
author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"})
|
||||
|
|
@ -92,6 +101,35 @@ __git_author_names() {
|
|||
_wanted author-names expl author-name compadd $* - $author_names
|
||||
}
|
||||
|
||||
# subcommands
|
||||
|
||||
_git-bug() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'finish:merge bug into the current branch'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*}-$line[1]:
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__gitex_bug_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
_git-changelog() {
|
||||
_arguments \
|
||||
|
|
@ -99,15 +137,10 @@ _git-changelog() {
|
|||
}
|
||||
|
||||
|
||||
_git-effort() {
|
||||
_arguments \
|
||||
'--above[ignore file with less than x commits]' \
|
||||
}
|
||||
|
||||
|
||||
_git-contrib() {
|
||||
_arguments \
|
||||
':author:__git_author_names'
|
||||
':author:__gitex_author_names'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,19 +152,25 @@ _git-count() {
|
|||
|
||||
_git-delete-branch() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
':branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-submodule() {
|
||||
_arguments \
|
||||
':submodule-name:__git_submodule_names'
|
||||
':submodule-name:__gitex_submodule_names'
|
||||
}
|
||||
|
||||
|
||||
_git-delete-tag() {
|
||||
_arguments \
|
||||
':tag-name:__git_tag_names'
|
||||
':tag-name:__gitex_tag_names'
|
||||
}
|
||||
|
||||
|
||||
_git-effort() {
|
||||
_arguments \
|
||||
'--above[ignore file with less than x commits]'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -154,20 +193,7 @@ _git-extras() {
|
|||
esac
|
||||
|
||||
_arguments \
|
||||
'(-v --version)'{-v,--version}'[show current version]' \
|
||||
}
|
||||
|
||||
|
||||
_git-graft() {
|
||||
_arguments \
|
||||
':src-branch-name:__git_branch_names' \
|
||||
':dest-branch-name:__git_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-squash() {
|
||||
_arguments \
|
||||
':branch-name:__git_branch_names'
|
||||
'(-v --version)'{-v,--version}'[show current version]'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -192,13 +218,34 @@ _git-feature() {
|
|||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_feature_branch_names'
|
||||
':branch-name:__gitex_feature_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
_git-graft() {
|
||||
_arguments \
|
||||
':src-branch-name:__gitex_branch_names' \
|
||||
':dest-branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-ignore() {
|
||||
_arguments -C \
|
||||
'(--local -l)'{--local,-l}'[show local gitignore]' \
|
||||
'(--global -g)'{--global,-g}'[show global gitignore]'
|
||||
}
|
||||
|
||||
|
||||
_git-missing() {
|
||||
_arguments \
|
||||
':first-branch-name:__gitex_branch_names' \
|
||||
':second-branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
|
||||
_git-refactor() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
|
@ -220,66 +267,69 @@ _git-refactor() {
|
|||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_refactor_branch_names'
|
||||
':branch-name:__gitex_refactor_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
_git-bug() {
|
||||
local curcontext=$curcontext state line ret=1
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
': :->command' \
|
||||
'*:: :->option-or-argument' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
commands=(
|
||||
'finish:merge bug into the current branch'
|
||||
)
|
||||
_describe -t commands command commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*}-$line[1]:
|
||||
case $line[1] in
|
||||
(finish)
|
||||
_arguments -C \
|
||||
':branch-name:__git_bug_branch_names'
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
_git-squash() {
|
||||
_arguments \
|
||||
':branch-name:__gitex_branch_names'
|
||||
}
|
||||
|
||||
_git-summary() {
|
||||
_arguments '--line[summarize with lines rather than commits]'
|
||||
__gitex_commits
|
||||
}
|
||||
|
||||
|
||||
_git-undo(){
|
||||
_arguments -C \
|
||||
'(--soft -s)'{--soft,-s}'[only rolls back the commit but changes remain un-staged]' \
|
||||
'(--hard -h)'{--hard,-h}'[wipes your commit(s)]'
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands \
|
||||
alias:'define, search and show aliases' \
|
||||
archive-file:'export the current HEAD of the git repository to a archive' \
|
||||
back:'undo and stage latest commits' \
|
||||
bug:'create a bug branch' \
|
||||
changelog:'populate changelog file with commits since the previous tag' \
|
||||
commits-since:'list commits since a given date' \
|
||||
contrib:'display author contributions' \
|
||||
count:'count commits' \
|
||||
create-branch:'create local and remote branch' \
|
||||
delete-branch:'delete local and remote branch' \
|
||||
delete-merged-branches:'delete merged branches'\
|
||||
delete-submodule:'delete submodule' \
|
||||
delete-tag:'delete local and remote tag' \
|
||||
extras:'git-extras' \
|
||||
graft:'merge commits from source branch to destination branch' \
|
||||
squash:'merge commits from source branch into the current one as a single commit' \
|
||||
feature:'create a feature branch' \
|
||||
refactor:'create a refactor branch' \
|
||||
bug:'create a bug branch' \
|
||||
summary:'repository summary' \
|
||||
effort:'display effort statistics' \
|
||||
repl:'read-eval-print-loop' \
|
||||
commits-since:'list commits since a given date' \
|
||||
release:'release commit with the given tag' \
|
||||
alias:'define, search and show aliases' \
|
||||
extras:'git-extras' \
|
||||
feature:'create a feature branch' \
|
||||
fork:'fork a repo on github' \
|
||||
fresh-branch:'create empty local branch' \
|
||||
gh-pages:'create the GitHub Pages branch' \
|
||||
graft:'merge commits from source branch to destination branch' \
|
||||
ignore:'add patterns to .gitignore' \
|
||||
info:'show info about the repository' \
|
||||
create-branch:'create local and remote branch' \
|
||||
fresh-branch:'create empty local branch' \
|
||||
undo:'remove the latest commit' \
|
||||
setup:'setup a git repository' \
|
||||
touch:'one step creation of new files' \
|
||||
obliterate:'Completely remove a file from the repository, including past commits and tags' \
|
||||
local-commits:'list unpushed commits on the local branch' \
|
||||
lock:'lock a file excluded from version control' \
|
||||
locked:'ls files that have been locked' \
|
||||
missing:'show commits missing from another branch' \
|
||||
pr:'checks out a pull request locally' \
|
||||
rebase-patch:'rebases a patch' \
|
||||
refactor:'create a refactor branch' \
|
||||
release:'commit, tag and push changes to the repository' \
|
||||
rename-tag:'rename a tag' \
|
||||
repl:'read-eval-print-loop' \
|
||||
reset-file:'reset one file' \
|
||||
root:'show path of root' \
|
||||
setup:'setup a git repository' \
|
||||
show-tree:'show branch tree of commit history' \
|
||||
squash:'merge commits from source branch into the current one as a single commit' \
|
||||
summary:'repository summary' \
|
||||
touch:'one step creation of new files' \
|
||||
undo:'remove the latest commit' \
|
||||
unlock:'unlock a file excluded from version control'
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
|
||||
#Alias
|
||||
alias gf='git flow'
|
||||
alias gfl='git flow'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@
|
|||
# c. Or, use this file as an oh-my-zsh plugin.
|
||||
#
|
||||
|
||||
alias ghf='git hf'
|
||||
alias ghff='git hf feature'
|
||||
alias ghfr='git hf release'
|
||||
alias ghfh='git hf hotfix'
|
||||
alias ghfs='git hf support'
|
||||
alias ghfu='git hf update'
|
||||
|
||||
_git-hf ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
|
|
|
|||
|
|
@ -1,57 +1,92 @@
|
|||
# ZSH Git Prompt Plugin from:
|
||||
# http://github.com/olivierverdier/zsh-git-prompt
|
||||
#
|
||||
export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
__GIT_PROMPT_DIR="${0:A:h}"
|
||||
|
||||
## Enable auto-execution of functions.
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
typeset -ga chpwd_functions
|
||||
## Hook function definitions
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
# Append git functions needed for prompt.
|
||||
preexec_functions+='preexec_update_git_vars'
|
||||
precmd_functions+='precmd_update_git_vars'
|
||||
chpwd_functions+='chpwd_update_git_vars'
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*)
|
||||
git*|hub*|gh*|stg*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
chpwd_functions+=(chpwd_update_git_vars)
|
||||
precmd_functions+=(precmd_update_git_vars)
|
||||
preexec_functions+=(preexec_update_git_vars)
|
||||
|
||||
|
||||
## Function definitions
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
|
||||
_GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
|
||||
__CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
function prompt_git_info() {
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ "$GIT_BEHIND" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_AHEAD" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}%{●%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}%{✖%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}%{✚%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{↓%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{↑%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{…%G%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}%{✔%G%}"
|
||||
|
||||
# Set the prompt.
|
||||
#PROMPT='%B%m%~%b$(prompt_git_info) %# '
|
||||
# for a right prompt:
|
||||
#RPROMPT='%b$(prompt_git_info)'
|
||||
RPROMPT='$(prompt_git_info)'
|
||||
RPROMPT='$(git_super_status)'
|
||||
|
|
|
|||
|
|
@ -1,82 +1,84 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
from subprocess import Popen, PIPE
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import re
|
||||
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {
|
||||
'ahead of': '↑',
|
||||
'behind': '↓',
|
||||
'staged': '♦',
|
||||
'changed': '‣',
|
||||
'untracked': '…',
|
||||
'clean': '⚡',
|
||||
'unmerged': '≠',
|
||||
'sha1': ':'
|
||||
}
|
||||
|
||||
output, error = Popen(
|
||||
['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
|
||||
|
||||
if error:
|
||||
import sys
|
||||
sys.exit(0)
|
||||
lines = output.splitlines()
|
||||
|
||||
behead_re = re.compile(
|
||||
r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
|
||||
diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
|
||||
|
||||
status = ''
|
||||
staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
|
||||
changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
|
||||
untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
|
||||
unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
|
||||
import shlex
|
||||
from subprocess import Popen, PIPE, check_output
|
||||
|
||||
|
||||
def execute(*command):
|
||||
out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
|
||||
if not err:
|
||||
nb = len(out.splitlines())
|
||||
def get_tagname_or_hash():
|
||||
"""return tagname if exists else hash"""
|
||||
cmd = 'git log -1 --format="%h%d"'
|
||||
output = check_output(shlex.split(cmd)).decode('utf-8').strip()
|
||||
hash_, tagname = None, None
|
||||
# get hash
|
||||
m = re.search('\(.*\)$', output)
|
||||
if m:
|
||||
hash_ = output[:m.start()-1]
|
||||
# get tagname
|
||||
m = re.search('tag: .*[,\)]', output)
|
||||
if m:
|
||||
tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
|
||||
|
||||
if tagname:
|
||||
return tagname
|
||||
elif hash_:
|
||||
return hash_
|
||||
return None
|
||||
|
||||
|
||||
# `git status --porcelain --branch` can collect all information
|
||||
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
||||
po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
|
||||
stdout, sterr = po.communicate()
|
||||
if po.returncode != 0:
|
||||
sys.exit(0) # Not a git repository
|
||||
|
||||
# collect git status information
|
||||
untracked, staged, changed, conflicts = [], [], [], []
|
||||
ahead, behind = 0, 0
|
||||
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
|
||||
for st in status:
|
||||
if st[0] == '#' and st[1] == '#':
|
||||
if re.search('Initial commit on', st[2]):
|
||||
branch = st[2].split(' ')[-1]
|
||||
elif re.search('no branch', st[2]): # detached status
|
||||
branch = get_tagname_or_hash()
|
||||
elif len(st[2].strip().split('...')) == 1:
|
||||
branch = st[2].strip()
|
||||
else:
|
||||
# current and remote branch info
|
||||
branch, rest = st[2].strip().split('...')
|
||||
if len(rest.split(' ')) == 1:
|
||||
# remote_branch = rest.split(' ')[0]
|
||||
pass
|
||||
else:
|
||||
# ahead or behind
|
||||
divergence = ' '.join(rest.split(' ')[1:])
|
||||
divergence = divergence.lstrip('[').rstrip(']')
|
||||
for div in divergence.split(', '):
|
||||
if 'ahead' in div:
|
||||
ahead = int(div[len('ahead '):].strip())
|
||||
elif 'behind' in div:
|
||||
behind = int(div[len('behind '):].strip())
|
||||
elif st[0] == '?' and st[1] == '?':
|
||||
untracked.append(st)
|
||||
else:
|
||||
nb = '?'
|
||||
return nb
|
||||
if st[1] == 'M':
|
||||
changed.append(st)
|
||||
if st[0] == 'U':
|
||||
conflicts.append(st)
|
||||
elif st[0] != ' ':
|
||||
staged.append(st)
|
||||
|
||||
if staged.search(output):
|
||||
nb = execute(
|
||||
['git', 'diff', '--staged', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['staged'], nb)
|
||||
if unmerged.search(output):
|
||||
nb = execute(['git', 'diff', '--staged', '--name-only', '--diff-filter=U'])
|
||||
status += '%s%s' % (symbols['unmerged'], nb)
|
||||
if changed.search(output):
|
||||
nb = execute(['git', 'diff', '--name-only', '--diff-filter=ACDMRT'])
|
||||
status += '%s%s' % (symbols['changed'], nb)
|
||||
if untracked.search(output):
|
||||
status += symbols['untracked']
|
||||
if status == '':
|
||||
status = symbols['clean']
|
||||
|
||||
remote = ''
|
||||
|
||||
bline = lines[0]
|
||||
if bline.find('Not currently on any branch') != -1:
|
||||
branch = symbols['sha1'] + Popen([
|
||||
'git',
|
||||
'rev-parse',
|
||||
'--short',
|
||||
'HEAD'], stdout=PIPE).communicate()[0][:-1]
|
||||
else:
|
||||
branch = bline.split(' ')[-1]
|
||||
bstatusline = lines[1]
|
||||
match = behead_re.match(bstatusline)
|
||||
if match:
|
||||
remote = symbols[match.groups()[0]]
|
||||
remote += match.groups()[2]
|
||||
elif lines[2:]:
|
||||
div_match = diverge_re.match(lines[2])
|
||||
if div_match:
|
||||
remote = "{behind}{1}{ahead of}{0}".format(
|
||||
*div_match.groups(), **symbols)
|
||||
|
||||
print('\n'.join([branch, remote, status]))
|
||||
out = ' '.join([
|
||||
branch,
|
||||
str(ahead),
|
||||
str(behind),
|
||||
str(len(staged)),
|
||||
str(len(conflicts)),
|
||||
str(len(changed)),
|
||||
str(len(untracked)),
|
||||
])
|
||||
print(out, end='')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Query/use custom command for `git`.
|
||||
local git_cmd
|
||||
zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
|
||||
: ${git_cmd:=git}
|
||||
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
|
||||
: ${_omz_git_git_cmd:=git}
|
||||
|
||||
#
|
||||
# Functions
|
||||
|
|
@ -13,20 +12,20 @@ zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
|
|||
# it's not a symbolic ref, but in a Git repo.
|
||||
function current_branch() {
|
||||
local ref
|
||||
ref=$($git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
|
||||
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=$($git_cmd rev-parse --short HEAD 2> /dev/null) || return
|
||||
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 ! $git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
echo $($git_cmd remote -v | cut -d':' -f 2)
|
||||
echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
|
||||
}
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
|
|
@ -49,6 +48,8 @@ function work_in_progress() {
|
|||
alias g='git'
|
||||
|
||||
alias ga='git add'
|
||||
alias gaa='git add --all'
|
||||
alias gapa='git add --patch'
|
||||
|
||||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
|
|
@ -67,10 +68,12 @@ alias gc!='git commit -v --amend'
|
|||
alias gca='git commit -v -a'
|
||||
alias gca!='git commit -v -a --amend'
|
||||
alias gcan!='git commit -v -a -s --no-edit --amend'
|
||||
alias gcam='git commit -a -m'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcf='git config --list'
|
||||
alias gcl='git clone --recursive'
|
||||
alias gclean='git reset --hard && git clean -dfx'
|
||||
alias gclean='git clean -fd'
|
||||
alias gpristine='git reset --hard && git clean -dfx'
|
||||
alias gcm='git checkout master'
|
||||
alias gcmsg='git commit -m'
|
||||
alias gco='git checkout'
|
||||
|
|
@ -80,7 +83,8 @@ alias gcp='git cherry-pick'
|
|||
alias gcs='git commit -S'
|
||||
|
||||
alias gd='git diff'
|
||||
alias gdc='git diff --cached'
|
||||
alias gdca='git diff --cached'
|
||||
alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
|
|
@ -95,30 +99,48 @@ alias gfo='git fetch origin'
|
|||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
ggf() {
|
||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
||||
[[ "$#" != 1 ]] && local b="$(current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
ggl() {
|
||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
alias ggpull='git pull origin $(current_branch)'
|
||||
compdef _git ggpull=git-checkout
|
||||
ggp() {
|
||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
||||
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 _git ggpush=git-checkout
|
||||
ggpnp() {
|
||||
ggl "$1" && ggp "$1"
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'
|
||||
ggu() {
|
||||
[[ "$#" != 1 ]] && b="$(current_branch)"
|
||||
[[ "$#" != 1 ]] && local b="$(current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
alias ggpur='ggu'
|
||||
compdef _git ggpur=git-checkout
|
||||
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
|
|
@ -190,13 +212,15 @@ alias gsts='git stash show --text'
|
|||
alias gsu='git submodule update'
|
||||
|
||||
alias gts='git tag -s'
|
||||
alias gtv='git tag | sort -V'
|
||||
|
||||
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 glum='git pull upstream master'
|
||||
|
||||
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); git commit -m "--wip--"'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ if [ -z "$script" ]; then
|
|||
local -a locations
|
||||
local e
|
||||
locations=(
|
||||
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
|
||||
"$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash"
|
||||
'/etc/bash_completion.d/git' # fedora, old debian
|
||||
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
|
||||
'/usr/share/bash-completion/git' # gentoo
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ if [[ -x "${commands[gwhoami]}" ]]; then
|
|||
'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
|
||||
'gwhoami' 'gyes')
|
||||
|
||||
# Not part of coreutils, installed separately.
|
||||
# findutils
|
||||
gcmds+=('gfind' 'gxargs' 'glocate')
|
||||
|
||||
# Not part of either coreutils or findutils, installed separately.
|
||||
gcmds+=('gsed' 'gtar' 'gtime')
|
||||
|
||||
for gcmd in "${gcmds[@]}"; do
|
||||
|
|
|
|||
|
|
@ -54,23 +54,42 @@ __go_tool_complete() {
|
|||
'-installsuffix[suffix to add to package directory]:suffix'
|
||||
'-tags[list of build tags to consider satisfied]:tags'
|
||||
)
|
||||
__go_list() {
|
||||
local expl importpaths
|
||||
declare -a importpaths
|
||||
importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
|
||||
_wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
|
||||
__go_packages() {
|
||||
local gopaths
|
||||
declare -a gopaths
|
||||
gopaths=("${(s/:/)$(go env GOPATH)}")
|
||||
gopaths+=("$(go env GOROOT)")
|
||||
for p in $gopaths; do
|
||||
_path_files -W "$p/src" -/
|
||||
done
|
||||
}
|
||||
__go_identifiers() {
|
||||
compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null)
|
||||
}
|
||||
case ${words[2]} in
|
||||
clean|doc)
|
||||
_arguments -s -w : '*:importpaths:__go_list'
|
||||
doc)
|
||||
_arguments -s -w \
|
||||
"-c[symbol matching honors case (paths not affected)]" \
|
||||
"-cmd[show symbols with package docs even if package is a command]" \
|
||||
"-u[show unexported symbols as well as exported]" \
|
||||
"2:importpaths:__go_packages" \
|
||||
":next identifiers:__go_identifiers"
|
||||
;;
|
||||
clean)
|
||||
_arguments -s -w \
|
||||
"-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \
|
||||
"-n[print the remove commands it would execute, but not run them]" \
|
||||
"-r[apply recursively to all the dependencies of the packages named by the import paths]" \
|
||||
"-x[print remove commands as it executes them]" \
|
||||
"*:importpaths:__go_packages"
|
||||
;;
|
||||
fix|fmt|list|vet)
|
||||
_alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
|
||||
_alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"'
|
||||
;;
|
||||
install)
|
||||
_arguments -s -w : ${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
'*:importpaths:__go_list'
|
||||
'*:importpaths:__go_packages'
|
||||
;;
|
||||
get)
|
||||
_arguments -s -w : \
|
||||
|
|
@ -81,7 +100,7 @@ __go_tool_complete() {
|
|||
${build_flags[@]} \
|
||||
"-v[show package names]" \
|
||||
"-o[output file]:file:_files" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
"*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
test)
|
||||
_arguments -s -w : \
|
||||
|
|
@ -103,7 +122,7 @@ __go_tool_complete() {
|
|||
"-cpuprofile[write CPU profile to file]:file:_files" \
|
||||
"-memprofile[write heap profile to file]:file:_files" \
|
||||
"-memprofilerate[set heap profiling rate]:number" \
|
||||
"*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
|
||||
"*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
|
||||
;;
|
||||
help)
|
||||
_values "${commands[@]}" \
|
||||
|
|
|
|||
29
plugins/golang/templates/package.txt
Normal file
29
plugins/golang/templates/package.txt
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{{with .PDoc}}{{/*
|
||||
|
||||
Constants
|
||||
---------------------------------------
|
||||
|
||||
*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
|
||||
|
||||
Variables
|
||||
---------------------------------------
|
||||
|
||||
*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
|
||||
|
||||
Functions
|
||||
---------------------------------------
|
||||
|
||||
*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/*
|
||||
|
||||
Types
|
||||
---------------------------------------
|
||||
|
||||
*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/*
|
||||
|
||||
*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/*
|
||||
|
||||
*/}}{{range .Funcs}}{{.Name}} {{end}}{{/*
|
||||
|
||||
*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/*
|
||||
|
||||
*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}}
|
||||
0
plugins/golang/templates/search.txt
Normal file
0
plugins/golang/templates/search.txt
Normal file
|
|
@ -1,6 +1,6 @@
|
|||
#!zsh
|
||||
##############################################################################
|
||||
# A descriptive listing of core Gradle commands
|
||||
# A descriptive listing of core Gradle commands
|
||||
############################################################################
|
||||
function _gradle_core_commands() {
|
||||
local ret=1 state
|
||||
|
|
@ -32,14 +32,22 @@ function _gradle_arguments() {
|
|||
'--stop[Stop the Gradle daemon]' \
|
||||
'--daemon[Use the Gradle daemon]' \
|
||||
'--no-daemon[Do not use the Gradle daemon]' \
|
||||
'--no-opt[Do not perform any task optimization]' \
|
||||
'--rerun-task [Specifies that any task optimization is ignored.]' \
|
||||
'-i[Log at the info level]' \
|
||||
'-m[Dry run]' \
|
||||
'-P[Set a project property]' \
|
||||
'-p[Specifies the start directory]' \
|
||||
'--profile[Profile the build time]' \
|
||||
'-q[Log at the quiet level (only show errors)]' \
|
||||
'-v[Print the Gradle version info]' \
|
||||
'-x[Specify a task to be excluded]' \
|
||||
'-b[Specifies the build file.]' \
|
||||
'-c[Specifies the settings file.]' \
|
||||
'--continue[Continues task execution after a task failure.]' \
|
||||
'-g[Specifies the Gradle user home directory.]' \
|
||||
'-I[Specifies an initialization script.]' \
|
||||
'--refresh-dependencies[Refresh the state of dependencies.]' \
|
||||
'-u[Don''t search in parent directories for a settings.gradle file.]' \
|
||||
'*::command:->command' \
|
||||
&& return 0
|
||||
}
|
||||
|
|
@ -72,7 +80,7 @@ _gradle_tasks () {
|
|||
if [ in_gradle ]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
|
||||
gradle tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache`
|
||||
fi
|
||||
|
|
@ -82,7 +90,7 @@ _gradlew_tasks () {
|
|||
if [ in_gradle ]; then
|
||||
_gradle_arguments
|
||||
if _gradle_does_task_list_need_generating; then
|
||||
gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
|
||||
./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache
|
||||
fi
|
||||
compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache`
|
||||
fi
|
||||
|
|
|
|||
29
plugins/gulp/gulp.plugin.zsh
Normal file
29
plugins/gulp/gulp.plugin.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
#
|
||||
# gulp-autocompletion-zsh
|
||||
#
|
||||
# Autocompletion for your gulp.js tasks
|
||||
#
|
||||
# Copyright(c) 2014 André König <andre.koenig@posteo.de>
|
||||
# MIT Licensed
|
||||
#
|
||||
|
||||
#
|
||||
# André König
|
||||
# Github: https://github.com/akoenig
|
||||
# Twitter: https://twitter.com/caiifr
|
||||
#
|
||||
|
||||
#
|
||||
# Grabs all available tasks from the `gulpfile.js`
|
||||
# in the current directory.
|
||||
#
|
||||
function $$gulp_completion {
|
||||
compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)"
|
||||
|
||||
completions=(${=compls})
|
||||
compadd -- $completions
|
||||
}
|
||||
|
||||
compdef $$gulp_completion gulp
|
||||
|
|
@ -143,5 +143,6 @@ _arguments \
|
|||
$_command_args \
|
||||
'(--app)--app[the app name]' \
|
||||
'(--remote)--remote[the remote name]' \
|
||||
'(--help)--help[help about the current command]' \
|
||||
&& return 0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
To activate this script, please include it the `plugins` variable within `~/.zshrc`
|
||||
|
||||
`plugins=(git history-substring-search.zsh)`
|
||||
`plugins=(git history-substring-search)`
|
||||
|
||||
See the "history-substring-search.zsh" file for more information:
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@ fi
|
|||
# implementation details
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
setopt extendedglob
|
||||
zmodload -F zsh/parameter
|
||||
|
||||
#
|
||||
|
|
@ -284,6 +283,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then
|
|||
fi
|
||||
|
||||
function _history-substring-search-begin() {
|
||||
setopt localoptions extendedglob
|
||||
_history_substring_search_move_cursor_eol=false
|
||||
_history_substring_search_query_highlight=
|
||||
|
||||
|
|
@ -350,6 +350,7 @@ function _history-substring-search-begin() {
|
|||
}
|
||||
|
||||
function _history-substring-search-end() {
|
||||
setopt localoptions extendedglob
|
||||
_history_substring_search_result=$BUFFER
|
||||
|
||||
# move the cursor to the end of the command line
|
||||
|
|
|
|||
15
plugins/history/README.md
Normal file
15
plugins/history/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## history
|
||||
|
||||
Provides a couple of convenient aliases for using the `history` command to examine your command line history.
|
||||
|
||||
### Requirements
|
||||
|
||||
* None.
|
||||
|
||||
### Usage
|
||||
|
||||
* If `h` is called, your command history is listed. Equivalent to using `history`
|
||||
|
||||
* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided
|
||||
|
||||
* If `hsi` is called without an argument you will help on `grep` arguments
|
||||
6
plugins/httpie/README.md
Normal file
6
plugins/httpie/README.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
## HTTPie
|
||||
**Maintainer:** [lululau](https://github.com/lululau)
|
||||
|
||||
This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
|
||||
|
||||
[HTTPie Homepage](http://httpie.org)
|
||||
64
plugins/jira/README.md
Normal file
64
plugins/jira/README.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Jira plugin #
|
||||
|
||||
CLI support for JIRA interaction
|
||||
|
||||
## Description ##
|
||||
|
||||
This plugin provides command line tools for interacting with Atlassian's [JIRA](https://www.atlassian.com/software/jira) bug tracking software.
|
||||
|
||||
The interaction is all done through the web. No local installation of JIRA is necessary.
|
||||
|
||||
In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` refers to the command this plugin supplies.
|
||||
|
||||
## Usage ##
|
||||
|
||||
This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser.
|
||||
|
||||
```
|
||||
jira # performs the default action
|
||||
|
||||
jira new # opens a new issue
|
||||
jira dashboard # opens your JIRA dashboard
|
||||
jira reported [username] # queries for issues reported by a user
|
||||
jira assigned [username] # queries for issues assigned to a user
|
||||
jira ABC-123 # opens an existing issue
|
||||
jira ABC-123 m # opens an existing issue for adding a comment
|
||||
```
|
||||
|
||||
#### Debugging usage ####
|
||||
|
||||
These calling forms are for developers' use, and may change at any time.
|
||||
|
||||
```
|
||||
jira dumpconfig # displays the effective configuration
|
||||
```
|
||||
|
||||
## Setup ##
|
||||
|
||||
The URL for your JIRA instance is set by `$JIRA_URL` or a `.jira_url` file.
|
||||
|
||||
Add a `.jira-url` file in the base of your project. You can also set `$JIRA_URL` in your `~/.zshrc` or put a `.jira-url` in your home directory. A `.jira-url` in the current directory takes precedence, so you can make per-project customizations.
|
||||
|
||||
The same goes with `.jira-prefix` and `$JIRA_PREFIX`. These control the prefix added to all issue IDs, which differentiates projects within a JIRA instance.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
cd to/my/project
|
||||
echo "https://jira.atlassian.com" >> .jira-url
|
||||
```
|
||||
|
||||
(Note: The current implementation only looks in the current directory for `.jira-url` and `.jira-prefix`, not up the path, so if you are in a subdirectory of your project, it will fall back to your default JIRA URL. This will probably change in the future though.)
|
||||
|
||||
### Variables ###
|
||||
|
||||
* `$JIRA_URL` - Your JIRA instance's URL
|
||||
* `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches
|
||||
* `$JIRA_PREFIX` - Prefix added to issue ID arguments
|
||||
* `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board
|
||||
* `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new"
|
||||
|
||||
|
||||
### Browser ###
|
||||
|
||||
Your default web browser, as determined by how `open_command` handles `http://` URLs, is used for interacting with the JIRA instance. If you change your system's URL handler associations, it will change the browser that `jira` uses.
|
||||
22
plugins/jira/_jira
Normal file
22
plugins/jira/_jira
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#compdef jira
|
||||
#autoload
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'new:create a new issue'
|
||||
'dashboard:open the dashboard'
|
||||
'reported:search for issues reported by a user'
|
||||
'assigned:search for issues assigned to a user'
|
||||
'dumpconfig:display effective jira configuration'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "jira subcommand" _1st_arguments
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,90 +1,102 @@
|
|||
# To use: add a .jira-url file in the base of your project
|
||||
# You can also set JIRA_URL in your .zshrc or put .jira-url in your home directory
|
||||
# .jira-url in the current directory takes precedence
|
||||
# CLI support for JIRA interaction
|
||||
#
|
||||
# If you use Rapid Board, set:
|
||||
#JIRA_RAPID_BOARD="true"
|
||||
# in you .zshrc
|
||||
#
|
||||
# Setup: cd to/my/project
|
||||
# echo "https://name.jira.com" >> .jira-url
|
||||
# Usage: jira # opens a new issue
|
||||
# jira ABC-123 # Opens an existing issue
|
||||
open_jira_issue () {
|
||||
local open_cmd
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
open_cmd='open'
|
||||
else
|
||||
open_cmd='xdg-open'
|
||||
fi
|
||||
# See README.md for details
|
||||
|
||||
if [ -f .jira-url ]; then
|
||||
: ${JIRA_DEFAULT_ACTION:=new}
|
||||
|
||||
function jira() {
|
||||
emulate -L zsh
|
||||
local action=${1:=$JIRA_DEFAULT_ACTION}
|
||||
|
||||
local jira_url jira_prefix
|
||||
if [[ -f .jira-url ]]; then
|
||||
jira_url=$(cat .jira-url)
|
||||
elif [ -f ~/.jira-url ]; then
|
||||
elif [[ -f ~/.jira-url ]]; then
|
||||
jira_url=$(cat ~/.jira-url)
|
||||
elif [[ "x$JIRA_URL" != "x" ]]; then
|
||||
jira_url=$JIRA_URL
|
||||
elif [[ -n "${JIRA_URL}" ]]; then
|
||||
jira_url=${JIRA_URL}
|
||||
else
|
||||
echo "JIRA url is not specified anywhere."
|
||||
_jira_url_help
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -f .jira-prefix ]; then
|
||||
if [[ -f .jira-prefix ]]; then
|
||||
jira_prefix=$(cat .jira-prefix)
|
||||
elif [ -f ~/.jira-prefix ]; then
|
||||
elif [[ -f ~/.jira-prefix ]]; then
|
||||
jira_prefix=$(cat ~/.jira-prefix)
|
||||
elif [[ -n "${JIRA_PREFIX}" ]]; then
|
||||
jira_prefix=${JIRA_PREFIX}
|
||||
else
|
||||
jira_prefix=""
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
|
||||
if [[ $action == "new" ]]; then
|
||||
echo "Opening new issue"
|
||||
$open_cmd "${jira_url}/secure/CreateIssue!default.jspa"
|
||||
elif [[ "$1" = "assigned" || "$1" = "reported" ]]; then
|
||||
jira_query $@
|
||||
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
||||
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
||||
_jira_query $@
|
||||
elif [[ "$action" == "dashboard" ]]; then
|
||||
echo "Opening dashboard"
|
||||
open_command "${jira_url}/secure/Dashboard.jspa"
|
||||
elif [[ "$action" == "dumpconfig" ]]; then
|
||||
echo "JIRA_URL=$jira_url"
|
||||
echo "JIRA_PREFIX=$jira_prefix"
|
||||
echo "JIRA_NAME=$JIRA_NAME"
|
||||
echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD"
|
||||
echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION"
|
||||
else
|
||||
echo "Opening issue #$1"
|
||||
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
|
||||
$open_cmd "$jira_url/issues/$jira_prefix$1"
|
||||
# Anything that doesn't match a special action is considered an issue name
|
||||
local issue_arg=$action
|
||||
local issue="${jira_prefix}${issue_arg}"
|
||||
local url_fragment=''
|
||||
if [[ "$2" == "m" ]]; then
|
||||
url_fragment="#add-comment"
|
||||
echo "Add comment to issue #$issue"
|
||||
else
|
||||
$open_cmd "$jira_url/browse/$jira_prefix$1"
|
||||
echo "Opening issue #$issue"
|
||||
fi
|
||||
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then
|
||||
open_command "${jira_url}/issues/${issue}${url_fragment}"
|
||||
else
|
||||
open_command "${jira_url}/browse/${issue}${url_fragment}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
jira_name () {
|
||||
if [[ -z "$1" ]]; then
|
||||
if [[ "x${JIRA_NAME}" != "x" ]]; then
|
||||
jira_name=${JIRA_NAME}
|
||||
else
|
||||
echo "JIRA_NAME not specified"
|
||||
return 1
|
||||
fi
|
||||
function _jira_url_help() {
|
||||
cat << EOF
|
||||
error: JIRA URL is not specified anywhere.
|
||||
|
||||
Valid options, in order of precedence:
|
||||
.jira-url file
|
||||
\$HOME/.jira-url file
|
||||
\$JIRA_URL environment variable
|
||||
EOF
|
||||
}
|
||||
|
||||
function _jira_query() {
|
||||
emulate -L zsh
|
||||
local verb="$1"
|
||||
local jira_name lookup preposition query
|
||||
if [[ "${verb}" == "reported" ]]; then
|
||||
lookup=reporter
|
||||
preposition=by
|
||||
elif [[ "${verb}" == "assigned" ]]; then
|
||||
lookup=assignee
|
||||
preposition=to
|
||||
else
|
||||
jira_name=$@
|
||||
echo "error: not a valid lookup: $verb" >&2
|
||||
return 1
|
||||
fi
|
||||
jira_name=${2:=$JIRA_NAME}
|
||||
if [[ -z $jira_name ]]; then
|
||||
echo "error: JIRA_NAME not specified" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Browsing issues ${verb} ${preposition} ${jira_name}"
|
||||
query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
|
||||
open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}"
|
||||
}
|
||||
|
||||
jira_query () {
|
||||
verb="$1"
|
||||
if [[ "${verb}" = "reported" ]]; then
|
||||
lookup=reporter
|
||||
preposition=by
|
||||
elif [[ "${verb}" = "assigned" ]]; then
|
||||
lookup=assignee
|
||||
preposition=to
|
||||
else
|
||||
echo "not a valid lookup $verb"
|
||||
return 1
|
||||
fi
|
||||
shift 1
|
||||
jira_name $@
|
||||
if [[ $? = 1 ]]; then
|
||||
return 1
|
||||
fi
|
||||
echo "Browsing issues ${verb} ${preposition} ${jira_name}"
|
||||
$open_cmd "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC"
|
||||
}
|
||||
|
||||
alias jira='open_jira_issue'
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ jump() {
|
|||
}
|
||||
|
||||
mark() {
|
||||
if (( $# == 0 )); then
|
||||
if [[ ( $# == 0 ) || ( "$1" == "." ) ]]; then
|
||||
MARK=$(basename "$PWD")
|
||||
else
|
||||
MARK="$1"
|
||||
|
|
|
|||
41
plugins/kitchen/_kitchen
Normal file
41
plugins/kitchen/_kitchen
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# author: Peter Eisentraut
|
||||
# source: https://gist.github.com/petere/10307599
|
||||
# compdef kitchen
|
||||
|
||||
_kitchen() {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments '1: :->cmds'\
|
||||
'2: :->args'
|
||||
|
||||
case $state in
|
||||
cmds)
|
||||
_arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)"
|
||||
;;
|
||||
args)
|
||||
case $line[1] in
|
||||
converge|create|destroy|diagnose|list|setup|test|verify)
|
||||
compadd "$@" all
|
||||
_kitchen_instances
|
||||
;;
|
||||
login)
|
||||
_kitchen_instances
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_kitchen_instances() {
|
||||
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
|
||||
unset _kitchen_instances_cache
|
||||
fi
|
||||
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
|
||||
_kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"})
|
||||
_kitchen_instances_cache_dir=$PWD
|
||||
fi
|
||||
compadd -a _kitchen_instances_cache
|
||||
}
|
||||
|
||||
_kitchen "$@"
|
||||
|
|
@ -15,6 +15,6 @@ compdef _laravel5 la5
|
|||
#Alias
|
||||
alias la5='php artisan'
|
||||
|
||||
alias la5dump='php artisan dump-autoload'
|
||||
alias la5cache='php artisan cache:clear'
|
||||
alias la5routes='php artisan routes'
|
||||
alias la5routes='php artisan route:list'
|
||||
alias la5vendor='php artisan vendor:publish'
|
||||
|
|
|
|||
|
|
@ -8,14 +8,15 @@ mkdir -p $ZSH_CACHE_DIR
|
|||
cache_file="$ZSH_CACHE_DIR/last-working-dir"
|
||||
|
||||
# Updates the last directory once directory is changed.
|
||||
function chpwd() {
|
||||
chpwd_functions+=(chpwd_last_working_dir)
|
||||
function chpwd_last_working_dir() {
|
||||
# Use >| in case noclobber is set to avoid "file exists" error
|
||||
pwd >| "$cache_file"
|
||||
}
|
||||
|
||||
# Changes directory to the last working directory.
|
||||
function lwd() {
|
||||
[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"`
|
||||
[[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`"
|
||||
}
|
||||
|
||||
# Automatically jump to last working directory unless this isn't the first time
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ open_lighthouse_ticket () {
|
|||
else
|
||||
lighthouse_url=$(cat .lighthouse-url);
|
||||
echo "Opening ticket #$1";
|
||||
`open $lighthouse_url/tickets/$1`;
|
||||
open_command "$lighthouse_url/tickets/$1";
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
27
plugins/man/man.zsh
Normal file
27
plugins/man/man.zsh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Author
|
||||
# ------
|
||||
#
|
||||
# * Jerry Ling<jerryling315@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Usgae
|
||||
# -----
|
||||
#
|
||||
# man will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
man-command-line() {
|
||||
[[ -z $BUFFER ]] && zle up-history
|
||||
[[ $BUFFER != man\ * ]] && LBUFFER="man $LBUFFER"
|
||||
}
|
||||
zle -N man-command-line
|
||||
# Defined shortcut keys: [Esc]man
|
||||
bindkey "\e"man man-command-line
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Also, you might want to use man-preview included in 'osx' plugin
|
||||
# just substitute "man" in the function with "man-preview" after you included OS X in
|
||||
# the .zshrc
|
||||
64
plugins/mercurial/README.md
Normal file
64
plugins/mercurial/README.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# Mercurial plugin
|
||||
### Usage
|
||||
Update .zshrc:
|
||||
|
||||
1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)`
|
||||
(that is pretty obvious).
|
||||
2. Change PROMPT variable of current theme to contain current folder mercurial repo info:
|
||||
|
||||
robbyrussel theme is used by default, so you need to modify PROMPT var
|
||||
from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme)
|
||||
by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it
|
||||
looks next:
|
||||
|
||||
```diff
|
||||
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
```
|
||||
|
||||
and put modified var at the end of **.zshrc**.
|
||||
3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
|
||||
|
||||
```
|
||||
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
|
||||
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
|
||||
```
|
||||
|
||||
### What's inside?
|
||||
#### Adds handy aliases:
|
||||
###### general
|
||||
* `hgc` - `hg commit`
|
||||
* `hgb` - `hg branch`
|
||||
* `hgba` - `hg branches`
|
||||
* `hgbk` - `hg bookmarks`
|
||||
* `hgco` - `hg checkout`
|
||||
* `hgd` - `hg diff`
|
||||
* `hged` - `hg diffmerge`
|
||||
|
||||
###### pull and update
|
||||
* `hgi` - `hg incoming`
|
||||
* `hgl` - `hg pull -u`
|
||||
* `hglr` - `hg pull --rebase`
|
||||
* `hgo` - `hg outgoing`
|
||||
* `hgp` - `hg push`
|
||||
* `hgs` - `hg status`
|
||||
* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"`
|
||||
|
||||
###### this is the 'git commit --amend' equivalent
|
||||
* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip`
|
||||
|
||||
###### list unresolved files (since hg does not list unmerged files in the status command)
|
||||
* `hgun` - `hg resolve --list`
|
||||
|
||||
#### Displays repo branch and directory status in prompt
|
||||
This is the same as git plugin does.
|
||||
|
||||
**Note**: additional changes to **.zshrc** are required in order for this to
|
||||
work.
|
||||
|
||||
### Mantainers
|
||||
[ptrv](https://github.com/ptrv) - original creator
|
||||
|
||||
[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works
|
||||
28
plugins/mix-fast/README.md
Normal file
28
plugins/mix-fast/README.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# mix-fast
|
||||
|
||||
Fast mix autocompletion plugin.
|
||||
|
||||
This script caches the output for later usage and significantly speeds it up.
|
||||
It generates a .mix_tasks cache file for current project. Currently if you want
|
||||
to update cache you should remove .mix_tasks file
|
||||
|
||||
Inspired by and based on rake-fast zsh plugin.
|
||||
|
||||
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-mix-task-completion-for-zsh/).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Just add the plugin to your `.zshrc`:
|
||||
|
||||
```bash
|
||||
plugins=(foo bar mix-fast)
|
||||
```
|
||||
|
||||
You might consider adding `.mix_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore)
|
||||
|
||||
## Usage
|
||||
|
||||
`mix`, then press tab
|
||||
|
||||
Currently maintained by [styx](https://github.com/styx/)
|
||||
29
plugins/mix-fast/mix-fast.plugin.zsh
Normal file
29
plugins/mix-fast/mix-fast.plugin.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
_mix_refresh () {
|
||||
if [ -f .mix_tasks ]; then
|
||||
rm .mix_tasks
|
||||
fi
|
||||
echo "Generating .mix_tasks..." > /dev/stderr
|
||||
_mix_generate
|
||||
cat .mix_tasks
|
||||
}
|
||||
|
||||
_mix_does_task_list_need_generating () {
|
||||
[ ! -f .mix_tasks ];
|
||||
}
|
||||
|
||||
_mix_generate () {
|
||||
mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
|
||||
}
|
||||
|
||||
_mix () {
|
||||
if [ -f mix.exs ]; then
|
||||
if _mix_does_task_list_need_generating; then
|
||||
echo "\nGenerating .mix_tasks..." > /dev/stderr
|
||||
_mix_generate
|
||||
fi
|
||||
compadd `cat .mix_tasks`
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _mix mix
|
||||
alias mix_refresh='_mix_refresh'
|
||||
|
|
@ -1,28 +1,43 @@
|
|||
#compdef mix
|
||||
#compdef mix
|
||||
#autoload
|
||||
|
||||
# Elixir mix zsh completion
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'archive:Archive this project into a .ez file'
|
||||
'clean:Clean generated application files'
|
||||
'app.start:Start all registered apps'
|
||||
'archive:List all archives'
|
||||
'archive.build:Archive this project into a .ez file'
|
||||
'archive.install:Install an archive locally'
|
||||
'archive.uninstall:Uninstall archives'
|
||||
'clean:Delete generated application files'
|
||||
'cmd:Executes the given command'
|
||||
'compile:Compile source files'
|
||||
'compile.protocols:Consolidates all protocols in all paths'
|
||||
'deps:List dependencies and their status'
|
||||
"deps.clean:Remove dependencies' files"
|
||||
"deps.clean:Remove the given dependencies' files"
|
||||
'deps.compile:Compile dependencies'
|
||||
'deps.get:Get all out of date dependencies'
|
||||
'deps.unlock:Unlock the given dependencies'
|
||||
'deps.update:Update dependencies'
|
||||
'do:Executes the commands separated by comma'
|
||||
'escriptize:Generates an escript for the project'
|
||||
'deps.update:Update the given dependencies'
|
||||
'do:Executes the tasks separated by comma'
|
||||
'escript.build:Builds an escript for the project'
|
||||
'help:Print help information for tasks'
|
||||
'hex:Print hex help information'
|
||||
'hex.config:Read or update hex config'
|
||||
'hex.docs:Publish docs for package'
|
||||
'hex.info:Print hex information'
|
||||
'hex.key:Hex API key tasks'
|
||||
'hex.outdated:Shows outdated hex deps for the current project'
|
||||
'hex.owner:Hex package ownership tasks'
|
||||
'hex.publish:Publish a new package version'
|
||||
'hex.search:Search for package names'
|
||||
'hex.user:Hex user tasks'
|
||||
'loadconfig:Loads and persists the given configuration'
|
||||
'local:List local tasks'
|
||||
'local.install:Install a task or an archive locally'
|
||||
'local.hex:Install hex locally'
|
||||
'local.rebar:Install rebar locally'
|
||||
'local.uninstall:Uninstall local tasks or archives'
|
||||
'local.hex:Install Hex locally'
|
||||
'new:Creates a new Elixir project'
|
||||
'new:Create a new Elixir project'
|
||||
'run:Run the given file or expression'
|
||||
"test:Run a project's tests"
|
||||
'--help:Describe available tasks'
|
||||
|
|
@ -34,7 +49,7 @@ __task_list ()
|
|||
local expl
|
||||
declare -a tasks
|
||||
|
||||
tasks=(archive clean compile deps deps.clean deps.compile deps.get deps.unlock deps.update do escriptize help local local.install local.rebar local.uninstall new run test)
|
||||
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test)
|
||||
|
||||
_wanted tasks expl 'help' compadd $tasks
|
||||
}
|
||||
|
|
@ -57,7 +72,7 @@ case $state in
|
|||
(options)
|
||||
case $line[1] in
|
||||
(help)
|
||||
_arguments ':feature:__task_list'
|
||||
_arguments ':feature:__task_list'
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue