mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
Merge remote-tracking branch 'robby/master'
This commit is contained in:
commit
d06632d43b
316 changed files with 17119 additions and 3277 deletions
|
|
@ -16,13 +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)'
|
||||
'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)
|
||||
|
||||
---
|
||||
5
plugins/arcanist/README.md
Normal file
5
plugins/arcanist/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## arcanist
|
||||
|
||||
**Maintainer:** [@emzar](https://github.com/emzar)
|
||||
|
||||
This plugin adds many useful aliases.
|
||||
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
21
plugins/arcanist/arcanist.plugin.zsh
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
alias ara='arc amend'
|
||||
alias arb='arc branch'
|
||||
alias arco='arc cover'
|
||||
alias arci='arc commit'
|
||||
|
||||
alias ard='arc diff'
|
||||
alias ardnu='arc diff --nounit'
|
||||
alias ardnupc='arc diff --nounit --plan-changes'
|
||||
alias ardpc='arc diff --plan-changes'
|
||||
|
||||
alias are='arc export'
|
||||
alias arh='arc help'
|
||||
alias arl='arc land'
|
||||
alias arli='arc lint'
|
||||
alias arls='arc list'
|
||||
alias arpa='arc patch'
|
||||
69
plugins/archlinux/README.md
Normal file
69
plugins/archlinux/README.md
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# Archlinux plugin
|
||||
|
||||
## Features
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install packages from the repositories |
|
||||
| yains | yaourt -U | Install a package from a local file |
|
||||
| yainsd | yaourt -S --asdeps | Install packages as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for packages in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | yaourt -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for packages in the repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database |
|
||||
| yaupg | yaourt -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### PACMAN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------------|-----------------------------------------|--------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install packages from the repositories |
|
||||
| pacins | sudo pacman -U | Install a package from a local file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install packages as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a package in the local database |
|
||||
| paclocs | pacman -Qs | Search for packages in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove packages, keeping its settings and dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies |
|
||||
| pacrep | pacman -Si | Display information about a package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for packages 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 |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database |
|
||||
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | Locally trust all keys passed as parameters |
|
||||
|
||||
---
|
||||
|
||||
## 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
|
||||
|
|
@ -1,75 +1,75 @@
|
|||
# Archlinux zsh aliases and functions
|
||||
# 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 ! (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
else
|
||||
upgrade () {
|
||||
yaourt -Syu
|
||||
}
|
||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system.
|
||||
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
|
||||
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
||||
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
||||
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias yarep='yaourt -Si' # Display information about a given package in the repositories
|
||||
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
|
||||
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
|
||||
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
|
||||
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
|
||||
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
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which aur` ]]; then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt -Syua --noconfirm'
|
||||
alias yain='yaourt -S'
|
||||
alias yains='yaourt -U'
|
||||
alias yare='yaourt -R'
|
||||
alias yarem='yaourt -Rns'
|
||||
alias yarep='yaourt -Si'
|
||||
alias yareps='yaourt -Ss'
|
||||
alias yaloc='yaourt -Qi'
|
||||
alias yalocs='yaourt -Qs'
|
||||
alias yalst='yaourt -Qe'
|
||||
alias yaorph='yaourt -Qtd'
|
||||
alias yainsd='yaourt -S --asdeps'
|
||||
alias yamir='yaourt -Syy'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur'
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
alias yaupd='yaourt -Sy'
|
||||
fi
|
||||
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
else
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrep='pacman -Si' # Display information about a given package in the repositories
|
||||
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
|
||||
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
|
||||
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
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif [[ -x `which 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
|
||||
fi
|
||||
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
|
||||
# https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
paclist() {
|
||||
sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
|
||||
}
|
||||
|
||||
alias pacupg='sudo pacman -Syu'
|
||||
alias pacin='sudo pacman -S'
|
||||
alias pacins='sudo pacman -U'
|
||||
alias pacre='sudo pacman -R'
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
alias pacrep='pacman -Si'
|
||||
alias pacreps='pacman -Ss'
|
||||
alias pacloc='pacman -Qi'
|
||||
alias paclocs='pacman -Qs'
|
||||
alias pacinsd='sudo pacman -S --asdeps'
|
||||
alias pacmir='sudo pacman -Syy'
|
||||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur'
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
paclist() {
|
||||
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
|
||||
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
|
||||
}
|
||||
|
||||
pacdisowned() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
|
|
@ -79,21 +79,21 @@ pacdisowned() {
|
|||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr \
|
||||
! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
# Get all keys for developers and trusted users
|
||||
curl https://www.archlinux.org/{developers,trustedusers}/ |
|
||||
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
|
||||
xargs sudo pacman-key --recv-keys
|
||||
emulate -L zsh
|
||||
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
|
||||
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
|
||||
xargs sudo pacman-key --recv-keys
|
||||
}
|
||||
|
||||
pacmansignkeys() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
|
|
|
|||
27
plugins/asdf/README.md
Normal file
27
plugins/asdf/README.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
## asdf
|
||||
|
||||
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
|
||||
1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`.
|
||||
|
||||
```
|
||||
plugins=(asdf)
|
||||
```
|
||||
|
||||
2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following:
|
||||
```
|
||||
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf:
|
||||
|
||||
```
|
||||
asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git
|
||||
asdf install nodejs 5.9.1
|
||||
```
|
||||
7
plugins/asdf/asdf.plugin.zsh
Normal file
7
plugins/asdf/asdf.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Find where asdf should be installed.
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
|
||||
# Load asdf, if found.
|
||||
if [ -f $ASDF_DIR/asdf.sh ]; then
|
||||
. $ASDF_DIR/asdf.sh
|
||||
fi
|
||||
|
|
@ -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
|
||||
|
|
|
|||
6
plugins/boot2docker/README.md
Normal file
6
plugins/boot2docker/README.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
## Boot2docker autocomplete plugin
|
||||
|
||||
- Adds autocomplete options for all boot2docker commands.
|
||||
|
||||
|
||||
Maintainer : Manfred Touron ([@moul](https://github.com/moul))
|
||||
73
plugins/boot2docker/_boot2docker
Normal file
73
plugins/boot2docker/_boot2docker
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#compdef boot2docker
|
||||
|
||||
# Boot2docker autocompletion for oh-my-zsh
|
||||
# Requires: Boot2docker installed
|
||||
# Author: Manfred Touron (@moul)
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
"init":"Create a new Boot2Docker VM."
|
||||
"up":"Start VM from any states."
|
||||
"start":"Start VM from any states."
|
||||
"boot":"Start VM from any states."
|
||||
"ssh":"[ssh-command] Login to VM via SSH."
|
||||
"save":"Suspend VM and save state to disk."
|
||||
"suspend":"Suspend VM and save state to disk."
|
||||
"down":"Gracefully shutdown the VM."
|
||||
"stop":"Gracefully shutdown the VM."
|
||||
"halt":"Gracefully shutdown the VM."
|
||||
"restart":"Gracefully reboot the VM."
|
||||
"poweroff":"Forcefully power off the VM (may corrupt disk image)."
|
||||
"reset":"Forcefully power cycle the VM (may corrupt disk image)."
|
||||
"delete":"Delete Boot2Docker VM and its disk image."
|
||||
"destroy":"Delete Boot2Docker VM and its disk image."
|
||||
"config":"Show selected profile file settings."
|
||||
"cfg":"Show selected profile file settings."
|
||||
"info":"Display detailed information of VM."
|
||||
"ip":"Display the IP address of the VM's Host-only network."
|
||||
"socket":"Display the DOCKER_HOST socket to connect to."
|
||||
"shellinit":"Display the shell command to set up the Docker client."
|
||||
"status":"Display current state of VM."
|
||||
"download":"Download Boot2Docker ISO image."
|
||||
"upgrade":"Upgrade the Boot2Docker ISO image (restart if running)."
|
||||
"version":"Display version information."
|
||||
)
|
||||
|
||||
_arguments \
|
||||
'(--basevmdk)--basevmdk[Path to VMDK to use as base for persistent partition]' \
|
||||
'(--cpus)'{-c,--cpus}'[number of CPUs for boot2docker.]' \
|
||||
'(--clobber)--clobber[overwrite Docker client binary on boot2docker upgrade]' \
|
||||
'(--dhcp)--dhcp[enable VirtualBox host-only network DHCP.]' \
|
||||
'(--dhcpip)--dhcpip[VirtualBox host-only network DHCP server address.]' \
|
||||
'(-s --disksize)'{-s,--disksize}'[boot2docker disk image size (in MB).]' \
|
||||
'(--dockerport)--dockerport[host Docker port (forward to port 2376 in VM). (deprecated - use with care)]' \
|
||||
'(--driver)--driver[hypervisor driver.]' \
|
||||
'(--force-upgrade-download)--force-upgrade-download[always download on boot2docker upgrade, never skip.]' \
|
||||
'(--hostip)--hostip[VirtualBox host-only network IP address.]' \
|
||||
'(--iso)--iso[path to boot2docker ISO image.]' \
|
||||
'(--iso-url)--iso-url[/api.github.com/repos/boot2docker/boot2docker/releases": source URL to provision the boot2docker ISO image.]' \
|
||||
'(--lowerip)--lowerip[VirtualBox host-only network DHCP lower bound.]' \
|
||||
'(--memory)'{-m,--memory}'[virtual machine memory size (in MB).]' \
|
||||
'(--netmask)--netmask[VirtualBox host-only network mask.]' \
|
||||
'(--no-dummy)--no-dummy[Example parameter for the dummy driver.]' \
|
||||
'(--retries)--retries[number of port knocking retries during 'start']' \
|
||||
'(--serial)--serial[try serial console to get IP address (experimental)]' \
|
||||
'(--serialfile)--serialfile[path to the serial socket/pipe.]' \
|
||||
'(--ssh)--ssh[path to SSH client utility.]' \
|
||||
'(--ssh-keygen)--ssh-keygen[path to ssh-keygen utility.]' \
|
||||
'(--sshkey)--sshkey[path to SSH key to use.]' \
|
||||
'(--sshport)--sshport[host SSH port (forward to port 22 in VM).]' \
|
||||
'(--upperip)--upperip[VirtualBox host-only network DHCP upper bound.]' \
|
||||
'(--vbm)--vbm[path to VirtualBox management utility.]' \
|
||||
'(--vbox-share)--vbox-share[(defaults to "/Users=Users" if no shares are specified; use "disable" to explicitly prevent any shares from being created) List of directories to share during "up|start|boot" via VirtualBox Guest Additions, with optional labels]' \
|
||||
'(--verbose)'{-v,--verbose}'[display verbose command invocations.]' \
|
||||
'(--vm)--vm[virtual machine name.]' \
|
||||
'(--waittime)--waittime[Time in milliseconds to wait between port knocking retries during 'start']' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
#_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "boot2docker command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
|
@ -72,6 +72,7 @@ _bower ()
|
|||
compadd "$@" $(echo $bower_package_list)
|
||||
;;
|
||||
*)
|
||||
_arguments \
|
||||
$_no_color \
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
33
plugins/branch/README.md
Normal file
33
plugins/branch/README.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Branch
|
||||
|
||||
Displays the current Git or Mercurial branch fast.
|
||||
|
||||
## Speed test
|
||||
|
||||
### Mercurial
|
||||
|
||||
```shell
|
||||
$ time hg branch
|
||||
0.11s user 0.14s system 70% cpu 0.355 total
|
||||
```
|
||||
|
||||
### Branch plugin
|
||||
|
||||
```shell
|
||||
$ time zsh /tmp/branch_prompt_info_test.zsh
|
||||
0.00s user 0.01s system 78% cpu 0.014 total
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`)
|
||||
adding `$(branch_prompt_info)` in your prompt like this:
|
||||
|
||||
```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)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
```
|
||||
|
||||
## Maintainer
|
||||
|
||||
Victor Torres (<vpaivatorres@gmail.com>)
|
||||
31
plugins/branch/branch.plugin.zsh
Normal file
31
plugins/branch/branch.plugin.zsh
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Branch: displays the current Git or Mercurial branch fast.
|
||||
# Victor Torres <vpaivatorres@gmail.com>
|
||||
# Oct 2, 2015
|
||||
|
||||
function branch_prompt_info() {
|
||||
# Defines path as current directory
|
||||
local current_dir=$PWD
|
||||
# While current path is not root path
|
||||
while [[ $current_dir != '/' ]]
|
||||
do
|
||||
# Git repository
|
||||
if [[ -d "${current_dir}/.git" ]]
|
||||
then
|
||||
echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/}
|
||||
return;
|
||||
fi
|
||||
# Mercurial repository
|
||||
if [[ -d "${current_dir}/.hg" ]]
|
||||
then
|
||||
if [[ -f "$current_dir/.hg/branch" ]]
|
||||
then
|
||||
echo '☿' $(<"$current_dir/.hg/branch")
|
||||
else
|
||||
echo '☿ default'
|
||||
fi
|
||||
return;
|
||||
fi
|
||||
# Defines path as parent directory and keeps looking for :)
|
||||
current_dir="${current_dir:h}"
|
||||
done
|
||||
}
|
||||
|
|
@ -1,7 +1,13 @@
|
|||
#compdef brew
|
||||
#autoload
|
||||
|
||||
# imported from the latest homebrew contributions
|
||||
# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh
|
||||
|
||||
# Brew ZSH completion function
|
||||
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
|
||||
# and rename it _brew
|
||||
#
|
||||
# altered from _fink
|
||||
|
||||
_brew_all_formulae() {
|
||||
formulae=(`brew search`)
|
||||
|
|
@ -15,6 +21,14 @@ _brew_installed_taps() {
|
|||
installed_taps=(`brew tap`)
|
||||
}
|
||||
|
||||
_brew_official_taps() {
|
||||
official_taps=(`brew tap --list-official`)
|
||||
}
|
||||
|
||||
_brew_pinned_taps() {
|
||||
pinned_taps=(`brew tap --list-pinned`)
|
||||
}
|
||||
|
||||
_brew_outdated_formulae() {
|
||||
outdated_formulae=(`brew outdated`)
|
||||
}
|
||||
|
|
@ -25,8 +39,10 @@ _1st_arguments=(
|
|||
'cat:display formula file for a formula'
|
||||
'cleanup:uninstall unused and old versions of packages'
|
||||
'commands:show a list of commands'
|
||||
'config:show homebrew and system configuration'
|
||||
'create:create a new formula'
|
||||
'deps:list dependencies of a formula'
|
||||
'deps:list dependencies and dependants of a formula'
|
||||
'desc:display a description of a formula'
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
|
|
@ -35,41 +51,47 @@ _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'
|
||||
'linkapps:symlink .app bundles provided by formulae into /Applications'
|
||||
'list:list files in a formula or not-installed formulae'
|
||||
'log:git commit log for a formula'
|
||||
'missing:check all installed formuale for missing dependencies.'
|
||||
'migrate:migrate renamed formula to new name'
|
||||
'outdated:list formulae for which a newer version is available'
|
||||
'pin:pin specified formulae'
|
||||
'postinstall:perform post_install for a given formula'
|
||||
'prune:remove dead links'
|
||||
'remove:remove a formula'
|
||||
'search:search for a formula (/regex/ or string)'
|
||||
'switch:switch linkage between installed versions of a formula'
|
||||
'switch:switch between different versions of a formula'
|
||||
'tap:tap a new formula repository from GitHub, or list existing taps'
|
||||
'tap-info:information about a tap'
|
||||
'tap-pin:pin a tap'
|
||||
'tap-unpin:unpin a tap'
|
||||
'test-bot:test a formula and build a bottle'
|
||||
'uninstall:uninstall a formula'
|
||||
'unlink:unlink a formula'
|
||||
'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
|
||||
'unpin:unpin specified formulae'
|
||||
'untap:remove a tapped repository'
|
||||
'update:pull latest repository'
|
||||
'update:fetch latest version of Homebrew and all formulae'
|
||||
'upgrade:upgrade outdated formulae'
|
||||
'uses:show formulae which depend on a formula'
|
||||
`brew commands --quiet --include-aliases`
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a formulae installed_formulae installed_taps outdated_formulae
|
||||
local -a formulae installed_formulae installed_taps official_taps outdated_formulae
|
||||
|
||||
_arguments \
|
||||
'(-v)-v[verbose]' \
|
||||
'(--cellar)--cellar[brew cellar]' \
|
||||
'(--config)--config[brew configuration]' \
|
||||
'(--env)--env[brew environment]' \
|
||||
'(--repository)--repository[brew repository]' \
|
||||
'(--version)--version[version information]' \
|
||||
'(--prefix)--prefix[where brew lives on this system]' \
|
||||
'(--cache)--cache[brew cache]' \
|
||||
'(--force)--force[brew force]' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
|
|
@ -78,9 +100,18 @@ if (( CURRENT == 1 )); then
|
|||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
|
||||
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
|
||||
_brew_all_formulae
|
||||
_wanted formulae expl 'all formulae' compadd -a formulae ;;
|
||||
linkapps|unlinkapps)
|
||||
_arguments \
|
||||
'(--local)--local[operate on ~/Applications instead of /Applications]' \
|
||||
'1: :->forms' && return 0
|
||||
|
||||
if [[ "$state" == forms ]]; then
|
||||
_brew_installed_formulae
|
||||
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
|
||||
fi ;;
|
||||
list|ls)
|
||||
_arguments \
|
||||
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
|
||||
|
|
@ -99,9 +130,15 @@ case "$words[1]" in
|
|||
_arguments \
|
||||
'(--macports)--macports[search the macports repository]' \
|
||||
'(--fink)--fink[search the fink repository]' ;;
|
||||
untap)
|
||||
untap|tap-info|tap-pin)
|
||||
_brew_installed_taps
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||
tap)
|
||||
_brew_official_taps
|
||||
_wanted official_taps expl 'official taps' compadd -a official_taps ;;
|
||||
tap-unpin)
|
||||
_brew_pinned_taps
|
||||
_wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;;
|
||||
upgrade)
|
||||
_brew_outdated_formulae
|
||||
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
alias brews='brew list -1'
|
||||
alias bubu="brew update && brew upgrade && brew cleanup"
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bubu='bubo && bubc'
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
- `bl` aliased to `bundle list`
|
||||
- `bp` aliased to `bundle package`
|
||||
- `bo` aliased to `bundle open`
|
||||
- `bout` aliased to `bundle outdated`
|
||||
- `bu` aliased to `bundle update`
|
||||
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
|
||||
- adds a wrapper for common gems:
|
||||
|
|
@ -39,7 +40,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`
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@ alias be="bundle exec"
|
|||
alias bl="bundle list"
|
||||
alias bp="bundle package"
|
||||
alias bo="bundle open"
|
||||
alias bout="bundle outdated"
|
||||
alias bu="bundle update"
|
||||
alias bi="bundle_install"
|
||||
alias bcn="bundle clean"
|
||||
|
||||
bundled_commands=(
|
||||
annotate
|
||||
|
|
@ -56,7 +58,7 @@ bundle_install() {
|
|||
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
|
||||
if [[ "$OSTYPE" = darwin* ]]
|
||||
then
|
||||
local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
|
||||
local cores_num="$(sysctl -n hw.ncpu)"
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
|
|
|
|||
38
plugins/cakephp3/cakephp3.plugin.zsh
Normal file
38
plugins/cakephp3/cakephp3.plugin.zsh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# CakePHP 3 basic command completion
|
||||
_cakephp3_get_command_list () {
|
||||
bin/cake Completion commands
|
||||
}
|
||||
|
||||
_cakephp3_get_sub_command_list () {
|
||||
bin/cake Completion subcommands ${words[2]}
|
||||
}
|
||||
|
||||
_cakephp3_get_3rd_argument () {
|
||||
bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}'
|
||||
}
|
||||
|
||||
_cakephp3 () {
|
||||
local -a has3rdargument
|
||||
has3rdargument=("all" "controller" "fixture" "model" "template")
|
||||
if [ -f bin/cake ]; then
|
||||
if (( CURRENT == 2 )); then
|
||||
compadd $(_cakephp3_get_command_list)
|
||||
fi
|
||||
if (( CURRENT == 3 )); then
|
||||
compadd $(_cakephp3_get_sub_command_list)
|
||||
fi
|
||||
if (( CURRENT == 4 )); then
|
||||
if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then
|
||||
compadd $(_cakephp3_get_3rd_argument)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _cakephp3 bin/cake
|
||||
compdef _cakephp3 cake
|
||||
|
||||
#Alias
|
||||
alias c3='bin/cake'
|
||||
alias c3cache='bin/cake orm_cache clear'
|
||||
alias c3migrate='bin/cake migrations migrate'
|
||||
|
|
@ -1,10 +1,49 @@
|
|||
#compdef cap
|
||||
#compdef capit
|
||||
#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 `capit` 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
|
||||
capit --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 capit() {
|
||||
if [ -f Gemfile ]
|
||||
then
|
||||
bundle exec cap $*
|
||||
else
|
||||
cap $*
|
||||
fi
|
||||
}
|
||||
11
plugins/cask/README.md
Normal file
11
plugins/cask/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# cask plugin
|
||||
|
||||
Loads `cask` completion from non-standard locations, such as if installed
|
||||
via Homebrew or others. To enable it, add `cask` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... cask)
|
||||
```
|
||||
|
||||
Make sure you have the `cask` directory in your `$PATH` before loading
|
||||
Oh My Zsh, otherwise you'll get the "command not found" error.
|
||||
|
|
@ -1,5 +1,26 @@
|
|||
if which cask &> /dev/null; then
|
||||
source $(dirname $(which cask))/../etc/cask_completion.zsh
|
||||
else
|
||||
print "zsh cask plugin: cask not found"
|
||||
fi
|
||||
() {
|
||||
emulate -L zsh
|
||||
|
||||
if ! (( $+commands[cask] )); then
|
||||
print "zsh cask plugin: cask command not found" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
cask_base=${commands[cask]:h:h}
|
||||
|
||||
# Plain cask installation location (for Cask 0.7.2 and earlier)
|
||||
comp_files=($cask_base/etc/cask_completion.zsh)
|
||||
|
||||
# Mac Homebrew installs the completion in a different location
|
||||
if (( $+commands[brew] )); then
|
||||
comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
|
||||
fi
|
||||
|
||||
# Load first found file
|
||||
for f in $comp_files; do
|
||||
if [[ -f "$f" ]]; then
|
||||
source "$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,12 @@
|
|||
# rvm and rbenv plugins also provide this alias
|
||||
alias rubies='chruby'
|
||||
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
_homebrew-installed() {
|
||||
whence brew &> /dev/null
|
||||
}
|
||||
|
||||
_chruby-from-homebrew-installed() {
|
||||
[ -r $(brew --prefix chruby)] &> /dev/null
|
||||
[ -r $(brew --prefix chruby) ] &> /dev/null
|
||||
}
|
||||
|
||||
_ruby-build_installed() {
|
||||
|
|
@ -42,14 +39,17 @@ if _ruby-build_installed; then
|
|||
fi
|
||||
|
||||
_source_from_omz_settings() {
|
||||
local _chruby_path
|
||||
local _chruby_auto
|
||||
|
||||
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
|
||||
coffeescript 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'
|
||||
32
plugins/colored-man-pages/colored-man-pages.plugin.zsh
Normal file
32
plugins/colored-man-pages/colored-man-pages.plugin.zsh
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
if [[ "$OSTYPE" = solaris* ]]
|
||||
then
|
||||
if [[ ! -x "$HOME/bin/nroff" ]]
|
||||
then
|
||||
mkdir -p "$HOME/bin"
|
||||
cat > "$HOME/bin/nroff" <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\$_NROFF_U "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x "$HOME/bin/nroff"
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
man "$@"
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
if [ "$OSTYPE[0,7]" = "solaris" ]
|
||||
then
|
||||
if [ ! -x ${HOME}/bin/nroff ]
|
||||
then
|
||||
mkdir -p ${HOME}/bin
|
||||
cat > ${HOME}/bin/nroff <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\${_NROFF_U} "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x ${HOME}/bin/nroff
|
||||
fi
|
||||
fi
|
||||
|
||||
man() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||
PAGER=/usr/bin/less \
|
||||
_NROFF_U=1 \
|
||||
PATH=${HOME}/bin:${PATH} \
|
||||
man "$@"
|
||||
}
|
||||
|
|
@ -23,3 +23,11 @@ if [ -f /usr/libexec/pk-command-not-found ]; then
|
|||
return $retval
|
||||
}
|
||||
fi
|
||||
|
||||
# OSX command-not-found support
|
||||
# https://github.com/Homebrew/homebrew-command-not-found
|
||||
if type brew &> /dev/null; then
|
||||
if brew command command-not-found-init > /dev/null 2>&1; then
|
||||
eval "$(brew command-not-found-init)";
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -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} '
|
||||
|
|
@ -52,7 +52,7 @@ alias mv='mv -i'
|
|||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
if [ ${ZSH_VERSION//\./} -ge 420 ]; then
|
||||
if is-at-least 4.2.0; then
|
||||
# open browser on urls
|
||||
_browser_fts=(htm html de org net com at cx nl se dk dk php)
|
||||
for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
# Composer basic command completion
|
||||
_composer_get_command_list () {
|
||||
$_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_composer_get_required_list () {
|
||||
$_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -8,11 +8,21 @@
|
|||
# pushd +N: start counting from left of `dirs' output
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
switch-to-dir () {
|
||||
while ! builtin pushd -q $1 &>/dev/null; do
|
||||
# We found a missing directory: pop it out of the dir stack
|
||||
builtin popd -q $1
|
||||
|
||||
# Stop trying if there are no more directories in the dir stack
|
||||
[[ ${#dirstack} -eq 0 ]] && break
|
||||
done
|
||||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q +1 &>/dev/null || true
|
||||
switch-to-dir +1
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledleft
|
||||
|
|
@ -21,17 +31,17 @@ insert-cycledright () {
|
|||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q -0 &>/dev/null || true
|
||||
switch-to-dir -0
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
||||
|
||||
# add key bindings for iTerm2
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[[1;6D" insert-cycledleft
|
||||
bindkey "^[[1;6C" insert-cycledright
|
||||
else
|
||||
bindkey "\e[1;6D" insert-cycledleft
|
||||
bindkey "\e[1;6C" insert-cycledright
|
||||
fi
|
||||
# These sequences work for xterm, Apple Terminal.app, and probably others.
|
||||
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
|
||||
# from plain Shift-Arrow, at least by default.
|
||||
# iTerm2 does not have these key combinations defined by default; you will need
|
||||
# to add them under "Keys" in your profile if you want to use this. You can do
|
||||
# this conveniently by loading the "xterm with Numeric Keypad" preset.
|
||||
bindkey "\e[1;6D" insert-cycledleft
|
||||
bindkey "\e[1;6C" insert-cycledright
|
||||
|
|
|
|||
|
|
@ -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} )
|
||||
|
|
|
|||
|
|
@ -2,59 +2,114 @@
|
|||
|
||||
typeset -ga nul_args
|
||||
nul_args=(
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))'
|
||||
'--settings=-[the Python path to a settings module.]:file:_files'
|
||||
'--pythonpath=-[a directory to add to the Python path.]::directory:_directories'
|
||||
'--pythonpath=-[a directory to add to the Python path.]:directory:_directories'
|
||||
'--traceback[print traceback on exception.]'
|
||||
"--no-color[Don't colorize the command output.]"
|
||||
"--version[show program's version number and exit.]"
|
||||
{-h,--help}'[show this help message and exit.]'
|
||||
)
|
||||
|
||||
_managepy-adminindex(){
|
||||
typeset -ga start_args
|
||||
start_args=(
|
||||
'--template=-[The path or URL to load the template from.]:directory:_directories'
|
||||
'--extension=-[The file extension(s) to render (default: "py").]'
|
||||
'--name=-[The file name(s) to render.]:file:_files'
|
||||
)
|
||||
|
||||
typeset -ga db_args
|
||||
db_args=(
|
||||
'--database=-[Nominates a database. Defaults to the "default" database.]'
|
||||
)
|
||||
|
||||
typeset -ga noinput_args
|
||||
noinput_args=(
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]'
|
||||
)
|
||||
|
||||
typeset -ga no_init_data_args
|
||||
no_init_data_args=(
|
||||
'--no-initial-data[Tells Django not to load any initial data after database synchronization.]'
|
||||
)
|
||||
|
||||
typeset -ga tag_args
|
||||
tag_args=(
|
||||
'--tag=-[Run only checks labeled with given tag.]'
|
||||
'--list-tags[List available tags.]'
|
||||
)
|
||||
|
||||
_managepy-check(){
|
||||
_arguments -s : \
|
||||
$nul_args \
|
||||
'*::directory:_directories' && ret=0
|
||||
$tag_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-changepassword(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-createcachetable(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-createsuperuser(){
|
||||
_arguments -s : \
|
||||
'--username=-[Specifies the login for the superuser.]' \
|
||||
'--email=-[Specifies the email for the superuser.]' \
|
||||
$noinput_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-collectstatic(){
|
||||
_arguments -s : \
|
||||
'--link=-[Create a symbolic link to each file instead of copying.]:' \
|
||||
'--noinput=-[Do NOT prompt the user for input of any kind.]:' \
|
||||
'--no-post-process=-[Do NOT post process collected files.]:' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]:' \
|
||||
'--dry-run=-[Do everything except modify the filesystem.]:' \
|
||||
'--clear=-[Clear the existing files using the storage before trying to copy or link the original file.]:' \
|
||||
'--link=-[Create a symbolic link to each file instead of copying.]:' \
|
||||
'--no-default-ignore=-[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]:' \
|
||||
'--link[Create a symbolic link to each file instead of copying.]' \
|
||||
'--no-post-process[Do NOT post process collected files.]' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]' \
|
||||
'--dry-run[Do everything except modify the filesystem.]' \
|
||||
'--clear[Clear the existing files using the storage before trying to copy or link the original file.]' \
|
||||
'--link[Create a symbolic link to each file instead of copying.]' \
|
||||
'--no-default-ignore[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dbshell(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-diffsettings(){
|
||||
_arguments -s : \
|
||||
"--all[Display all settings, regardless of their value.]"
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dumpdata(){
|
||||
_arguments -s : \
|
||||
'--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
|
||||
'--indent=-[specifies the indent level to use when pretty-printing output.]:' \
|
||||
'--format=-[Specifies the output serialization format for fixtures.]:format:(json yaml xml)' \
|
||||
'--indent=-[Specifies the indent level to use when pretty-printing output.]' \
|
||||
'--exclude=-[An app_label or app_label.ModelName to exclude (use multiple --exclude to exclude multiple apps/models).]' \
|
||||
'--natural-foreign[Use natural foreign keys if they are available.]' \
|
||||
'--natural-primary[Use natural primary keys if they are available.]' \
|
||||
"--all[Use Django's base manager to dump all models stored in the database.]" \
|
||||
'--pks=-[Only dump objects with given primary keys.]' \
|
||||
$db_args \
|
||||
$nul_args \
|
||||
'*::appname:_applist' && ret=0
|
||||
}
|
||||
|
||||
_managepy-flush(){
|
||||
_arguments -s : \
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
|
||||
$no_init_data_args \
|
||||
$db_args \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
|
|
@ -75,32 +130,61 @@ _managepy_cmds(){
|
|||
|
||||
_managepy-inspectdb(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-loaddata(){
|
||||
_arguments -s : \
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
|
||||
'--ignorenonexistent[Ignores entries in the serialized data for fields that do not currently exist on the model.]' \
|
||||
'--app=-[Only look for fixtures in the specified app.]:appname:_applist' \
|
||||
'*::file:_files' \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-reset(){
|
||||
_managepy-makemessages(){
|
||||
_arguments -s : \
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
|
||||
'*::appname:_applist' \
|
||||
'--locale=-[Creates or updates the message files for the given locale(s) (e.g. pt_BR).]' \
|
||||
'--domain=-[The domain of the message files (default: "django").]' \
|
||||
'--all[Updates the message files for all existing locales.]' \
|
||||
'--extension=-[The file extension(s) to examine (default: "html,txt", or "js" if the domain is "djangojs").]' \
|
||||
'--symlinks[Follows symlinks to directories when examining source code and templates for translation strings.]' \
|
||||
'--ignore=-[Ignore files or directories matching this glob-style pattern.]' \
|
||||
"--no-default-ignore[Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.]" \
|
||||
"--no-wrap[Don't break long message lines into several lines.]" \
|
||||
"--no-location[Don't write '#: filename:line' lines.]" \
|
||||
'--no-obsolete[emove obsolete message strings.]' \
|
||||
'--keep-pot[Keep .pot file after making messages.]' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-makemigrations(){
|
||||
_arguments -s : \
|
||||
'--dry-run[Just show what migrations would be made]' \
|
||||
'--merge[Enable fixing of migration conflicts.]' \
|
||||
'--empty[Create an empty migration.]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-migrate(){
|
||||
_arguments -s : \
|
||||
'--fake[Mark migrations as run without actually running them]' \
|
||||
'--list[Show a list of all known migrations and which are applied]' \
|
||||
$no_init_data_args \
|
||||
$noinput_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-runfcgi(){
|
||||
local state
|
||||
|
||||
|
||||
local fcgi_opts
|
||||
fcgi_opts=(
|
||||
'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)'
|
||||
'host[hostname to listen on..]:'
|
||||
'port[port to listen on.]:'
|
||||
'socket[UNIX socket to listen on.]::file:_files'
|
||||
'socket[UNIX socket to listen on.]:file:_files'
|
||||
'method[prefork or threaded (default prefork)]:method:(prefork threaded)'
|
||||
'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:'
|
||||
'maxspare[max number of spare processes / threads.]:'
|
||||
|
|
@ -112,7 +196,7 @@ _managepy-runfcgi(){
|
|||
'outlog[write stdout to this file.]:file:_files'
|
||||
'errlog[write stderr to this file.]:file:_files'
|
||||
)
|
||||
|
||||
|
||||
_arguments -s : \
|
||||
$nul_args \
|
||||
'*: :_values "FCGI Setting" $fcgi_opts' && ret=0
|
||||
|
|
@ -120,72 +204,148 @@ _managepy-runfcgi(){
|
|||
|
||||
_managepy-runserver(){
|
||||
_arguments -s : \
|
||||
'--noreload[tells Django to NOT use the auto-reloader.]' \
|
||||
'--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \
|
||||
'--ipv6[Tells Django to use an IPv6 address.]' \
|
||||
'--nothreading[Tells Django to NOT use threading.]' \
|
||||
'--noreload[Tells Django to NOT use the auto-reloader.]' \
|
||||
'--nostatic[Tells Django to NOT automatically serve static files at STATIC_URL.]' \
|
||||
'--insecure[Allows serving static files even if DEBUG is False.]' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-shell(){
|
||||
_arguments -s : \
|
||||
'--plain[tells Django to use plain Python, not IPython.]' \
|
||||
'--plain[Tells Django to use plain Python, not IPython.]' \
|
||||
'--no-startup[When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.]' \
|
||||
'--interface=-[Specify an interactive interpreter interface.]:INTERFACE:((ipython bpython))' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sql(){}
|
||||
_managepy-sqlall(){}
|
||||
_managepy-sqlclear(){}
|
||||
_managepy-sqlcustom(){}
|
||||
_managepy-sqlflush(){}
|
||||
_managepy-sqlindexes(){}
|
||||
_managepy-sqlinitialdata(){}
|
||||
_managepy-sqlreset(){}
|
||||
_managepy-sqlsequencereset(){}
|
||||
_managepy-startapp(){}
|
||||
_managepy-startproject(){}
|
||||
_managepy-sql(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlall(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlclear(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlcustom(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-dropindexes(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlflush(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlindexes(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlinitialdata(){
|
||||
_arguments -s : \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-sqlsequencereset(){
|
||||
_arguments -s : \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-squashmigrations(){
|
||||
_arguments -s : \
|
||||
'--no-optimize[Do not try to optimize the squashed operations.]' \
|
||||
$noinput_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-startapp(){
|
||||
_arguments -s : \
|
||||
$start_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
_managepy-startproject(){
|
||||
_arguments -s : \
|
||||
$start_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-syncdb() {
|
||||
_arguments -s : \
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
|
||||
$noinput_args \
|
||||
$no_init_data_args \
|
||||
$db_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-test() {
|
||||
_arguments -s : \
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
|
||||
'--noinput[tells Django to NOT prompt the user for input of any kind.]' \
|
||||
'--failfast[Tells Django to stop running the test suite after first failed test.]' \
|
||||
'--testrunner=-[Tells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.]' \
|
||||
'--liveserver=-[Overrides the default address where the live server (used with LiveServerTestCase) is expected to run from. The default value is localhost:8081.]' \
|
||||
'--top-level-directory=-[Top level of project for unittest discovery.]' \
|
||||
'--pattern=-[The test matching pattern. Defaults to test*.py.]:' \
|
||||
$noinput_args \
|
||||
'*::appname:_applist' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-testserver() {
|
||||
_arguments -s : \
|
||||
'--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \
|
||||
'--addrport=-[port number or ipaddr:port to run the server on.]' \
|
||||
'--ipv6[Tells Django to use an IPv6 address.]' \
|
||||
$noinput_args \
|
||||
'*::fixture:_files' \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-validate() {
|
||||
_arguments -s : \
|
||||
$tag_args \
|
||||
$nul_args && ret=0
|
||||
}
|
||||
|
||||
_managepy-commands() {
|
||||
local -a commands
|
||||
|
||||
|
||||
commands=(
|
||||
'adminindex:prints the admin-index template snippet for the given app name(s).'
|
||||
'createcachetable:creates the table needed to use the SQL cache backend.'
|
||||
"changepassword:Change a user's password for django.contrib.auth."
|
||||
'check:Checks the entire Django project for potential problems.'
|
||||
'compilemessages:Compiles .po files to .mo files for use with builtin gettext support.'
|
||||
'createcachetable:Creates the table needed to use the SQL cache backend.'
|
||||
'createsuperuser:Used to create a superuser.'
|
||||
'collectstatic:Collect static files in a single location.'
|
||||
'dbshell:runs the command-line client for the current DATABASE_ENGINE.'
|
||||
"diffsettings:displays differences between the current settings.py and Django's default settings."
|
||||
'dbshell:Runs the command-line client for the current DATABASE_ENGINE.'
|
||||
"diffsettings:Displays differences between the current settings.py and Django's default settings."
|
||||
'dumpdata:Output the contents of the database as a fixture of the given format.'
|
||||
'flush:Executes ``sqlflush`` on the current database.'
|
||||
'help:manage.py help.'
|
||||
'inspectdb:Introspects the database tables in the given database and outputs a Django model module.'
|
||||
'loaddata:Installs the named fixture(s) in the database.'
|
||||
'reset:Executes ``sqlreset`` for the given app(s) in the current database.'
|
||||
'makemessages:Runs over the entire source tree of the current directory and pulls out all strings marked for translation.'
|
||||
'makemigrations:Creates new migration(s) for apps.'
|
||||
'migrate:Updates database schema. Manages both apps with migrations and those without.'
|
||||
'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,'
|
||||
'runserver:Starts a lightweight Web server for development.'
|
||||
'shell:Runs a Python interactive interpreter.'
|
||||
|
|
@ -193,11 +353,12 @@ _managepy-commands() {
|
|||
'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).'
|
||||
'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).'
|
||||
'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).'
|
||||
'sqldropindexes:Prints the DROP INDEX SQL statements for the given model module name(s).'
|
||||
'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.'
|
||||
'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).'
|
||||
"sqlinitialdata:RENAMED: see 'sqlcustom'"
|
||||
'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).'
|
||||
'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).'
|
||||
'squashmigrations:Squashes an existing set of migrations (from first until specified) into a single new one.'
|
||||
"startapp:Creates a Django app directory structure for the given app name in this project's directory."
|
||||
"startproject:Creates a Django project directory structure for the given project name in this current directory."
|
||||
"syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
|
||||
|
|
@ -205,7 +366,7 @@ _managepy-commands() {
|
|||
'testserver:Runs a development server with data from the given fixture(s).'
|
||||
'validate:Validates all installed models.'
|
||||
)
|
||||
|
||||
|
||||
_describe -t commands 'manage.py command' commands && ret=0
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +384,7 @@ _applist() {
|
|||
|
||||
_managepy() {
|
||||
local curcontext=$curcontext ret=1
|
||||
|
||||
|
||||
if ((CURRENT == 2)); then
|
||||
_managepy-commands
|
||||
else
|
||||
|
|
|
|||
25
plugins/dnf/README.md
Executable file
25
plugins/dnf/README.md
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
## Description
|
||||
|
||||
This plugin makes `dnf` usage easier by adding aliases for the most
|
||||
common commands.
|
||||
|
||||
`dnf` is the new package manager for RPM-based distributions, which
|
||||
replaces `yum`.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------------------|--------------------------|
|
||||
| dnfl | `dnf list` | List packages |
|
||||
| dnfli | `dnf list installed` | List installed packages |
|
||||
| dnfgl | `dnf grouplist` | List package groups |
|
||||
| dnfmc | `dnf makecache` | Generate metadata cache |
|
||||
| dnfp | `dnf info` | Show package information |
|
||||
| dnfs | `dnf search` | Search package |
|
||||
| **Use `sudo`** |
|
||||
| dnfu | `sudo dnf upgrade` | Upgrade package |
|
||||
| dnfi | `sudo dnf install` | Install package |
|
||||
| dnfgi | `sudo dnf groupinstall` | Install package group |
|
||||
| dnfr | `sudo dnf remove` | Remove package |
|
||||
| dnfgr | `sudo dnf groupremove` | Remove package group |
|
||||
| dnfc | `sudo dnf clean all` | Clean cache |
|
||||
15
plugins/dnf/dnf.plugin.zsh
Normal file
15
plugins/dnf/dnf.plugin.zsh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## Aliases
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
alias dnfli="dnf list installed" # List installed packages
|
||||
alias dnfgl="dnf grouplist" # List package groups
|
||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
||||
alias dnfp="dnf info" # Show package information
|
||||
alias dnfs="dnf search" # Search package
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
||||
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 package group
|
||||
alias dnfc="sudo dnf clean all" # Clean cache
|
||||
4
plugins/docker-compose/README.md
Normal file
4
plugins/docker-compose/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Docker-compose plugin for oh my zsh
|
||||
|
||||
A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo.
|
||||
|
||||
455
plugins/docker-compose/_docker-compose
Normal file
455
plugins/docker-compose/_docker-compose
Normal file
|
|
@ -0,0 +1,455 @@
|
|||
#compdef docker-compose
|
||||
|
||||
# Description
|
||||
# -----------
|
||||
# zsh completion for docker-compose
|
||||
# https://github.com/sdurrheimer/docker-compose-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 1.5.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
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
__docker-compose_q() {
|
||||
docker-compose 2>/dev/null $compose_options "$@"
|
||||
}
|
||||
|
||||
# All services defined in docker-compose.yml
|
||||
__docker-compose_all_services_in_compose_file() {
|
||||
local already_selected
|
||||
local -a services
|
||||
already_selected=$(echo $words | tr " " "|")
|
||||
__docker-compose_q config --services \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services, even those without an existing container
|
||||
__docker-compose_services_all() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
services=$(__docker-compose_all_services_in_compose_file)
|
||||
_alternative "args:services:($services)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# 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.
|
||||
__docker-compose_q config \
|
||||
| sed -n -e '/^services:/,/^[^ ]/p' \
|
||||
| sed -n 's/^ //p' \
|
||||
| awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \
|
||||
| grep " \+$1:" \
|
||||
| cut -d: -f1 \
|
||||
| grep -Ev "^(${already_selected})$"
|
||||
}
|
||||
|
||||
# All services that are defined by a Dockerfile reference
|
||||
__docker-compose_services_from_build() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
buildable=$(__docker-compose_services_with_key build)
|
||||
_alternative "args:buildable services:($buildable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
# All services that are defined by an image
|
||||
__docker-compose_services_from_image() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
pullable=$(__docker-compose_services_with_key image)
|
||||
_alternative "args:pullable services:($pullable)" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-compose_get_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
local kind
|
||||
declare -a running paused 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 $docker_options ps $args)"})
|
||||
services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options 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 )); do
|
||||
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
|
||||
done
|
||||
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
|
||||
if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then
|
||||
paused=($paused $s)
|
||||
fi
|
||||
running=($running $s)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
[[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0
|
||||
[[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0
|
||||
[[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-compose_pausedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services paused "$@"
|
||||
}
|
||||
|
||||
__docker-compose_stoppedservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services stopped "$@"
|
||||
}
|
||||
|
||||
__docker-compose_runningservices() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__docker-compose_get_services running "$@"
|
||||
}
|
||||
|
||||
__docker-compose_services() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
__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) *]}]}## #}/ ##/:})
|
||||
(( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands
|
||||
fi
|
||||
_describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands
|
||||
}
|
||||
|
||||
__docker-compose_subcommand() {
|
||||
local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps
|
||||
|
||||
opts_help='(: -)--help[Print usage]'
|
||||
opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]"
|
||||
opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]"
|
||||
opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]"
|
||||
opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]"
|
||||
opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ")
|
||||
opts_no_color='--no-color[Produce monochrome output.]'
|
||||
opts_no_deps="--no-deps[Don't start linked services.]"
|
||||
|
||||
integer ret=1
|
||||
|
||||
case "$words[1]" in
|
||||
(build)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--force-rm[Always remove intermediate containers.]' \
|
||||
'--no-cache[Do not use cache when building the image.]' \
|
||||
'--pull[Always attempt to pull a newer version of the image.]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(bundle)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \
|
||||
'--services[Print the service names, one per line.]' && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before creating containers.]" \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(down)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \
|
||||
'(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \
|
||||
$opts_remove_orphans && ret=0
|
||||
;;
|
||||
(events)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--json[Output events as a stream of json objects]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(exec)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run command in the background.]' \
|
||||
'--privileged[Give extended privileges to the process.]' \
|
||||
'--user=[Run the command as this user.]:username:_users' \
|
||||
'-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \
|
||||
'--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'(-):running services:__docker-compose_runningservices' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-compose_commands' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(logs)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(-f --follow)'{-f,--follow}'[Follow log output]' \
|
||||
$opts_no_color \
|
||||
'--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \
|
||||
'(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(pause)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(port)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \
|
||||
'--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \
|
||||
'1:running services:__docker-compose_runningservices' \
|
||||
'2:port:_ports' && ret=0
|
||||
;;
|
||||
(ps)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-q[Only display IDs]' \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(pull)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \
|
||||
'*:services:__docker-compose_services_from_image' && ret=0
|
||||
;;
|
||||
(push)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--ignore-push-failures[Push what it can and ignores images with push failures.]' \
|
||||
'*:services:__docker-compose_services' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \
|
||||
'-v[Remove any anonymous volumes attached to containers]' \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(run)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'-d[Detached mode: Run container in the background, print new container name.]' \
|
||||
'*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \
|
||||
'--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \
|
||||
'--name=[Assign a name to the container]:name: ' \
|
||||
$opts_no_deps \
|
||||
'(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \
|
||||
'--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.]' \
|
||||
'(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \
|
||||
'(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \
|
||||
'(-):services:__docker-compose_services' \
|
||||
'(-):command: _command_names -e' \
|
||||
'*::arguments: _normal' && ret=0
|
||||
;;
|
||||
(scale)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:stopped services:__docker-compose_stoppedservices' && ret=0
|
||||
;;
|
||||
(stop|restart)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
$opts_timeout \
|
||||
'*:running services:__docker-compose_runningservices' && ret=0
|
||||
;;
|
||||
(unpause)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:paused services:__docker-compose_pausedservices' && ret=0
|
||||
;;
|
||||
(up)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \
|
||||
$opts_no_color \
|
||||
$opts_no_deps \
|
||||
$opts_force_recreate \
|
||||
$opts_no_recreate \
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before starting containers.]" \
|
||||
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
|
||||
$opts_remove_orphans \
|
||||
'*:services:__docker-compose_services_all' && ret=0
|
||||
;;
|
||||
(version)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
"--short[Shows only Compose's version number.]" && ret=0
|
||||
;;
|
||||
(*)
|
||||
_message 'Unknown sub command' && ret=1
|
||||
;;
|
||||
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
|
||||
integer ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'(-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:' \
|
||||
'--verbose[Show more output]' \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
|
||||
'--tls[Use TLS; implied by --tlsverify]' \
|
||||
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
|
||||
'--tlscert=[Path to TLS certificate file]:client cert path:' \
|
||||
'--tlskey=[Path to TLS key file]:tls key path:' \
|
||||
'--tlsverify[Use TLS and verify the remote]' \
|
||||
"--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \
|
||||
'(-): :->command' \
|
||||
'(-)*:: :->option-or-argument' && ret=0
|
||||
|
||||
local -a relevant_compose_flags relevant_docker_flags compose_options docker_options
|
||||
|
||||
relevant_compose_flags=(
|
||||
"--file" "-f"
|
||||
"--host" "-H"
|
||||
"--project-name" "-p"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
"--skip-hostname-check"
|
||||
)
|
||||
|
||||
relevant_docker_flags=(
|
||||
"--host" "-H"
|
||||
"--tls"
|
||||
"--tlscacert"
|
||||
"--tlscert"
|
||||
"--tlskey"
|
||||
"--tlsverify"
|
||||
)
|
||||
|
||||
for k in "${(@k)opt_args}"; do
|
||||
if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then
|
||||
docker_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
docker_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then
|
||||
compose_options+=$k
|
||||
if [[ -n "$opt_args[$k]" ]]; then
|
||||
compose_options+=$opt_args[$k]
|
||||
fi
|
||||
fi
|
||||
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 "$@"
|
||||
|
|
@ -12,13 +12,22 @@
|
|||
__docker_containers() {
|
||||
declare -a cont_cmd
|
||||
cont_cmd=($(docker ps | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
|
||||
_describe 'containers' cont_cmd
|
||||
if [[ 'X$cont_cmd' != 'X' ]]
|
||||
_describe 'containers' cont_cmd
|
||||
}
|
||||
|
||||
# Output a selectable list of all containers, even not running
|
||||
__docker_all_containers() {
|
||||
declare -a cont_cmd
|
||||
cont_cmd=($(docker ps -a | awk 'NR>1{print $NF":[CON("$1")"$2"("$3")]"}'))
|
||||
if [[ 'X$cont_cmd' != 'X' ]]
|
||||
_describe 'containers' cont_cmd
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
|
|
@ -27,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
|
||||
}
|
||||
|
|
@ -43,21 +52,64 @@ __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
|
||||
}
|
||||
|
||||
__events() {
|
||||
__events() {
|
||||
_arguments \
|
||||
'--since=[Show previously created events and then stream.]'
|
||||
}
|
||||
|
|
@ -91,17 +143,14 @@ __info() {
|
|||
# no arguments
|
||||
}
|
||||
|
||||
__insert() {
|
||||
__docker_images
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
__inspect() {
|
||||
__docker_images
|
||||
__docker_containers
|
||||
__docker_all_containers
|
||||
}
|
||||
|
||||
__kill() {
|
||||
_arguments \
|
||||
'(-s,--signal=)'{-s,--signal=}'[KILL Signal]'
|
||||
__docker_containers
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +211,7 @@ __rm() {
|
|||
'(-f,--force=)'{-f,--force=}'[Force removal of running container]' \
|
||||
'(-l,--link=)'{-l,--link=}'[Remove the specified link and not the underlying container]' \
|
||||
'(-v,--volumes=)'{-v,--volumes=}'[Remove the volumes associated to the container]'
|
||||
__docker_containers
|
||||
__docker_all_containers
|
||||
}
|
||||
|
||||
__rmi() {
|
||||
|
|
@ -174,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
|
||||
|
|
@ -214,9 +278,9 @@ __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]'
|
||||
__docker_containers
|
||||
'(-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
|
||||
}
|
||||
|
||||
__stats() {
|
||||
|
|
@ -260,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"
|
||||
|
|
@ -267,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"
|
||||
|
|
@ -310,6 +374,8 @@ case "$words[1]" in
|
|||
__commit ;;
|
||||
cp)
|
||||
__cp ;;
|
||||
create)
|
||||
__create ;;
|
||||
diff)
|
||||
__diff ;;
|
||||
events)
|
||||
|
|
@ -324,8 +390,6 @@ case "$words[1]" in
|
|||
__import ;;
|
||||
info)
|
||||
__info ;;
|
||||
insert)
|
||||
__insert ;;
|
||||
inspect)
|
||||
__inspect ;;
|
||||
kill)
|
||||
|
|
|
|||
19
plugins/droplr/README.md
Normal file
19
plugins/droplr/README.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# droplr
|
||||
|
||||
Use [Droplr](https://droplr.com/) from the comand line to upload files and shorten
|
||||
links. It needs to have [Droplr.app](https://droplr.com/apps) installed and logged
|
||||
in. MacOS only.
|
||||
|
||||
To use it, add `droplr` to the `$plugins` variable in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... droplr)
|
||||
```
|
||||
|
||||
Author: [Fabio Fernandes](https://github.com/fabiofl)
|
||||
|
||||
## Examples
|
||||
|
||||
- Upload a file: `droplr ./path/to/file/`
|
||||
|
||||
- Shorten a link: `droplr http://example.com`
|
||||
15
plugins/droplr/droplr.plugin.zsh
Normal file
15
plugins/droplr/droplr.plugin.zsh
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Only compatible with MacOS
|
||||
[[ "$OSTYPE" == darwin* ]] || return
|
||||
|
||||
droplr() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo You need to specify a parameter. >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^http[|s]:// ]]; then
|
||||
osascript -e "tell app 'Droplr' to shorten '$1'"
|
||||
else
|
||||
open -ga /Applications/Droplr.app "$1"
|
||||
fi
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
||||
if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
|
|
@ -18,15 +18,14 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then
|
|||
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
# open terminal emacsclient
|
||||
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
|
||||
# to code all night long
|
||||
alias emasc=emacs
|
||||
alias emcas=emacs
|
||||
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
|
|
|
|||
|
|
@ -1,12 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
# get list of available X windows.
|
||||
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
|
||||
_emacsfun()
|
||||
{
|
||||
# get list of emacs frames.
|
||||
frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'`
|
||||
|
||||
if [ -z "$x" ] || [ "$x" = "nil" ] ;then
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
else
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||
# If the second argument is - then write stdin to a tempfile and open the
|
||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||
then
|
||||
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
|
||||
cat - > "$tempfile"
|
||||
_emacsfun --no-wait $tempfile
|
||||
else
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
_emacsfun "$@"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
# 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 | Ember-CLI command
|
||||
----- | -----------------
|
||||
**es** | *ember serve*
|
||||
**ea** | *ember addon*
|
||||
**eb** | *ember build*
|
||||
**ed** | *ember destroy*
|
||||
**eg** | *ember generate*
|
||||
**eh** | *ember help*
|
||||
**ein** | *ember init*
|
||||
**ei** | *ember install*
|
||||
**et** | *ember test*
|
||||
**eu** | *ember update*
|
||||
**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,17 @@
|
|||
encode64(){ echo -n $1 | base64 }
|
||||
decode64(){ echo -n $1 | base64 --decode }
|
||||
encode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64
|
||||
else
|
||||
printf '%s' $1 | base64
|
||||
fi
|
||||
}
|
||||
|
||||
decode64() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
cat | base64 --decode
|
||||
else
|
||||
printf '%s' $1 | base64 --decode
|
||||
fi
|
||||
}
|
||||
alias e64=encode64
|
||||
alias d64=decode64
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0
|
||||
"*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|ipsw|rar|7z|deb)(-.)'" && return 0
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function extract() {
|
|||
|
||||
remove_archive=1
|
||||
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
|
||||
remove_archive=0
|
||||
remove_archive=0
|
||||
shift
|
||||
fi
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ function extract() {
|
|||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package) unzip "$1" -d $extract_dir ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
|
|
@ -64,10 +64,10 @@ function extract() {
|
|||
cd ..; rm *.tar.gz debian-binary
|
||||
cd ..
|
||||
;;
|
||||
(*)
|
||||
(*)
|
||||
echo "extract: '$1' cannot be extracted" 1>&2
|
||||
success=1
|
||||
;;
|
||||
success=1
|
||||
;;
|
||||
esac
|
||||
|
||||
(( success = $success > 0 ? $success : $? ))
|
||||
|
|
|
|||
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 $EDITOR"
|
||||
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
|
||||
15
plugins/forklift/README.md
Normal file
15
plugins/forklift/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
## forklift
|
||||
|
||||
Plugin for ForkLift, an FTP application for OS X.
|
||||
|
||||
### Requirements
|
||||
|
||||
* [ForkLift](http://www.binarynights.com/forklift/)
|
||||
|
||||
### Usage
|
||||
|
||||
<code>fl [*file_or_folder*]</code>
|
||||
|
||||
* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
|
||||
|
||||
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
|
||||
7
plugins/fossil/README.md
Normal file
7
plugins/fossil/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## Fossil Plugin
|
||||
|
||||
This plugin adds completion support and prompt for fossil repositories.
|
||||
The prompt will display the current branch and status been dirty or clean.
|
||||
|
||||
### CONTRIBUTOR
|
||||
- Jefferson González ([jgmdev](https://github.com/jgmdev))
|
||||
89
plugins/fossil/fossil.plugin.zsh
Normal file
89
plugins/fossil/fossil.plugin.zsh
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
_FOSSIL_PROMPT=""
|
||||
|
||||
# Prefix at the very beginning of the prompt, before the branch name
|
||||
ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}"
|
||||
|
||||
# At the very end of the prompt
|
||||
ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})"
|
||||
|
||||
# Text to display if the branch is dirty
|
||||
ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
|
||||
|
||||
# Text to display if the branch is clean
|
||||
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
|
||||
|
||||
function fossil_prompt_info () {
|
||||
local _OUTPUT=`fossil branch 2>&1`
|
||||
local _STATUS=`echo $_OUTPUT | grep "use --repo"`
|
||||
if [ "$_STATUS" = "" ]; then
|
||||
local _EDITED=`fossil changes`
|
||||
local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
|
||||
local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'`
|
||||
|
||||
if [ "$_EDITED" != "" ]; then
|
||||
_EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
|
||||
fi
|
||||
|
||||
echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
|
||||
"$_BRANCH" \
|
||||
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
|
||||
"$_EDITED_SYM"\
|
||||
"%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _fossil_get_command_list () {
|
||||
fossil help -a | grep -v "Usage|Common|This is"
|
||||
}
|
||||
|
||||
function _fossil () {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'2: :->subcommand'
|
||||
|
||||
case $state in
|
||||
command)
|
||||
local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"`
|
||||
if [ "$_OUTPUT" = "" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compadd clone init import help version
|
||||
fi
|
||||
;;
|
||||
subcommand)
|
||||
if [ "$words[2]" = "help" ]; then
|
||||
compadd `_fossil_get_command_list`
|
||||
else
|
||||
compcall -D
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _fossil_prompt () {
|
||||
local current=`echo $PROMPT $RPROMPT | grep fossil`
|
||||
|
||||
if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then
|
||||
local _prompt=${PROMPT}
|
||||
local _rprompt=${RPROMPT}
|
||||
|
||||
local is_prompt=`echo $PROMPT | grep git`
|
||||
|
||||
if [ "$is_prompt" = "" ]; then
|
||||
export RPROMPT="$_rprompt"'$(fossil_prompt_info)'
|
||||
else
|
||||
export PROMPT="$_prompt"'$(fossil_prompt_info) '
|
||||
fi
|
||||
|
||||
_FOSSIL_PROMPT="1"
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _fossil fossil
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook precmd _fossil_prompt
|
||||
|
|
@ -1,82 +1,65 @@
|
|||
## Rationale ##
|
||||
## Introduction ##
|
||||
|
||||
The idea for this script is to help searches in important doc contents from frontend.
|
||||
> Searches for your frontend web development made easier
|
||||
|
||||
## Instalation ##
|
||||
|
||||
I will send a Pull Request with this plugin for .oh-my-zsh official repository. If accept them, it's only add in plugins list that exists in ```.zshrc``` file.
|
||||
## Installation ##
|
||||
|
||||
For now, you can clone this repository and add in ```custom/plugins``` folder
|
||||
Open your `~/.zshrc` file and enable the `frontend-search` plugin:
|
||||
|
||||
```zsh
|
||||
|
||||
plugins=( ... frontend-search)
|
||||
|
||||
```bash
|
||||
$ git clone git://github.com/willmendesneto/frontend-search.git ~/.oh-my-zsh/custom/plugins/frontend-search
|
||||
```
|
||||
|
||||
After this, restart your terminal and frontend-search plugin is configurated in you CLI.
|
||||
|
||||
```bash
|
||||
...
|
||||
plugins=( <your-plugins-list>... frontend-search)
|
||||
...
|
||||
## Usage ##
|
||||
|
||||
You can use the frontend-search plugin in these two forms:
|
||||
|
||||
* `frontend <context> <term> [more terms if you want]`
|
||||
* `<context> <term> [more terms if you want]`
|
||||
|
||||
For example, these two are equivalent:
|
||||
|
||||
```zsh
|
||||
$ frontend angularjs dependency injection
|
||||
$ angularjs dependency injection
|
||||
```
|
||||
|
||||
## Commands ##
|
||||
Available search contexts are:
|
||||
|
||||
All command searches are accept only in format
|
||||
| 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=` |
|
||||
| compassdoc | `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=` |
|
||||
|
||||
* `frontend <search-content> <search-term>`
|
||||
If you want to have another context, open an Issue and tell us!
|
||||
|
||||
The search content are
|
||||
|
||||
* `jquery <api.jquery.com>`
|
||||
* `mdn <developer.mozilla.org>`
|
||||
* `compass <compass-style.org>`
|
||||
* `html5please <html5please.com>`
|
||||
* `caniuse <caniuse.com>`
|
||||
* `aurajs <aurajs.com>`
|
||||
* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
|
||||
* `lodash <search>`
|
||||
* `qunit <api.qunitjs.com>`
|
||||
* `fontello <fontello.com>`
|
||||
* `bootsnipp <bootsnipp.com>`
|
||||
* `cssflow <cssflow.com>`
|
||||
* `codepen <codepen.io>`
|
||||
* `unheap <www.unheap.com>`
|
||||
* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
|
||||
* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
|
||||
* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
|
||||
* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
|
||||
* `emberjs <emberjs.com>`
|
||||
|
||||
|
||||
## Aliases ##
|
||||
|
||||
There are a few aliases presented as well:
|
||||
|
||||
* `jquery` A shorthand for `frontend jquery`
|
||||
* `mdn` A shorthand for `frontend mdn`
|
||||
* `compass` A shorthand for `frontend compass`
|
||||
* `html5please` A shorthand for `frontend html5please`
|
||||
* `caniuse` A shorthand for `frontend caniuse`
|
||||
* `aurajs` A shorthand for `frontend aurajs`
|
||||
* `dartlang` A shorthand for `frontend dartlang`
|
||||
* `lodash` A shorthand for `frontend lodash`
|
||||
* `qunit` A shorthand for `frontend qunit`
|
||||
* `fontello` A shorthand for `frontend fontello`
|
||||
* `bootsnipp` A shorthand for `frontend bootsnipp`
|
||||
* `cssflow` A shorthand for `frontend cssflow`
|
||||
* `codepen` A shorthand for `frontend codepen`
|
||||
* `unheap` A shorthand for `frontend unheap`
|
||||
* `bem` A shorthand for `frontend bem`
|
||||
* `smacss` A shorthand for `frontend smacss`
|
||||
* `angularjs` A shorthand for `frontend angularjs`
|
||||
* `reactjs` A shorthand for `frontend reactjs`
|
||||
* `emberjs` A shorthand for `frontend emberjs`
|
||||
|
||||
## Author
|
||||
|
||||
**Wilson Mendes (willmendesneto)**
|
||||
+ <https://plus.google.com/+WilsonMendes>
|
||||
+ <https://twitter.com/willmendesneto>
|
||||
+ <http://github.com/willmendesneto>
|
||||
|
||||
New features comming soon.
|
||||
|
|
|
|||
132
plugins/frontend-search/_frontend-search.sh
Normal file
132
plugins/frontend-search/_frontend-search.sh
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
#compdef frontend
|
||||
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
zstyle ':completion::complete:frontend:*:commands' group-name commands
|
||||
zstyle ':completion::complete:frontend:*:frontend_points' group-name frontend_points
|
||||
zstyle ':completion::complete:frontend::' list-grouped
|
||||
|
||||
zmodload zsh/mapfile
|
||||
|
||||
function _frontend() {
|
||||
local CONFIG=$HOME/.frontend-search
|
||||
local ret=1
|
||||
|
||||
local -a commands
|
||||
local -a frontend_points
|
||||
|
||||
frontend_points=( "${(f)mapfile[$CONFIG]//$HOME/~}" )
|
||||
|
||||
commands=(
|
||||
'jquery: Search in jQuery website'
|
||||
'mdn: Search in MDN website'
|
||||
'compassdoc: Search in COMPASS website'
|
||||
'html5please: Search in HTML5 Please website'
|
||||
'caniuse: Search in Can I Use website'
|
||||
'aurajs: Search in AuraJs website'
|
||||
'dartlang: Search in Dart website'
|
||||
'lodash: Search in Lo-Dash website'
|
||||
'qunit: Search in Qunit website'
|
||||
'fontello: Search in fontello website'
|
||||
'bootsnipp: Search in bootsnipp website'
|
||||
'cssflow: Search in cssflow website'
|
||||
'codepen: Search in codepen website'
|
||||
'unheap: Search in unheap website'
|
||||
'bem: Search in BEM website'
|
||||
'smacss: Search in SMACSS website'
|
||||
'angularjs: Search in Angular website'
|
||||
'reactjs: Search in React website'
|
||||
'emberjs: Search in Ember website'
|
||||
'stackoverflow: Search in StackOverflow website'
|
||||
'npmjs: Search in NPMJS website'
|
||||
)
|
||||
|
||||
_arguments -C \
|
||||
'1: :->first_arg' \
|
||||
'2: :->second_arg' && ret=0
|
||||
|
||||
case $state in
|
||||
first_arg)
|
||||
_describe -t frontend_points "Warp points" frontend_points && ret=0
|
||||
_describe -t commands "Commands" commands && ret=0
|
||||
;;
|
||||
second_arg)
|
||||
case $words[2] in
|
||||
jquery)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
mdn)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
compassdoc)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
html5please)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
caniuse)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
aurajs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
dartlang)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
lodash)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
qunit)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
fontello)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
bootsnipp)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
cssflow)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
codepen)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
unheap)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
bem)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
smacss)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
angularjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
reactjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
emberjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
stackoverflow)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
npmjs)
|
||||
_describe -t points "Warp points" frontend_points && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_frontend "$@"
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
|
|
@ -1,151 +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)' ]];
|
||||
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 ""
|
||||
|
||||
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" ;;
|
||||
*) 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 compassdoc='frontend compassdoc'
|
||||
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='
|
||||
compassdoc '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='
|
||||
)
|
||||
|
||||
# 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, compassdoc, 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, compassdoc, 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"
|
||||
}
|
||||
|
|
|
|||
21
plugins/gb/README.md
Normal file
21
plugins/gb/README.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# `gb` plugin
|
||||
|
||||
> A project based build tool for the Go programming language.
|
||||
|
||||
See https://getgb.io for the full `gb` documentation
|
||||
|
||||
* * * *
|
||||
|
||||
- Adds completion support for all `gb` commands.
|
||||
- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor).
|
||||
|
||||
To use it, add `gb` to your plugins array:
|
||||
```sh
|
||||
plugins=(... gb)
|
||||
```
|
||||
|
||||
## Caveats
|
||||
|
||||
The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program.
|
||||
If you're having trouble with it, remove it by adding `unalias gb` at the end of your
|
||||
zshrc file.
|
||||
111
plugins/gb/_gb
Normal file
111
plugins/gb/_gb
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
#compdef gb
|
||||
#autoload
|
||||
|
||||
_gb () {
|
||||
local ret=1 state
|
||||
_arguments -C ':command:->command' '*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
"build:build a package"
|
||||
"doc:show documentation for a package or symbol"
|
||||
"env:print project environment variables"
|
||||
"generate:generate Go files by processing source"
|
||||
"help:displays the help"
|
||||
"info:info returns information about this project"
|
||||
"list:list the packages named by the importpaths"
|
||||
"test:test packages"
|
||||
"vendor:manage your vendored dependencies"
|
||||
)
|
||||
_describe -t subcommands 'gb subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(build)
|
||||
_arguments \
|
||||
-f'[ignore cached packages]' \
|
||||
-F'[do not cache packages]' \
|
||||
-q'[decreases verbosity]' \
|
||||
-P'[the number of build jobs to run in parallel]' \
|
||||
-R'[sets the base of the project root search path]' \
|
||||
-dotfile'[output a dot formatted file of the build steps]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[alternate format for the list, using the syntax of package template]' \
|
||||
-s'[read format template from STDIN]' \
|
||||
-json'[prints output in structured JSON format]'
|
||||
;;
|
||||
(test)
|
||||
_arguments \
|
||||
-v'[print output from test subprocess]' \
|
||||
-ldflags'["flag list" arguments to pass to the linker]' \
|
||||
-gcflags'["arg list" arguments to pass to the compiler]' \
|
||||
-race'[enable data race detection]' \
|
||||
-tags'["tag list" additional build tags]'
|
||||
;;
|
||||
(vendor)
|
||||
_gb-vendor
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_gb-vendor () {
|
||||
local curcontext="$curcontext" state line
|
||||
_arguments -C ':command:->command' '*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'delete:deletes a local dependency'
|
||||
'fetch:fetch a remote dependency'
|
||||
'list:lists dependencies, one per line'
|
||||
'purge:remove all unreferenced dependencies'
|
||||
'restore:restore dependencies from the manifest'
|
||||
'update:update a local dependency'
|
||||
)
|
||||
_describe -t subcommands 'gb vendor subcommands' subcommands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(delete)
|
||||
_arguments \
|
||||
-all'[remove all dependencies]'
|
||||
;;
|
||||
(fetch)
|
||||
_arguments \
|
||||
-branch'[fetch from a particular branch]' \
|
||||
-no-recurse'[do not fetch recursively]' \
|
||||
-tag'[fetch the specified tag]' \
|
||||
-revision'[fetch the specific revision from the branch (if supplied)]' \
|
||||
-precaire'[allow the use of insecure protocols]' \
|
||||
;;
|
||||
(list)
|
||||
_arguments \
|
||||
-f'[controls the template used for printing each manifest entry]'
|
||||
;;
|
||||
(restore)
|
||||
_arguments \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
(update)
|
||||
_arguments \
|
||||
-all'[update all dependencies in the manifest or supply a given dependency]' \
|
||||
-precaire'[allow the use of insecure protocols]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_gb
|
||||
12
plugins/geeknote/README.md
Normal file
12
plugins/geeknote/README.md
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
## ZSH-Geeknote
|
||||
|
||||
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh).
|
||||
|
||||
Plugins provides:
|
||||
|
||||
- auto completion of commands and their options
|
||||
- alias `gn`
|
||||
|
||||
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
|
||||
|
||||
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
|
||||
136
plugins/geeknote/_geeknote
Normal file
136
plugins/geeknote/_geeknote
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#compdef geeknote
|
||||
# --------------- ------------------------------------------------------------
|
||||
# Name : _geeknote
|
||||
# Synopsis : zsh completion for geeknote
|
||||
# Author : Ján Koščo <3k.stanley@gmail.com>
|
||||
# HomePage : http://www.geeknote.me
|
||||
# Version : 0.1
|
||||
# Tag : [ shell, zsh, completion, evernote ]
|
||||
# Copyright : © 2014 by Ján Koščo,
|
||||
# Released under current GPL license.
|
||||
# --------------- ------------------------------------------------------------
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'login'
|
||||
'logout'
|
||||
'settings'
|
||||
'create'
|
||||
'edit'
|
||||
'find'
|
||||
'show'
|
||||
'remove'
|
||||
'notebook-list'
|
||||
'notebook-create'
|
||||
'notebook-edit'
|
||||
'tag-list'
|
||||
'tag-create'
|
||||
'tag-edit'
|
||||
'tag-remove'
|
||||
'gnsync'
|
||||
'user'
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "geeknote command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
user)
|
||||
_command_args=(
|
||||
'(--full)--full' \
|
||||
)
|
||||
;;
|
||||
logout)
|
||||
_command_args=(
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
settings)
|
||||
_command_args=(
|
||||
'(--editor)--editor' \
|
||||
)
|
||||
;;
|
||||
create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
edit)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[note title]' \
|
||||
'(-c|--content)'{-c,--content}'[note content]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
|
||||
)
|
||||
;;
|
||||
remove)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
show)
|
||||
_command_args=(
|
||||
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
|
||||
)
|
||||
;;
|
||||
find)
|
||||
_command_args=(
|
||||
'(-s|--search)'{-s,--search}'[text to search]' \
|
||||
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
|
||||
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
|
||||
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
|
||||
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
|
||||
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
|
||||
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
|
||||
)
|
||||
;;
|
||||
notebook-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-edit)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
|
||||
'(-t|--title)'{-t,--title}'[new notebook title]' \
|
||||
)
|
||||
;;
|
||||
notebook-remove)
|
||||
_command_args=(
|
||||
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
tag-create)
|
||||
_command_args=(
|
||||
'(-t|--title)'{-t,--title}'[title of tag]' \
|
||||
)
|
||||
;;
|
||||
tag-edit)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
|
||||
'(-t|--title)'{-t,--title}'[new tag name]' \
|
||||
)
|
||||
;;
|
||||
tag-remove)
|
||||
_command_args=(
|
||||
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
|
||||
'(--force)--force' \
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
||||
_arguments \
|
||||
$_command_args \
|
||||
&& return 0
|
||||
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
2
plugins/geeknote/geeknote.plugin.zsh
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#Alias
|
||||
alias gn='geeknote'
|
||||
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 reuses 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'
|
||||
|
|
|
|||
31
plugins/git-flow/README.md
Normal file
31
plugins/git-flow/README.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Git-Flow plugin
|
||||
|
||||
This plugin adds completion and aliases for the `git-flow` command. More information
|
||||
at https://github.com/nvie/gitflow.
|
||||
|
||||
Enable git-flow plugin in your zshrc file:
|
||||
```
|
||||
plugins=(... git-flow)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
More information about `git-flow` commands:
|
||||
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|---------------------------|----------------------------------------|
|
||||
| `gfl` | `git flow` | Git-Flow command |
|
||||
| `gfli` | `git flow init` | Initialize git-flow repository |
|
||||
| `gcd` | `git checkout develop` | Check out develop branch |
|
||||
| `gch` | `git checkout hotfix` | Check out hotfix branch |
|
||||
| `gcr` | `git checkout release` | Check out release branch |
|
||||
| `gflf` | `git flow feature` | List existing feature branches |
|
||||
| `gflh` | `git flow hotfix` | List existing hotfix branches |
|
||||
| `gflr` | `git flow release` | List existing release branches |
|
||||
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
|
||||
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
|
||||
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
|
||||
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
|
||||
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
|
||||
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Update your zsh's git-completion module to the newest version.
|
||||
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
|
||||
# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
|
|
@ -21,10 +21,20 @@
|
|||
#
|
||||
|
||||
#Alias
|
||||
alias gf='git flow'
|
||||
alias gfl='git flow'
|
||||
alias gfli='git flow init'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
alias gflf='git flow feature'
|
||||
alias gflh='git flow hotfix'
|
||||
alias gflr='git flow release'
|
||||
alias gflfs='git flow feature start'
|
||||
alias gflhs='git flow hotfix start'
|
||||
alias gflrs='git flow release start'
|
||||
alias gflff='git flow feature finish'
|
||||
alias gflhf='git flow hotfix finish'
|
||||
alias gflrf='git flow release finish'
|
||||
|
||||
_git-flow ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,4 +1,10 @@
|
|||
## git
|
||||
**Maintainer:** [Stibbons](https://github.com/Stibbons)
|
||||
|
||||
This plugin adds several git aliases and increase the completion function provided by zsh
|
||||
**Maintainer:** [@ncanceill](https://github.com/ncanceill)
|
||||
|
||||
This plugin adds many useful aliases and functions.
|
||||
|
||||
### Usage
|
||||
|
||||
See the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) for a list of aliases and functions provided by the plugin.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
#compdef git-branch
|
||||
|
||||
_git-branch ()
|
||||
{
|
||||
declare l c m d
|
||||
|
||||
l='--color --no-color -r -a --all -v --verbose --abbrev --no-abbrev'
|
||||
c='-l -f --force -t --track --no-track --set-upstream --contains --merged --no-merged'
|
||||
m='-m -M'
|
||||
d='-d -D'
|
||||
|
||||
declare -a dependent_creation_args
|
||||
if (( words[(I)-r] == 0 )); then
|
||||
dependent_creation_args=(
|
||||
"($l $m $d): :__git_branch_names"
|
||||
"::start-point:__git_revisions")
|
||||
fi
|
||||
|
||||
declare -a dependent_deletion_args
|
||||
if (( words[(I)-d] || words[(I)-D] )); then
|
||||
dependent_creation_args=
|
||||
dependent_deletion_args=(
|
||||
'-r[delete only remote-tracking branches]')
|
||||
if (( words[(I)-r] )); then
|
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_remote_branch_names'
|
||||
else
|
||||
dependent_deletion_args+='*: :__git_ignore_line_inside_arguments __git_branch_names'
|
||||
fi
|
||||
fi
|
||||
|
||||
declare -a dependent_modification_args
|
||||
if (( words[(I)-m] || words[(I)-M] )); then
|
||||
dependent_creation_args=
|
||||
dependent_modification_args=(
|
||||
':old or new branch name:__git_branch_names'
|
||||
'::new branch name:__git_branch_names')
|
||||
fi
|
||||
|
||||
_arguments -w -S -s \
|
||||
"($c $m $d --no-color :)--color=-[turn on branch coloring]:: :__git_color_whens" \
|
||||
"($c $m $d : --color)--no-color[turn off branch coloring]" \
|
||||
"($c $m -a --all)-r[list or delete only remote-tracking branches]" \
|
||||
"($c $m $d : -r)"{-a,--all}"[list both remote-tracking branches and local branches]" \
|
||||
"($c $m $d : -v --verbose)"{-v,--verbose}'[show SHA1 and commit subject line for each head]' \
|
||||
"($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \
|
||||
"($c $m $d :)--no-abbrev[do not abbreviate sha1s]" \
|
||||
"($l $m $d)-l[create the branch's reflog]" \
|
||||
"($l $m $d -f --force)"{-f,--force}"[force the creation of a new branch]" \
|
||||
"($l $m $d -t --track)"{-t,--track}"[set up configuration so that pull merges from the start point]" \
|
||||
"($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
|
||||
"($l $m $d)--set-upstream[set up configuration so that pull merges]" \
|
||||
"($l $m $d)--contains=[only list branches which contain the specified commit]: :__git_committishs" \
|
||||
"($l $m $d)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \
|
||||
"($l $m $d)--no-merged=[do not list branches which are fully contained by HEAD]: :__git_committishs" \
|
||||
$dependent_creation_args \
|
||||
"($l $c $d -M)-m[rename a branch and the corresponding reflog]" \
|
||||
"($l $c $d -m)-M[rename a branch even if the new branch-name already exists]" \
|
||||
$dependent_modification_args \
|
||||
"($l $c $m -D)-d[delete a fully merged branch]" \
|
||||
"($l $c $m -d)-D[delete a branch]" \
|
||||
$dependent_deletion_args
|
||||
}
|
||||
|
||||
(( $+functions[__git_ignore_line] )) ||
|
||||
__git_ignore_line () {
|
||||
declare -a ignored
|
||||
ignored=()
|
||||
((CURRENT > 1)) &&
|
||||
ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
|
||||
((CURRENT < $#line)) &&
|
||||
ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
|
||||
$* -F ignored
|
||||
}
|
||||
|
||||
(( $+functions[__git_ignore_line_inside_arguments] )) ||
|
||||
__git_ignore_line_inside_arguments () {
|
||||
declare -a compadd_opts
|
||||
|
||||
zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F:
|
||||
|
||||
__git_ignore_line $* $compadd_opts
|
||||
}
|
||||
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
#compdef git-remote
|
||||
|
||||
# NOTE: --track is undocumented.
|
||||
# TODO: --track, -t, --master, and -m should take remote branches, I guess.
|
||||
# NOTE: --master is undocumented.
|
||||
# NOTE: --fetch is undocumented.
|
||||
_git-remote () {
|
||||
local curcontext=$curcontext state line
|
||||
declare -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options' && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
declare -a commands
|
||||
|
||||
commands=(
|
||||
'add:add a new remote'
|
||||
'show:show information about a given remote'
|
||||
'prune:delete all stale tracking branches for a given remote'
|
||||
'update:fetch updates for a set of remotes'
|
||||
'rm:remove a remote from .git/config and all associated tracking branches'
|
||||
'rename:rename a remote from .git/config and update all associated tracking branches'
|
||||
'set-head:sets or deletes the default branch'
|
||||
'set-branches:changes the list of branches tracked by the named remote.'
|
||||
'set-url:changes URL remote points to.'
|
||||
)
|
||||
|
||||
_describe -t commands 'sub-command' commands && ret=0
|
||||
;;
|
||||
(options)
|
||||
case $line[1] in
|
||||
(add)
|
||||
_arguments \
|
||||
'*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \
|
||||
'(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \
|
||||
'(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \
|
||||
':branch name:__git_remotes' \
|
||||
':url:_urls' && ret=0
|
||||
;;
|
||||
(show)
|
||||
_arguments \
|
||||
'-n[do not contact the remote for a list of branches]' \
|
||||
':remote:__git_remotes' && ret=0
|
||||
;;
|
||||
(prune)
|
||||
_arguments \
|
||||
'(--dry-run -n)'{-n,--dry-run}'[do not actually prune, only list what would be done]' \
|
||||
':remote:__git_remotes' && ret=0
|
||||
;;
|
||||
(update)
|
||||
__git_remote-groups && ret=0
|
||||
;;
|
||||
(rm)
|
||||
__git_remotes && ret=0
|
||||
;;
|
||||
(rename)
|
||||
__git_remotes && ret=0
|
||||
;;
|
||||
(set-url)
|
||||
_arguments \
|
||||
'*--push[manipulate push URLs]' \
|
||||
'(--add)--add[add URL]' \
|
||||
'(--delete)--delete[delete URLs]' \
|
||||
':branch name:__git_remotes' \
|
||||
':url:_urls' && ret=0
|
||||
;;
|
||||
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
@ -1,177 +1,238 @@
|
|||
# Aliases
|
||||
alias g='git'
|
||||
compdef g=git
|
||||
alias gst='git status'
|
||||
compdef _git gst=git-status
|
||||
alias gd='git diff'
|
||||
compdef _git gd=git-diff
|
||||
alias gdc='git diff --cached'
|
||||
compdef _git gdc=git-diff
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
compdef _git gdc=git diff-tree --no-commit-id --name-only -r
|
||||
alias gl='git pull'
|
||||
compdef _git gl=git-pull
|
||||
alias gup='git pull --rebase'
|
||||
compdef _git gup=git-fetch
|
||||
alias gp='git push'
|
||||
compdef _git gp=git-push
|
||||
alias gd='git diff'
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
alias gdt='git difftool'
|
||||
alias gc='git commit -v'
|
||||
compdef _git gc=git-commit
|
||||
alias gc!='git commit -v --amend'
|
||||
compdef _git gc!=git-commit
|
||||
alias gca='git commit -v -a'
|
||||
compdef _git gc=git-commit
|
||||
alias gca!='git commit -v -a --amend'
|
||||
compdef _git gca!=git-commit
|
||||
alias gcmsg='git commit -m'
|
||||
compdef _git gcmsg=git-commit
|
||||
alias gco='git checkout'
|
||||
compdef _git gco=git-checkout
|
||||
alias gcm='git checkout master'
|
||||
alias gr='git remote'
|
||||
compdef _git gr=git-remote
|
||||
alias grv='git remote -v'
|
||||
compdef _git grv=git-remote
|
||||
alias grmv='git remote rename'
|
||||
compdef _git grmv=git-remote
|
||||
alias grrm='git remote remove'
|
||||
compdef _git grrm=git-remote
|
||||
alias grset='git remote set-url'
|
||||
compdef _git grset=git-remote
|
||||
alias grup='git remote update'
|
||||
compdef _git grset=git-remote
|
||||
alias grbi='git rebase -i'
|
||||
compdef _git grbi=git-rebase
|
||||
alias grbc='git rebase --continue'
|
||||
compdef _git grbc=git-rebase
|
||||
alias grba='git rebase --abort'
|
||||
compdef _git grba=git-rebase
|
||||
alias gb='git branch'
|
||||
compdef _git gb=git-branch
|
||||
alias gba='git branch -a'
|
||||
compdef _git gba=git-branch
|
||||
alias gbr='git branch --remote'
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
alias gcl='git config --list'
|
||||
alias gcp='git cherry-pick'
|
||||
compdef _git gcp=git-cherry-pick
|
||||
alias glg='git log --stat --max-count=10'
|
||||
compdef _git glg=git-log
|
||||
alias glgg='git log --graph --max-count=10'
|
||||
compdef _git glgg=git-log
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
compdef _git glgga=git-log
|
||||
alias glo='git log --oneline --decorate --color'
|
||||
compdef _git glo=git-log
|
||||
alias glog='git log --oneline --decorate --color --graph'
|
||||
compdef _git glog=git-log
|
||||
alias gss='git status -s'
|
||||
compdef _git gss=git-status
|
||||
alias ga='git add'
|
||||
compdef _git ga=git-add
|
||||
alias gap='git add --patch'
|
||||
alias gaa='git add --all'
|
||||
alias gm='git merge'
|
||||
compdef _git gm=git-merge
|
||||
alias grh='git reset HEAD'
|
||||
alias grhh='git reset HEAD --hard'
|
||||
alias gclean='git reset --hard && git clean -dfx'
|
||||
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
# Query/use custom command for `git`.
|
||||
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
|
||||
: ${_omz_git_git_cmd:=git}
|
||||
|
||||
# Sign and verify commits with GPG
|
||||
alias gcs='git commit -S'
|
||||
compdef _git gcs=git-commit
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
compdef _git gsps=git-show
|
||||
|
||||
# Sign and verify tags with GPG
|
||||
alias gts='git tag -s'
|
||||
compdef _git gts=git-tag
|
||||
alias gvt='git verify-tag'
|
||||
compdef _git gvt=git verify-tag
|
||||
|
||||
#remove the gf alias
|
||||
#alias gf='git ls-files | grep'
|
||||
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
alias gmt='git mergetool --no-prompt'
|
||||
compdef _git gmt=git-mergetool
|
||||
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
alias gk='gitk --all --branches'
|
||||
|
||||
alias gsts='git stash show --text'
|
||||
alias gsta='git stash'
|
||||
alias gstp='git stash pop'
|
||||
alias gstd='git stash drop'
|
||||
|
||||
# Will cd into the top of the current repository
|
||||
# or submodule.
|
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
||||
|
||||
# Git and svn mix
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||
compdef git-svn-dcommit-push=git
|
||||
|
||||
alias gsr='git svn rebase'
|
||||
alias gsd='git svn dcommit'
|
||||
#
|
||||
# Will return the current branch name
|
||||
# Usage example: git pull origin $(current_branch)
|
||||
# Functions
|
||||
#
|
||||
|
||||
# The name of the current branch
|
||||
# Back-compatibility wrapper for when this function was defined here in
|
||||
# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
|
||||
# to fix the core -> git plugin dependency.
|
||||
function current_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo ${ref#refs/heads/}
|
||||
git_current_branch
|
||||
}
|
||||
|
||||
# The list of remotes
|
||||
function current_repository() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo $(git remote -v | cut -d':' -f 2)
|
||||
if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
|
||||
return
|
||||
fi
|
||||
echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
|
||||
}
|
||||
|
||||
# these aliases take advantage of the previous function
|
||||
alias ggpull='git pull origin $(current_branch)'
|
||||
compdef ggpull=git
|
||||
alias ggpur='git pull --rebase origin $(current_branch)'
|
||||
compdef ggpur=git
|
||||
alias ggpush='git push origin $(current_branch)'
|
||||
compdef ggpush=git
|
||||
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
|
||||
compdef ggpnp=git
|
||||
|
||||
# Pretty log messages
|
||||
function _git_log_prettily(){
|
||||
if ! [ -z $1 ]; then
|
||||
git log --pretty=$1
|
||||
fi
|
||||
}
|
||||
alias glp="_git_log_prettily"
|
||||
compdef _git glp=git-log
|
||||
|
||||
# Work In Progress (wip)
|
||||
# These features allow to pause a branch development and switch to another one (wip)
|
||||
# When you want to go back to work, just unwip it
|
||||
#
|
||||
# This function return a warning if the current branch is a wip
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
|
||||
echo "WIP!!"
|
||||
fi
|
||||
}
|
||||
# these alias commit and uncomit wip branches
|
||||
alias gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"'
|
||||
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
|
||||
|
||||
# these alias ignore changes to file
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
#
|
||||
|
||||
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'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbl='git blame -b -w'
|
||||
alias gbnm='git branch --no-merged'
|
||||
alias gbr='git branch --remote'
|
||||
alias gbs='git bisect'
|
||||
alias gbsb='git bisect bad'
|
||||
alias gbsg='git bisect good'
|
||||
alias gbsr='git bisect reset'
|
||||
alias gbss='git bisect start'
|
||||
|
||||
alias gc='git commit -v'
|
||||
alias gc!='git commit -v --amend'
|
||||
alias gcn!='git commit -v --no-edit --amend'
|
||||
alias gca='git commit -v -a'
|
||||
alias gca!='git commit -v -a --amend'
|
||||
alias gcan!='git commit -v -a --no-edit --amend'
|
||||
alias gcans!='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 clean -fd'
|
||||
alias gpristine='git reset --hard && git clean -dfx'
|
||||
alias gcm='git checkout master'
|
||||
alias gcd='git checkout develop'
|
||||
alias gcmsg='git commit -m'
|
||||
alias gco='git checkout'
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gcs='git commit -S'
|
||||
|
||||
alias gd='git diff'
|
||||
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'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
gdv() { git diff -w "$@" | view - }
|
||||
compdef _git gdv=git-diff
|
||||
|
||||
alias gf='git fetch'
|
||||
alias gfa='git fetch --all --prune'
|
||||
alias gfo='git fetch origin'
|
||||
|
||||
function gfg() { git ls-files | grep $@ }
|
||||
compdef _grep gfg
|
||||
|
||||
alias gg='git gui citool'
|
||||
alias gga='git gui citool --amend'
|
||||
|
||||
ggf() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git push --force origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggf=git-checkout
|
||||
|
||||
ggl() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git pull origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git pull origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggl=git-checkout
|
||||
|
||||
ggp() {
|
||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||
git push origin "${*}"
|
||||
else
|
||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
||||
git push origin "${b:=$1}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggp=git-checkout
|
||||
|
||||
ggpnp() {
|
||||
if [[ "$#" == 0 ]]; then
|
||||
ggl && ggp
|
||||
else
|
||||
ggl "${*}" && ggp "${*}"
|
||||
fi
|
||||
}
|
||||
compdef _git ggpnp=git-checkout
|
||||
|
||||
ggu() {
|
||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
||||
git pull --rebase origin "${b:=$1}"
|
||||
}
|
||||
compdef _git ggu=git-checkout
|
||||
|
||||
alias ggpur='ggu'
|
||||
compdef _git ggpur=git-checkout
|
||||
|
||||
alias ggpull='git pull origin $(git_current_branch)'
|
||||
compdef _git ggpull=git-checkout
|
||||
|
||||
alias ggpush='git push origin $(git_current_branch)'
|
||||
compdef _git ggpush=git-checkout
|
||||
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
|
||||
alias ghh='git help'
|
||||
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gunignore='git update-index --no-assume-unchanged'
|
||||
# list temporarily ignored files
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
|
||||
compdef git-svn-dcommit-push=git
|
||||
|
||||
alias gk='\gitk --all --branches'
|
||||
compdef _git gk='gitk'
|
||||
alias gke='\gitk --all $(git log -g --pretty=%h)'
|
||||
compdef _git gke='gitk'
|
||||
|
||||
alias gl='git pull'
|
||||
alias glg='git log --stat'
|
||||
alias glgp='git log --stat -p'
|
||||
alias glgg='git log --graph'
|
||||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glp="_git_log_prettily"
|
||||
compdef _git glp=git-log
|
||||
|
||||
alias gm='git merge'
|
||||
alias gmom='git merge origin/master'
|
||||
alias gmt='git mergetool --no-prompt'
|
||||
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
|
||||
alias gmum='git merge upstream/master'
|
||||
|
||||
alias gp='git push'
|
||||
alias gpd='git push --dry-run'
|
||||
alias gpoat='git push origin --all && git push origin --tags'
|
||||
compdef _git gpoat=git-push
|
||||
alias gpu='git push upstream'
|
||||
alias gpv='git push -v'
|
||||
|
||||
alias gr='git remote'
|
||||
alias gra='git remote add'
|
||||
alias grb='git rebase'
|
||||
alias grba='git rebase --abort'
|
||||
alias grbc='git rebase --continue'
|
||||
alias grbi='git rebase -i'
|
||||
alias grbm='git rebase master'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grh='git reset HEAD'
|
||||
alias grhh='git reset HEAD --hard'
|
||||
alias grmv='git remote rename'
|
||||
alias grrm='git remote remove'
|
||||
alias grset='git remote set-url'
|
||||
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
|
||||
alias gru='git reset --'
|
||||
alias grup='git remote update'
|
||||
alias grv='git remote -v'
|
||||
|
||||
alias gsb='git status -sb'
|
||||
alias gsd='git svn dcommit'
|
||||
alias gsi='git submodule init'
|
||||
alias gsps='git show --pretty=short --show-signature'
|
||||
alias gsr='git svn rebase'
|
||||
alias gss='git status -s'
|
||||
alias gst='git status'
|
||||
alias gsta='git stash save'
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
alias gsts='git stash show --text'
|
||||
alias gsu='git submodule update'
|
||||
|
||||
alias gts='git tag -s'
|
||||
alias 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 gwch='git whatchanged -p --abbrev-commit --pretty=medium'
|
||||
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@ if [ -z "$script" ]; then
|
|||
local -a locations
|
||||
local e
|
||||
locations=(
|
||||
"$(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
|
||||
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
|
||||
)
|
||||
for e in $locations; do
|
||||
test -f $e && script="$e" && break
|
||||
|
|
@ -76,6 +76,14 @@ __gitcomp_nl ()
|
|||
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_nl_append ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
||||
local IFS=$'\n'
|
||||
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
|
||||
}
|
||||
|
||||
__gitcomp_file ()
|
||||
{
|
||||
emulate -L zsh
|
||||
|
|
@ -96,6 +104,7 @@ __git_zsh_bash_func ()
|
|||
|
||||
local expansion=$(__git_aliased_command "$command")
|
||||
if [ -n "$expansion" ]; then
|
||||
words[1]=$expansion
|
||||
completion_func="_git_${expansion//-/_}"
|
||||
declare -f $completion_func >/dev/null && $completion_func
|
||||
fi
|
||||
|
|
@ -205,8 +214,10 @@ _git ()
|
|||
|
||||
if (( $+functions[__${service}_zsh_main] )); then
|
||||
__${service}_zsh_main
|
||||
else
|
||||
elif (( $+functions[__${service}_main] )); then
|
||||
emulate ksh -c __${service}_main
|
||||
elif (( $+functions[_${service}] )); then
|
||||
emulate ksh -c _${service}
|
||||
fi
|
||||
|
||||
let _ret && _default && _ret=0
|
||||
|
|
|
|||
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