1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-26 07:40:07 +00:00

Merge pull request #3809 from ncanceill/easymerge

Easy-to-Merge
This commit is contained in:
Robby Russell 2015-06-14 21:46:41 -07:00
commit 78bbf7a6e5
47 changed files with 1421 additions and 536 deletions

View file

@ -15,9 +15,9 @@ To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com
__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ __Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._
* Unix-based operating system (Mac OS X or Linux) * Unix-based operating system (Mac OS X or Linux)
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent) * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* This is commonly pre-installed. (`zsh --version` to confirm)
* `curl` or `wget` should be installed * `curl` or `wget` should be installed
* `git` should be installed
### Basic Installation ### Basic Installation
@ -25,11 +25,11 @@ Oh My Zsh is installed by running one of the following commands in your terminal
#### via curl #### via curl
`curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh` `sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"`
#### via wget #### via wget
`wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh` `sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"`
## Using Oh My Zsh ## Using Oh My Zsh
@ -51,7 +51,7 @@ Most plugins (should! we're working on this) include a __README__, which documen
### Themes ### Themes
We'll admit it. Early in the Oh My Zsh world... we may have gotten a far too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out! We'll admit it. Early in the Oh My Zsh world... we may have gotten far too theme happy. We have over one hundred themes now bundled. Most of them have [screenshots](https://wiki.github.com/robbyrussell/oh-my-zsh/themes) on the wiki. Check them out!
#### Selecting a Theme #### Selecting a Theme
@ -67,6 +67,8 @@ To use a different theme, simple change the value to match the name of your desi
Open up a new terminal window and your prompt should look something like... Open up a new terminal window and your prompt should look something like...
In case you did not find a suitable theme for your needs, please have a look at the wiki for [more themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
## Advanced Topics ## Advanced Topics
If you're the type that likes to get their hands dirty... these sections might resonate. If you're the type that likes to get their hands dirty... these sections might resonate.
@ -154,7 +156,7 @@ We also need people to test out pull-requests. So take a look through [the open
### Do NOT Send Us Themes ### Do NOT Send Us Themes
We have (more than) enough themes for the time being. Please fork the project and add one in there you can let people know how to grab it from there. We have (more than) enough themes for the time being. Please add your theme to the [external themes](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes) wiki page.
## Contributors ## Contributors

View file

@ -36,23 +36,26 @@ git_remote_status() {
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
if [ $ahead -eq 0 ] && [ $behind -gt 0 ] if [ $ahead -gt 0 ] && [ $behind -eq 0 ]
then then
echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
elif [ $behind -gt 0 ] && [ $ahead -eq 0 ]
then then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] elif [ $ahead -gt 0 ] && [ $behind -gt 0 ]
then then
echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE"
git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}"
fi fi
fi
}
# Checks if there are commits ahead from remote if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]
function git_prompt_ahead() { then
if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi
echo $git_remote_status
fi fi
} }
@ -64,6 +67,29 @@ function git_commits_ahead() {
fi fi
} }
# Outputs if current branch is ahead of remote
function git_prompt_ahead() {
if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
fi
}
# Outputs if current branch is behind remote
function git_prompt_behind() {
if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_BEHIND"
fi
}
# Outputs if current branch exists on remote or not
function git_prompt_remote() {
if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS"
else
echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING"
fi
}
# Formats prompt string for current git commit short SHA # Formats prompt string for current git commit short SHA
function git_prompt_short_sha() { function git_prompt_short_sha() {
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"

View file

@ -20,3 +20,6 @@ alias afind='ack-grep -il'
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
fi fi
# recognize comments
setopt interactivecomments

View file

@ -14,7 +14,7 @@ if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom" ZSH_CUSTOM="$ZSH/custom"
fi fi
# Set ZSH_CACHE_DIR to the path where cache files sould be created # Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/ # or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache/" ZSH_CACHE_DIR="$ZSH/cache/"
@ -29,6 +29,11 @@ for config_file ($ZSH/lib/*.zsh); do
source $config_file source $config_file
done done
# Load all of your custom configurations from custom/
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
source $config_file
done
unset config_file
is_plugin() { is_plugin() {
local base_dir=$1 local base_dir=$1
@ -72,12 +77,6 @@ for plugin ($plugins); do
fi fi
done done
# Load all of your custom configurations from custom/
for config_file ($ZSH_CUSTOM/*.zsh(N)); do
source $config_file
done
unset config_file
# Load the theme # Load the theme
if [ "$ZSH_THEME" = "random" ]; then if [ "$ZSH_THEME" = "random" ]; then
themes=($ZSH/themes/*zsh-theme) themes=($ZSH/themes/*zsh-theme)

View file

@ -16,14 +16,22 @@ _1st_arguments=(
'help:show the help message' 'help:show the help message'
'install:push this package file to the device and install it' 'install:push this package file to the device and install it'
'jdwp:list PIDs of processes hosting a JDWP transport' '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' 'pull:copy file/dir from device'
'push:copy file/dir to 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' 'shell:run remote shell interactively'
'sync:copy host->device only if changed (-l means list but dont copy)' 'sync:copy host->device only if changed (-l means list but dont copy)'
tcpip:restart host adb in tcpip mode 'start-server:ensure that there is a server running'
'tcpip:restart host adb in tcpip mode'
'uninstall:remove this app package from the device' 'uninstall:remove this app package from the device'
'version:show version num' 'version:show version num'
'wait-for-device:block until device is online'
) )
local expl local expl

View 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)
---

View file

@ -0,0 +1,64 @@
## ARCHLINUX PLUGIN
---
### FEATURES
| Alias | Function | Description |
|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
| pacin | sudo pacman -S | Install specific package(s) from the repositories |
| pacins | sudo pacman -U | Install specific package not from the repositories but from a file |
| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package |
| pacloc | pacman -Qi | Display information about a given package in the local database |
| paclocs | pacman -Qs | Search for package(s) in the local database |
| paclsorphans | sudo pacman -Qdt' | List all orphaned packages |
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
| pacrep | pacman -Si | Display information about a given package in the repositories |
| pacreps | pacman -Ss | Search for package(s) in the repositories |
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages |
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories |
| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. |
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
| yain | yaourt -S | Install specific package(s) from the repositories |
| yains | yaourt -U | Install specific package not from the repositories but from a file |
| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package |
| yaloc | yaourt -Qi | Display information about a given package in the local database |
| yalocs | yaourt -Qs | Search for package(s) in the local database |
| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") |
| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
| yarep | yaourt -Si | Display information about a given package in the repositories |
| yareps | yaourt -Ss | Search for package(s) in the repositories |
| yasu | yaourt --sucre | Same as yaupg, but without confirmation |
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
| yaupd | yaourt -Sy | Update and refresh the local package database against repositories |
| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system |
| Function | Description |
|----------------|:------------------------------------------------------------------------------------------------------------------|
| pacdisowned | List all disowned files in your system |
| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) |
| pacmanallkeys | Get all keys for developers and trusted users |
| pacmansignkeys | |
---
### CONTRIBUTORS
- Benjamin Boudreau - dreurmail@gmail.com
- Celso Miranda - contacto@celsomiranda.net
- KhasMek - Boushh@gmail.com
- Martin Putniorz - mputniorz@gmail.com
- MatthR3D - matthr3d@gmail.com
- ornicar - thibault.duplessis@gmail.com
---

View file

@ -2,7 +2,7 @@
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins # 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. # Look for yaourt, and add some useful functions if we have it.
if [[ -x `which yaourt` ]]; then if [[ -x `command -v yaourt` ]]; then
upgrade () { upgrade () {
yaourt -Syu yaourt -Syu
} }
@ -21,11 +21,11 @@ if [[ -x `which yaourt` ]]; then
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
# Additional yaourt alias examples # Additional yaourt alias examples
if [[ -x `which abs` && -x `which aur` ]]; then if [[ -x `command -v abs` && -x `command -v aur` ]]; then
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
elif [[ -x `which abs` ]]; then elif [[ -x `command -v abs` ]]; then
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
elif [[ -x `which aur` ]]; then elif [[ -x `command -v aur` ]]; then
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else else
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori
alias pacloc='pacman -Qi' # Display information about a given package in the local database alias 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 alias paclocs='pacman -Qs' # Search for package(s) in the local database
# Additional pacman alias examples # Additional pacman alias examples
if [[ -x `which abs` && -x `which aur` ]]; then if [[ -x `command -v abs` && -x `command -v aur` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
elif [[ -x `which abs` ]]; then elif [[ -x `command -v abs` ]]; then
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
elif [[ -x `which aur` ]]; then elif [[ -x `command -v aur` ]]; then
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
else else
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories

17
plugins/atom/README.md Normal file
View file

@ -0,0 +1,17 @@
## atom
Plugin for Atom, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
### Requirements
* [Atom](https://atom.io/)
### Usage
* If `at` command is called without an argument, launch Atom
* If `at` is passed a directory, `cd` to it and open it in Atom
* If `at` is passed a file, open it in Atom
* if `att` command is called, it is equivalent to `at .`, opening the current folder in Atom

View file

@ -22,7 +22,7 @@ function aws_profiles {
compctl -K aws_profiles asp compctl -K aws_profiles asp
if _homebrew-installed && _awscli-homebrew-installed ; then 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 else
_aws_zsh_completer_path=$(which aws_zsh_completer.sh) _aws_zsh_completer_path=$(which aws_zsh_completer.sh)
fi fi

View file

@ -33,9 +33,9 @@ bgnotify () {
if hash terminal-notifier 2>/dev/null; then #osx if hash terminal-notifier 2>/dev/null; then #osx
terminal-notifier -message "$2" -title "$1" terminal-notifier -message "$2" -title "$1"
elif hash growlnotify 2>/dev/null; then #osx growl elif hash growlnotify 2>/dev/null; then #osx growl
growlnotify -m $1 $2 growlnotify -m "$1" "$2"
elif hash notify-send 2>/dev/null; then #ubuntu! elif hash notify-send 2>/dev/null; then #ubuntu!
notify-send $1 $2 notify-send "$1" "$2"
elif hash notifu 2>/dev/null; then #cygwyn support! elif hash notifu 2>/dev/null; then #cygwyn support!
notifu /m "$2" /p "$1" notifu /m "$2" /p "$1"
fi fi

View file

@ -35,6 +35,7 @@ _1st_arguments=(
'info:information about a formula' 'info:information about a formula'
'install:install a formula' 'install:install a formula'
'reinstall:install a formula anew; re-using its current options' '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' 'link:link a formula'
'list:list files in a formula or not-installed formulae' 'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula' 'log:git commit log for a formula'

View file

@ -39,7 +39,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
## Excluded gems ## 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` `berks`
`foreman` `foreman`

View file

@ -100,11 +100,6 @@ __info() {
# no arguments # no arguments
} }
__insert() {
__docker_images
_arguments '*:files:_files'
}
__inspect() { __inspect() {
__docker_images __docker_images
__docker_all_containers __docker_all_containers
@ -278,7 +273,6 @@ _1st_arguments=(
"images":"List images" "images":"List images"
"import":"Create a new filesystem image from the contents of a tarball" "import":"Create a new filesystem image from the contents of a tarball"
"info":"Display system-wide information" "info":"Display system-wide information"
"insert":"Insert a file in an image"
"inspect":"Return low-level information on a container" "inspect":"Return low-level information on a container"
"kill":"Kill a running container" "kill":"Kill a running container"
"load":"Load an image from a tar archive" "load":"Load an image from a tar archive"
@ -335,8 +329,6 @@ case "$words[1]" in
__import ;; __import ;;
info) info)
__info ;; __info ;;
insert)
__insert ;;
inspect) inspect)
__inspect ;; __inspect ;;
kill) kill)

View file

@ -0,0 +1,13 @@
## forklift
Plugin for ForkLift, an FTP application for OS X.
### Requirements
* [ForkLift](http://forkliftapp.com/forklift/)
### Usage
* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .`
* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift

View file

@ -1,6 +1,6 @@
To activate this script, please include it the `plugins` variable within `~/.zshrc` To activate this script, please include it the `plugins` variable within `~/.zshrc`
`plugins=(git history-substring-search.zsh)` `plugins=(git history-substring-search)`
See the "history-substring-search.zsh" file for more information: See the "history-substring-search.zsh" file for more information:

15
plugins/history/README.md Normal file
View file

@ -0,0 +1,15 @@
## history
Provides a couple of convenient aliases for using the `history` command to examine your command line history.
### Requirements
* None.
### Usage
* If `h` is called, your command history is listed. Equivalent to using `history`
* If `hsi` is called with an argument, a **case insensitive** `grep` search is performed on your command history, looking for commands that match the argument provided
* If `hsi` is called without an argument you will help on `grep` arguments

6
plugins/httpie/README.md Normal file
View file

@ -0,0 +1,6 @@
## HTTPie
**Maintainer:** [lululau](https://github.com/lululau)
This plugin adds completion for HTTPie, which is a command line HTTP client, a user-friendly cURL replacement.
[HTTPie Homepage](http://httpie.org)

View file

@ -49,6 +49,20 @@ open_jira_issue () {
else else
$open_cmd "$jira_url/browse/$jira_prefix$1" $open_cmd "$jira_url/browse/$jira_prefix$1"
fi fi
else
local addcomment=''
if [[ "$2" == "m" ]]; then
addcomment="#add-comment"
echo "Add comment to issue #$1"
else
echo "Opening issue #$1"
fi
if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then
$open_cmd "$jira_url/issues/$1$addcomment"
else
$open_cmd "$jira_url/browse/$1$addcomment"
fi
fi fi
} }

View file

@ -13,7 +13,7 @@ jump() {
} }
mark() { mark() {
if (( $# == 0 )); then if [[ ( $# == 0 ) || ( "$1" == "." ) ]]; then
MARK=$(basename "$PWD") MARK=$(basename "$PWD")
else else
MARK="$1" MARK="$1"

41
plugins/kitchen/_kitchen Normal file
View file

@ -0,0 +1,41 @@
# author: Peter Eisentraut
# source: https://gist.github.com/petere/10307599
# compdef kitchen
_kitchen() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments '1: :->cmds'\
'2: :->args'
case $state in
cmds)
_arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)"
;;
args)
case $line[1] in
converge|create|destroy|diagnose|list|setup|test|verify)
compadd "$@" all
_kitchen_instances
;;
login)
_kitchen_instances
;;
esac
;;
esac
}
_kitchen_instances() {
if [[ $_kitchen_instances_cache_dir != $PWD ]]; then
unset _kitchen_instances_cache
fi
if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then
_kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"})
_kitchen_instances_cache_dir=$PWD
fi
compadd -a _kitchen_instances_cache
}
_kitchen "$@"

View file

@ -15,6 +15,6 @@ compdef _laravel5 la5
#Alias #Alias
alias la5='php artisan' alias la5='php artisan'
alias la5dump='php artisan dump-autoload'
alias la5cache='php artisan cache:clear' alias la5cache='php artisan cache:clear'
alias la5routes='php artisan routes' alias la5routes='php artisan route:list'
alias la5vendor='php artisan vendor:publish'

View file

@ -15,7 +15,7 @@ function chpwd() {
# Changes directory to the last working directory. # Changes directory to the last working directory.
function lwd() { function lwd() {
[[ ! -r "$cache_file" ]] || cd `cat "$cache_file"` [[ ! -r "$cache_file" ]] || cd "`cat "$cache_file"`"
} }
# Automatically jump to last working directory unless this isn't the first time # Automatically jump to last working directory unless this isn't the first time

View file

@ -0,0 +1,64 @@
# Mercurial plugin
### Usage
Update .zshrc:
1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)`
(that is pretty obvious).
2. Change PROMPT variable of current theme to contain current folder mercurial repo info:
robbyrussel theme is used by default, so you need to modify PROMPT var
from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme)
by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it
looks next:
```diff
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
```
and put modified var at the end of **.zshrc**.
3. Initialize additional vars used in plugin. So in short put next in **.zshrc**:
```
ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_HG_PROMPT_DIRTY="%{$fg[magenta]%}) %{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})"
```
### What's inside?
#### Adds handy aliases:
###### general
* `hgc` - `hg commit`
* `hgb` - `hg branch`
* `hgba` - `hg branches`
* `hgbk` - `hg bookmarks`
* `hgco` - `hg checkout`
* `hgd` - `hg diff`
* `hged` - `hg diffmerge`
###### pull and update
* `hgi` - `hg incoming`
* `hgl` - `hg pull -u`
* `hglr` - `hg pull --rebase`
* `hgo` - `hg outgoing`
* `hgp` - `hg push`
* `hgs` - `hg status`
* `hgsl` - `hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"`
###### this is the 'git commit --amend' equivalent
* `hgca` - `hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip`
###### list unresolved files (since hg does not list unmerged files in the status command)
* `hgun` - `hg resolve --list`
#### Displays repo branch and directory status in prompt
This is the same as git plugin does.
**Note**: additional changes to **.zshrc** are required in order for this to
work.
### Mantainers
[ptrv](https://github.com/ptrv) - original creator
[oshybystyi](https://github.com/oshybystyi) - created this README and know how most of code works

View file

@ -0,0 +1,28 @@
# mix-fast
Fast mix autocompletion plugin.
This script caches the output for later usage and significantly speeds it up.
It generates a .mix_tasks cache file for current project. Currently if you want
to update cache you should remove .mix_tasks file
Inspired by and based on rake-fast zsh plugin.
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-mix-task-completion-for-zsh/).
## Installation
Just add the plugin to your `.zshrc`:
```bash
plugins=(foo bar mix-fast)
```
You might consider adding `.mix_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore)
## Usage
`mix`, then press tab
Currently maintained by [styx](https://github.com/styx/)

View file

@ -0,0 +1,29 @@
_mix_refresh () {
if [ -f .mix_tasks ]; then
rm .mix_tasks
fi
echo "Generating .mix_tasks..." > /dev/stderr
_mix_generate
cat .mix_tasks
}
_mix_does_task_list_need_generating () {
[ ! -f .mix_tasks ];
}
_mix_generate () {
mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
}
_mix () {
if [ -f mix.exs ]; then
if _mix_does_task_list_need_generating; then
echo "\nGenerating .mix_tasks..." > /dev/stderr
_mix_generate
fi
compadd `cat .mix_tasks`
fi
}
compdef _mix mix
alias mix_refresh='_mix_refresh'

View file

@ -5,24 +5,39 @@
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'archive:Archive this project into a .ez file' 'app.start:Start all registered apps'
'clean:Clean generated application files' 'archive:List all archives'
'archive.build:Archive this project into a .ez file'
'archive.install:Install an archive locally'
'archive.uninstall:Uninstall archives'
'clean:Delete generated application files'
'cmd:Executes the given command'
'compile:Compile source files' 'compile:Compile source files'
'compile.protocols:Consolidates all protocols in all paths'
'deps:List dependencies and their status' 'deps:List dependencies and their status'
"deps.clean:Remove dependencies' files" "deps.clean:Remove the given dependencies' files"
'deps.compile:Compile dependencies' 'deps.compile:Compile dependencies'
'deps.get:Get all out of date dependencies' 'deps.get:Get all out of date dependencies'
'deps.unlock:Unlock the given dependencies' 'deps.unlock:Unlock the given dependencies'
'deps.update:Update dependencies' 'deps.update:Update the given dependencies'
'do:Executes the commands separated by comma' 'do:Executes the tasks separated by comma'
'escriptize:Generates an escript for the project' 'escript.build:Builds an escript for the project'
'help:Print help information for tasks' 'help:Print help information for tasks'
'hex:Print hex help information'
'hex.config:Read or update hex config'
'hex.docs:Publish docs for package'
'hex.info:Print hex information'
'hex.key:Hex API key tasks'
'hex.outdated:Shows outdated hex deps for the current project'
'hex.owner:Hex package ownership tasks'
'hex.publish:Publish a new package version'
'hex.search:Search for package names'
'hex.user:Hex user tasks'
'loadconfig:Loads and persists the given configuration'
'local:List local tasks' 'local:List local tasks'
'local.install:Install a task or an archive locally' 'local.hex:Install hex locally'
'local.rebar:Install rebar locally' 'local.rebar:Install rebar locally'
'local.uninstall:Uninstall local tasks or archives' 'new:Create a new Elixir project'
'local.hex:Install Hex locally'
'new:Creates a new Elixir project'
'run:Run the given file or expression' 'run:Run the given file or expression'
"test:Run a project's tests" "test:Run a project's tests"
'--help:Describe available tasks' '--help:Describe available tasks'
@ -34,7 +49,7 @@ __task_list ()
local expl local expl
declare -a tasks declare -a tasks
tasks=(archive clean compile deps deps.clean deps.compile deps.get deps.unlock deps.update do escriptize help local local.install local.rebar local.uninstall new run test) tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test)
_wanted tasks expl 'help' compadd $tasks _wanted tasks expl 'help' compadd $tasks
} }

View file

@ -138,23 +138,6 @@ function man-preview() {
man -t "$@" | open -f -a Preview man -t "$@" | open -f -a Preview
} }
function trash() {
local trash_dir="${HOME}/.Trash"
local temp_ifs="$IFS"
IFS=$'\n'
for item in "$@"; do
if [[ -e "$item" ]]; then
item_name="$(basename $item)"
if [[ -e "${trash_dir}/${item_name}" ]]; then
mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")"
else
mv -f "$item" "${trash_dir}/"
fi
fi
done
IFS=$temp_ifs
}
function vncviewer() { function vncviewer() {
open vnc://$@ open vnc://$@
} }

View file

@ -0,0 +1,16 @@
_paver_does_target_list_need_generating () {
[ ! -f .paver_targets ] && return 0;
[ pavement.py -nt .paver_targets ] && return 0;
return 1;
}
_paver () {
if [ -f pavement.py ]; then
if _paver_does_target_list_need_generating; then
paver --help 2>&1 |grep '-'|grep -v -e '--'|awk -F '-' '{print $1}'|tr -d ' ' > .paver_targets
fi
compadd `cat .paver_targets`
fi
}
compdef _paver paver

File diff suppressed because it is too large Load diff

View file

@ -59,7 +59,7 @@ alias rn='rake notes'
alias rr='rake routes' alias rr='rake routes'
# legacy stuff # legacy stuff
alias ss='thin --stats "/thin/stats" start' alias sstat='thin --stats "/thin/stats" start'
alias sg='ruby script/generate' alias sg='ruby script/generate'
alias sd='ruby script/destroy' alias sd='ruby script/destroy'
alias sp='ruby script/plugin' alias sp='ruby script/plugin'

View file

@ -1,4 +0,0 @@
echo "It looks like you have been using the 'rails3' plugin,"
echo "which has been deprecated in favor of a newly consolidated 'rails' plugin."
echo "You will want to modify your ~/.zshrc configuration to begin using it."
echo "Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240"

View file

@ -1,4 +0,0 @@
echo "It looks like you have been using the 'rails4' plugin,"
echo "which has been deprecated in favor of a newly consolidated 'rails' plugin."
echo "You will want to modify your ~/.zshrc configuration to begin using it."
echo "Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240"

View file

@ -14,4 +14,6 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li
* If `st` is passed a file, open it in Sublime Text * If `st` is passed a file, open it in Sublime Text
* if `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text * If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text
* If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.

View file

@ -5,6 +5,7 @@ if [[ $('uname') == 'Linux' ]]; then
_sublime_linux_paths=( _sublime_linux_paths=(
"$HOME/bin/sublime_text" "$HOME/bin/sublime_text"
"/opt/sublime_text/sublime_text" "/opt/sublime_text/sublime_text"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/sublime_text" "/usr/bin/sublime_text"
"/usr/local/bin/sublime_text" "/usr/local/bin/sublime_text"
"/usr/bin/subl" "/usr/bin/subl"
@ -33,7 +34,7 @@ elif [[ "$OSTYPE" = darwin* ]]; then
for _sublime_path in $_sublime_darwin_paths; do for _sublime_path in $_sublime_darwin_paths; do
if [[ -a $_sublime_path ]]; then if [[ -a $_sublime_path ]]; then
alias subl="'$_sublime_path'" subl () { "$_sublime_path" $* }
alias st=subl alias st=subl
break break
fi fi

106
plugins/tugboat/_tugboat Normal file
View file

@ -0,0 +1,106 @@
#compdef tugboat
#autoload
# Tugboat zsh autocompletion
local -a _commands
_commands=(
'add-key:[NAME] Upload an ssh public key.'
'authorize:Authorize a DigitalOcean account with tugboat.'
'create:[NAME] Create a droplet.'
'destroy:[FUZZY_NAME] Destroy a droplet.'
'destroy_image:[FUZZY_NAME] Destroy an image.'
'droplets:Retrieve a list of your droplets.'
'halt:[FUZZY_NAME] Shutdown a droplet.'
'help:[COMMAND] Describe commands or a specific command.'
'images:Retrieve a list of your images.'
'info:[FUZZY_NAME] [OPTIONS] Show a droplets information.'
'info_image:[FUZZY_NAME] [OPTIONS] Show an images information.'
'keys:Show available SSH keys.'
'password-reset:[FUZZY_NAME] Reset root password.'
'rebuild:[FUZZY_NAME] [IMAGE_NAME] Rebuild a droplet.'
'regions:Show regions.'
'resize:[FUZZY_NAME -s, --size=N] Resize a droplet.'
'restart:[FUZZY_NAME] Restart a droplet.'
'sizes:Show available droplet sizes.'
'snapshot:[SNAPSHOT_NAME] [FUZZY_NAME] [OPTIONS] Queue a snapshot of the droplet.'
'ssh:[FUZZY_NAME] SSH into a droplet.'
'start:[FUZZY_NAME] Start a droplet.'
'verify:Check your DigitalOcean credentials.'
'version:Show version.'
'wait:[FUZZY_NAME] Wait for a droplet to reach a state.'
)
local -a _create_arguments
_create_arguments=(
'-s:[--size=N] The size_id of the droplet'
'-i:[--image=N] The image_id of the droplet'
'-r:[--region=N] The region_id of the droplet'
'-k:[--keys=KEYS] A comma separated list of SSH key ids to add to the droplet'
'-p:[--private-networking] Enable private networking on the droplet'
'-b:[--backups-enabled] Enable backups on the droplet'
'-q:[--quiet]'
)
__task_list ()
{
local expl
declare -a tasks
arguments=(add-key authorize create destroy destroy_image droplets halt help images info info_image keys password-reset rebuild regions resize restart sizes snapshot ssh start verify version wait)
_wanted tasks expl 'help' compadd $arguments
}
__droplets_list ()
{
_wanted application expl 'command' compadd $(command tugboat droplets | cut -d " " -f1)
}
__tugboat-create ()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _create_arguments
return
;;
esac
}
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _commands
return
;;
(options)
case $line[1] in
(help)
_arguments ':feature:__task_list'
;;
(ssh)
_arguments ':feature:__droplets_list'
;;
(create)
_arguments ':feature:__tugboat-create'
;;
esac
;;
esac

75
plugins/vi-mode/README.md Normal file
View file

@ -0,0 +1,75 @@
vi-mode
=======
This plugin increase `vi-like` zsh functionality.
Use `ESC` or `CTRL-[` to enter `Normal mode`.
History
-------
- `ctrl-p` : Previous command in history
- `ctrl-n` : Next command in history
- `/` : Search backward in history
- `n` : Repeat the last `/`
Mode indicators
---------------
*Normal mode* is indicated with red `<<<` mark at the right prompt, when it
wasn't defined by theme.
Vim edition
-----------
- `v` : Edit current command line in Vim
Movement
--------
- `$` : To the end of the line
- `^` : To the first non-blank character of the line
- `0` : To the first character of the line
- `w` : [count] words forward
- `W` : [count] WORDS forward
- `e` : Forward to the end of word [count] inclusive
- `E` : Forward to the end of WORD [count] inclusive
- `b` : [count] words backward
- `B` : [count] WORDS backward
- `t{char}` : Till before [count]'th occurrence of {char} to the right
- `T{char}` : Till before [count]'th occurrence of {char} to the left
- `f{char}` : To [count]'th occurrence of {char} to the right
- `F{char}` : To [count]'th occurrence of {char} to the left
- `;` : Repeat latest f, t, F or T [count] times
- `,` : Repeat latest f, t, F or T in opposite direction
Insertion
---------
- `i` : Insert text before the cursor
- `I` : Insert text before the first character in the line
- `a` : Append text after the cursor
- `A` : Append text at the end of the line
- `o` : Insert new command line below the current one
- `O` : Insert new command line above the current one
Delete and Insert
-----------------
- `ctrl-h` : While in *Insert mode*: delete character after the cursor
- `ctrl-w` : While in *Insert mode*: delete word after the cursor
- `d{motion}` : Delete text that {motion} moves over
- `dd` : Delete line
- `D` : Delete characters under the cursor until the end of the line
- `c{motion}` : Delete {motion} text and start insert
- `cc` : Delete line and start insert
- `C` : Delete to the end of the line and start insert
- `r{char}` : Replace the character under the cursor with {char}
- `R` : Enter replace mode: Each character replaces existing one
- `x` : Delete [count] characters under and after the cursor
- `X` : Delete [count] characters before the cursor

View file

@ -1,10 +1,18 @@
virtualenvwrapper='virtualenvwrapper.sh' virtualenvwrapper='virtualenvwrapper.sh'
if (( $+commands[$virtualenvwrapper] )); then if (( $+commands[$virtualenvwrapper] )); then
function {
setopt local_options
unsetopt equals
source ${${virtualenvwrapper}:c} source ${${virtualenvwrapper}:c}
}
elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then elif [[ -f "/etc/bash_completion.d/virtualenvwrapper" ]]; then
function {
setopt local_options
unsetopt equals
virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper" virtualenvwrapper="/etc/bash_completion.d/virtualenvwrapper"
source "/etc/bash_completion.d/virtualenvwrapper" source "/etc/bash_completion.d/virtualenvwrapper"
}
else else
print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\ print "zsh virtualenvwrapper plugin: Cannot find ${virtualenvwrapper}.\n"\
"Please install with \`pip install virtualenvwrapper\`" >&2 "Please install with \`pip install virtualenvwrapper\`" >&2

View file

@ -11,6 +11,7 @@ function web_search() {
yahoo "https://search.yahoo.com/search?p=" yahoo "https://search.yahoo.com/search?p="
duckduckgo "https://www.duckduckgo.com/?q=" duckduckgo "https://www.duckduckgo.com/?q="
yandex "https://yandex.ru/yandsearch?text=" yandex "https://yandex.ru/yandsearch?text="
github "https://github.com/search?q="
) )
# define the open command # define the open command
@ -49,6 +50,7 @@ alias google='web_search google'
alias yahoo='web_search yahoo' alias yahoo='web_search yahoo'
alias ddg='web_search duckduckgo' alias ddg='web_search duckduckgo'
alias yandex='web_search yandex' alias yandex='web_search yandex'
alias github='web_search github'
#add your own !bang searches here #add your own !bang searches here
alias wiki='web_search duckduckgo \!w' alias wiki='web_search duckduckgo \!w'

View file

@ -19,8 +19,8 @@ alias zsr='zeus server'
alias zerver='zeus server' alias zerver='zeus server'
# Rake # Rake
alias zr='zeus rake' alias zr='noglob zeus rake'
alias zake='zeus rake' alias zake='noglob zeus rake'
# Generate # Generate
alias zg='zeus generate' alias zg='zeus generate'

View file

@ -42,7 +42,7 @@ GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN
GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} "
DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED} ${PR_RESET}" VCS_SUFIX_COLOR="${PR_RESET}${PR_RED} ${PR_RESET}"
# ########## COLOR ########### # ########## COLOR ###########
# ########## SVN ########### # ########## SVN ###########

View file

@ -126,7 +126,7 @@ prompt_hg() {
if `hg st | grep -q "^\?"`; then if `hg st | grep -q "^\?"`; then
prompt_segment red black prompt_segment red black
st='±' st='±'
elif `hg st | grep -q "^(M|A)"`; then elif `hg st | grep -q "^[MA]"`; then
prompt_segment yellow black prompt_segment yellow black
st='±' st='±'
else else

View file

@ -38,9 +38,8 @@ function _ruby_version() {
# Determine the time since last commit. If branch is clean, # Determine the time since last commit. If branch is clean,
# use a neutral color, otherwise colors will vary according to time. # use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() { function _git_time_since_commit() {
if git rev-parse --git-dir > /dev/null 2>&1; then
# Only proceed if there is actually a commit. # Only proceed if there is actually a commit.
if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then if git log -1 > /dev/null 2>&1; then
# Get the last commit. # Get the last commit.
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
now=$(date +%s) now=$(date +%s)
@ -66,7 +65,6 @@ function _git_time_since_commit() {
color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
echo "$color$commit_age%{$reset_color%}" echo "$color$commit_age%{$reset_color%}"
fi fi
fi
} }
if [[ $USER == "root" ]]; then if [[ $USER == "root" ]]; then
@ -99,4 +97,3 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}"
export LSCOLORS="exfxcxdxbxegedabagacad" export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export GREP_COLOR='1;33' export GREP_COLOR='1;33'

View file

@ -1,44 +1,74 @@
# reference colors # Michele Bologna's theme
GREEN="%{$fg_bold[green]%}" # http://michelebologna.net
RED="%{$fg_bold[red]%}" #
CYAN="%{$fg_bold[cyan]%}" # This a theme for oh-my-zsh. Features a colored prompt with:
YELLOW="%{$fg_bold[yellow]%}" # * username@host: [jobs] [git] workdir %
BLUE="%{$fg_bold[blue]%}" # * hostname color is based on hostname characters. When using as root, the
MAGENTA="%{$fg_bold[magenta]%}" # prompt shows only the hostname in red color.
WHITE="%{$fg_bold[white]%}" # * [jobs], if applicable, counts the number of suspended jobs tty
# * [git], if applicable, represents the status of your git repo (more on that
# later)
# * '%' prompt will be green if last command return value is 0, yellow otherwise.
#
# git prompt is inspired by official git contrib prompt:
# https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh
# and it adds:
# * the current branch
# * '%' if there are untracked files
# * '$' if there are stashed changes
# * '*' if there are modified files
# * '+' if there are added files
# * '<' if local repo is behind remote repo
# * '>' if local repo is ahead remote repo
# * '=' if local repo is equal to remote repo (in sync)
# * '<>' if local repo is diverged
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE) local green="%{$fg_bold[green]%}"
local red="%{$fg_bold[red]%}"
local cyan="%{$fg_bold[cyan]%}"
local yellow="%{$fg_bold[yellow]%}"
local blue="%{$fg_bold[blue]%}"
local magenta="%{$fg_bold[magenta]%}"
local white="%{$fg_bold[white]%}"
local reset="%{$reset_color%}"
# color reset local -a color_array
RESET_COLOR="%{$reset_color%}" color_array=($green $red $cyan $yellow $blue $magenta $white)
# which color should be applied? local username_normal_color=$white
USERNAME_NORMAL_COLOR=$WHITE local username_root_color=$red
USERNAME_ROOT_COLOR=$RED local hostname_root_color=$red
HOSTNAME_NORMAL_COLOR=$BLUE
# uncomment next line if you want auto-generated hostname color
#for i in $HOST; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
HOSTNAME_ROOT_COLOR=$RED
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
CURRENT_DIR_COLOR=$CYAN
# zsh commands # calculating hostname color with hostname characters
USERNAME_COMMAND="%n" for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
HOSTNAME_COMMAND="%m" local -a hostname_color
CURRENT_DIR="%~" hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
# output: colors + commands local current_dir_color=$blue
USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)" local username_command="%n"
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR" local hostname_command="%m"
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR" local current_dir="%~"
LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
# git theming local username_output="%(!..$username_normal_color$username_command$reset@)"
ZSH_THEME_GIT_PROMPT_PREFIX="(" local hostname_output="$hostname_color$hostname_command$reset"
local current_dir_output="$current_dir_color$current_dir$reset"
local jobs_bg="${red}fg: %j$reset"
local last_command_output="%(?.%(!.$red.$green).$yellow)"
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*" ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=")" ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_UNTRACKED="%%"
ZSH_THEME_GIT_PROMPT_MODIFIED="*"
ZSH_THEME_GIT_PROMPT_ADDED="+"
ZSH_THEME_GIT_PROMPT_STASHED="$"
ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE="="
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=">"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="<"
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="<>"
# wrap all together PROMPT='$username_output$hostname_output:$current_dir_output%1(j. [$jobs_bg].)'
PROMPT='$USERNAME_OUTPUT$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $LAST_COMMAND_OUTPUT%#$RESET_COLOR ' PROMPT+='$(__git_ps1)'
RPROMPT='%1(j.fg: [%j].) $GREEN$(git_prompt_info)$RESET_COLOR [%@]' PROMPT+=" $last_command_output%#$reset "
RPROMPT=''

25
themes/strug.zsh-theme Normal file
View file

@ -0,0 +1,25 @@
# terminal coloring
export CLICOLOR=1
export LSCOLORS=dxFxCxDxBxegedabagacad
local git_branch='$(git_prompt_info)%{$reset_color%}$(git_remote_status)'
PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %~ %{$reset_color%}${git_branch}
%{$fg[green]%}╰\$ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}on "
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}%{$fg[red]%} ✘ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED=true
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX="%{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX="%{$fg[yellow]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=" +"
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR=%{$fg[green]%}
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE=" -"
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR=%{$fg[red]%}

View file

@ -41,10 +41,9 @@ then
then then
_upgrade_zsh _upgrade_zsh
else else
echo "[Oh My Zsh] Would you like to check for updates?" echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c"
echo "Type Y to update oh-my-zsh: \c"
read line read line
if [ "$line" = Y ] || [ "$line" = y ]; then if [ "$line" = Y ] || [ "$line" = y ] || [ -z "$line" ]; then
_upgrade_zsh _upgrade_zsh
else else
_update_zsh_update _update_zsh_update