Skip to content

Commit b185fab

Browse files
committed
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
Conflicts: lib/termsupport.zsh
2 parents 18f3e76 + b6ea876 commit b185fab

File tree

88 files changed

+2389
-295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2389
-295
lines changed

README.textile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
A handful of functions, auto-complete helpers, and stuff that makes you shout...
2-
1+
oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout...
32

43
bq. "OH MY ZSHELL!"
54

@@ -63,6 +62,15 @@ If you want to override any of the default behavior, just add a new file (ending
6362
If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin.
6463
If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@.
6564

65+
h3. Updates
66+
67+
By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc
68+
69+
@DISABLE_UPDATE_PROMPT=true@
70+
71+
To disable updates entirely, put this in your ~/.zshrc
72+
73+
@DISABLE_AUTO_UPDATE=true@
6674

6775
h3. Uninstalling
6876

@@ -76,9 +84,7 @@ h3. (Don't) Send us your theme! (for now)
7684

7785
-I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
7886

79-
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
80-
81-
87+
We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
8288

8389
h2. Contributors
8490

lib/aliases.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ alias history='fc -l 1'
1717

1818
# List direcory contents
1919
alias lsa='ls -lah'
20-
alias l='ls -lA1'
20+
#alias l='ls -la'
2121
alias ll='ls -l'
2222
alias la='ls -lA'
2323
alias sl=ls # often screw this up

lib/completion.zsh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,18 @@ cdpath=(.)
3434
# use /etc/hosts and known_hosts for hostname completion
3535
[ -r /etc/ssh/ssh_known_hosts ] && _global_ssh_hosts=(${${${${(f)"$(</etc/ssh/ssh_known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _global_ssh_hosts=()
3636
[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
37+
[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=()
3738
[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
3839
hosts=(
40+
"$_ssh_config[@]"
3941
"$_global_ssh_hosts[@]"
4042
"$_ssh_hosts[@]"
4143
"$_etc_hosts[@]"
4244
"$HOST"
4345
localhost
4446
)
4547
zstyle ':completion:*:hosts' hosts $hosts
48+
zstyle ':completion:*' users off
4649

4750
# Use caching so that commands like apt and dpkg complete are useable
4851
zstyle ':completion::complete:*' use-cache 1

lib/correction.zsh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
1-
# correct commands, but not any arguments (correct_all would do that)
2-
setopt correct
1+
if [[ "$DISABLE_CORRECTION" == "true" ]]; then
2+
return
3+
else
4+
setopt correct_all
5+
alias man='nocorrect man'
6+
alias mv='nocorrect mv'
7+
alias mysql='nocorrect mysql'
8+
alias mkdir='nocorrect mkdir'
9+
alias gist='nocorrect gist'
10+
alias heroku='nocorrect heroku'
11+
alias ebuild='nocorrect ebuild'
12+
alias hpodder='nocorrect hpodder'
13+
alias sudo='nocorrect sudo'
14+
fi

lib/directories.zsh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
setopt auto_name_dirs
33
setopt auto_pushd
44
setopt pushd_ignore_dups
5+
setopt pushdminus
56

67
alias ..='cd ..'
78
alias cd..='cd ..'
@@ -11,14 +12,14 @@ alias cd.....='cd ../../../..'
1112
alias cd/='cd /'
1213

1314
alias 1='cd -'
14-
alias 2='cd +2'
15-
alias 3='cd +3'
16-
alias 4='cd +4'
17-
alias 5='cd +5'
18-
alias 6='cd +6'
19-
alias 7='cd +7'
20-
alias 8='cd +8'
21-
alias 9='cd +9'
15+
alias 2='cd -2'
16+
alias 3='cd -3'
17+
alias 4='cd -4'
18+
alias 5='cd -5'
19+
alias 6='cd -6'
20+
alias 7='cd -7'
21+
alias 8='cd -8'
22+
alias 9='cd -9'
2223

2324
cd () {
2425
if [[ "x$*" == "x..." ]]; then
@@ -29,6 +30,9 @@ cd () {
2930
cd ../../../..
3031
elif [[ "x$*" == "x......" ]]; then
3132
cd ../../../../..
33+
elif [ -d ~/.autoenv ]; then
34+
source ~/.autoenv/activate.sh
35+
autoenv_cd "$@"
3236
else
3337
builtin cd "$@"
3438
fi

lib/git.zsh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,24 @@ function git_prompt_info() {
99
# Checks if working tree is dirty
1010
parse_git_dirty() {
1111
local SUBMODULE_SYNTAX=''
12+
local GIT_STATUS=''
13+
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
1214
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
1315
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
1416
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
1517
fi
16-
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
18+
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
19+
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
20+
else
21+
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
22+
fi
23+
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null) ]]; then
1724
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
1825
else
1926
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
2027
fi
28+
else
29+
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
2130
fi
2231
}
2332

@@ -62,7 +71,7 @@ function git_prompt_long_sha() {
6271
git_prompt_status() {
6372
INDEX=$(git status --porcelain -b 2> /dev/null)
6473
STATUS=""
65-
if $(echo "$INDEX" | grep '^\?\? ' &> /dev/null); then
74+
if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
6675
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
6776
fi
6877
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then

lib/rbenv.zsh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# using the rbenv plugin will override this with a real implementation
2+
function rbenv_prompt_info() {}

lib/termsupport.zsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function title {
99
setopt +o promptsubst
1010
if [[ "$TERM" == screen* ]]; then
1111
print -Pn "\ek$2:q\e\\" #set screen hardstatus, usually truncated at 20 chars
12-
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
12+
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
1313
print -Pn "\e]2;$2:q\a" #set window name
1414
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
1515
fi

lib/theme-and-appearance.zsh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
77
if [ "$DISABLE_LS_COLORS" != "true" ]
88
then
99
# Find the option for using colors in ls, depending on the version: Linux or BSD
10-
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
10+
if [[ "$(uname -s)" == "NetBSD" ]]; then
11+
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
12+
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
13+
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
14+
else
15+
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
16+
fi
1117
fi
1218

1319
#setopt no_beep

oh-my-zsh.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Check for updates on initial load...
22
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
33
then
4-
/usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh
4+
/usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
55
fi
66

77
# Initializes Oh My Zsh
@@ -73,6 +73,9 @@ else
7373
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
7474
then
7575
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
76+
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]
77+
then
78+
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
7679
else
7780
source "$ZSH/themes/$ZSH_THEME.zsh-theme"
7881
fi

plugins/ant/ant.plugin.zsh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
stat -f%m . > /dev/null 2>&1
2-
if [ "$?" = 0 ]; then
3-
stat_cmd=(stat -f%m)
4-
else
5-
stat_cmd=(stat -L --format=%Y)
6-
fi
7-
81
_ant_does_target_list_need_generating () {
9-
if [ ! -f .ant_targets ]; then return 0;
10-
else
11-
accurate=$($stat_cmd .ant_targets)
12-
changed=$($stat_cmd build.xml)
13-
return $(expr $accurate '>=' $changed)
14-
fi
2+
[ ! -f .ant_targets ] && return 0;
3+
[ .ant_targets -nt build.xml ] && return 0;
4+
return 1;
155
}
166

177
_ant () {

plugins/archlinux/archlinux.plugin.zsh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [[ -x `which yaourt` ]]; then
88
}
99
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
1010
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
11-
alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
11+
alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system.
1212
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
1313
alias yain='yaourt -S' # Install specific package(s) from the repositories
1414
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
@@ -18,6 +18,8 @@ if [[ -x `which yaourt` ]]; then
1818
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
1919
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
2020
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
21+
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
22+
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
2123
# Additional yaourt alias examples
2224
if [[ -x `which abs` ]]; then
2325
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories

plugins/autoenv/autoenv.plugin.zsh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The use_env call below is a reusable command to activate/create a new Python
2+
# virtualenv, requiring only a single declarative line of code in your .env files.
3+
# It only performs an action if the requested virtualenv is not the current one.
4+
use_env() {
5+
typeset venv
6+
venv="$1"
7+
if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then
8+
if workon | grep -q "$venv"; then
9+
workon "$venv"
10+
else
11+
echo -n "Create virtualenv $venv now? (Yn) "
12+
read answer
13+
if [[ "$answer" == "Y" ]]; then
14+
mkvirtualenv "$venv"
15+
fi
16+
fi
17+
fi
18+
}

plugins/battery/battery.plugin.zsh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@
1010

1111
if [[ $(uname) == "Darwin" ]] ; then
1212

13+
function battery_pct() {
14+
typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
15+
typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
16+
integer i=$(((currentcapacity/maxcapacity) * 100))
17+
echo $i
18+
}
19+
1320
function battery_pct_remaining() {
1421
if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
15-
typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
16-
typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
17-
integer i=$(((currentcapacity/maxcapacity) * 100))
18-
echo $i
22+
battery_pct
1923
else
2024
echo "External Power"
2125
fi
@@ -42,17 +46,27 @@ if [[ $(uname) == "Darwin" ]] ; then
4246
fi
4347
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
4448
else
45-
echo ""
49+
echo ""
4650
fi
4751
}
4852

4953
elif [[ $(uname) == "Linux" ]] ; then
5054

51-
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
52-
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
53-
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
54-
function battery_pct_prompt() {
55-
b=$(battery_pct_remaining)
55+
function battery_pct_remaining() {
56+
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
57+
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
58+
fi
59+
}
60+
61+
function battery_time_remaining() {
62+
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
63+
echo $(acpi | cut -f3 -d ',')
64+
fi
65+
}
66+
67+
function battery_pct_prompt() {
68+
b=$(battery_pct_remaining)
69+
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
5670
if [ $b -gt 50 ] ; then
5771
color='green'
5872
elif [ $b -gt 20 ] ; then
@@ -61,11 +75,8 @@ elif [[ $(uname) == "Linux" ]] ; then
6175
color='red'
6276
fi
6377
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
64-
}
65-
else
66-
error_msg='no battery'
67-
function battery_pct_remaining() { echo $error_msg }
68-
function battery_time_remaining() { echo $error_msg }
69-
function battery_pct_prompt() { echo '' }
70-
fi
78+
else
79+
echo ""
80+
fi
81+
}
7182
fi

plugins/bower/_bower

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
3+
# Credits to npm's awesome completion utility.
4+
#
5+
# Bower completion script, based on npm completion script.
6+
7+
###-begin-bower-completion-###
8+
#
9+
# Installation: bower completion >> ~/.bashrc (or ~/.zshrc)
10+
# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower
11+
#
12+
13+
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
14+
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
15+
export COMP_WORDBREAKS
16+
17+
if type complete &>/dev/null; then
18+
_bower_completion () {
19+
local si="$IFS"
20+
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
21+
COMP_LINE="$COMP_LINE" \
22+
COMP_POINT="$COMP_POINT" \
23+
bower completion -- "${COMP_WORDS[@]}" \
24+
2>/dev/null)) || return $?
25+
IFS="$si"
26+
}
27+
complete -F _bower_completion bower
28+
elif type compdef &>/dev/null; then
29+
_bower_completion() {
30+
si=$IFS
31+
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
32+
COMP_LINE=$BUFFER \
33+
COMP_POINT=0 \
34+
bower completion -- "${words[@]}" \
35+
2>/dev/null)
36+
IFS=$si
37+
}
38+
compdef _bower_completion bower
39+
elif type compctl &>/dev/null; then
40+
_bower_completion () {
41+
local cword line point words si
42+
read -Ac words
43+
read -cn cword
44+
let cword-=1
45+
read -l line
46+
read -ln point
47+
si="$IFS"
48+
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
49+
COMP_LINE="$line" \
50+
COMP_POINT="$point" \
51+
bower completion -- "${words[@]}" \
52+
2>/dev/null)) || return $?
53+
IFS="$si"
54+
}
55+
compctl -K _bower_completion bower
56+
fi
57+
###-end-bower-completion-###
58+

0 commit comments

Comments
 (0)