Skip to content

Commit c325eac

Browse files
committed
Merge remote-tracking branch 'upstream/master' into HEAD
Conflicts: lib/termsupport.zsh
2 parents cc3df1c + 357ab49 commit c325eac

File tree

136 files changed

+5089
-426
lines changed

Some content is hidden

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

136 files changed

+5089
-426
lines changed

README.textile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
!https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png!
2+
13
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...
24

35
bq. "OH MY ZSHELL!"
@@ -12,11 +14,11 @@ You can install this via the command line with either `curl` or `wget`.
1214

1315
h4. via `curl`
1416

15-
@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@
17+
@curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh@
1618

1719
h4. via `wget`
1820

19-
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
21+
@wget --no-check-certificate https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh@
2022

2123
h3. The manual way
2224

@@ -72,6 +74,8 @@ To disable updates entirely, put this in your ~/.zshrc
7274

7375
@DISABLE_AUTO_UPDATE=true@
7476

77+
To upgrade directly from the command line, just run @upgrade_oh_my_zsh@
78+
7579
h3. Uninstalling
7680

7781
If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config).

lib/aliases.zsh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,21 @@ alias please='sudo'
1313
#alias g='grep -in'
1414

1515
# Show history
16-
alias history='fc -l 1'
17-
16+
if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
17+
then
18+
alias history='fc -fl 1'
19+
elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
20+
then
21+
alias history='fc -El 1'
22+
elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
23+
then
24+
alias history='fc -il 1'
25+
else
26+
alias history='fc -l 1'
27+
fi
1828
# List direcory contents
1929
alias lsa='ls -lah'
20-
#alias l='ls -la'
30+
alias l='ls -la'
2131
alias ll='ls -l'
2232
alias la='ls -lA'
2333
alias sl=ls # often screw this up

lib/bzr.zsh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Bazaar integration
2+
## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
3+
function bzr_prompt_info() {
4+
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
5+
if [ -n "$BZR_CB" ]; then
6+
BZR_DIRTY=""
7+
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
8+
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
9+
fi
10+
}

lib/correction.zsh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
if [[ "$DISABLE_CORRECTION" == "true" ]]; then
2-
return
3-
else
1+
alias man='nocorrect man'
2+
alias mv='nocorrect mv'
3+
alias mysql='nocorrect mysql'
4+
alias mkdir='nocorrect mkdir'
5+
alias gist='nocorrect gist'
6+
alias heroku='nocorrect heroku'
7+
alias ebuild='nocorrect ebuild'
8+
alias hpodder='nocorrect hpodder'
9+
alias sudo='nocorrect sudo'
10+
11+
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
412
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'
1413
fi

lib/edit-command-line.zsh

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/functions.zsh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,61 @@ function take() {
1515
cd $1
1616
}
1717

18+
#
19+
# Get the value of an alias.
20+
#
21+
# Arguments:
22+
# 1. alias - The alias to get its value from
23+
# STDOUT:
24+
# The value of alias $1 (if it has one).
25+
# Return value:
26+
# 0 if the alias was found,
27+
# 1 if it does not exist
28+
#
29+
function alias_value() {
30+
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
31+
test $(alias "$1")
32+
}
33+
34+
#
35+
# Try to get the value of an alias,
36+
# otherwise return the input.
37+
#
38+
# Arguments:
39+
# 1. alias - The alias to get its value from
40+
# STDOUT:
41+
# The value of alias $1, or $1 if there is no alias $1.
42+
# Return value:
43+
# Always 0
44+
#
45+
function try_alias_value() {
46+
alias_value "$1" || echo "$1"
47+
}
48+
49+
#
50+
# Set variable "$1" to default value "$2" if "$1" is not yet defined.
51+
#
52+
# Arguments:
53+
# 1. name - The variable to set
54+
# 2. val - The default value
55+
# Return value:
56+
# 0 if the variable exists, 3 if it was set
57+
#
58+
function default() {
59+
test `typeset +m "$1"` && return 0
60+
typeset -g "$1"="$2" && return 3
61+
}
62+
63+
#
64+
# Set enviroment variable "$1" to default value "$2" if "$1" is not yet defined.
65+
#
66+
# Arguments:
67+
# 1. name - The env variable to set
68+
# 2. val - The default value
69+
# Return value:
70+
# 0 if the env variable exists, 3 if it was set
71+
#
72+
function env_default() {
73+
env | grep -q "^$1=" && return 0
74+
export "$1=$2" && return 3
75+
}

lib/git.zsh

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# get the name of the branch we are on
22
function git_prompt_info() {
3-
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
4-
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
5-
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
3+
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
4+
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
5+
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
6+
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
7+
fi
68
}
79

810

@@ -11,16 +13,16 @@ parse_git_dirty() {
1113
local SUBMODULE_SYNTAX=''
1214
local GIT_STATUS=''
1315
local CLEAN_MESSAGE='nothing to commit (working directory clean)'
14-
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
16+
if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then
1517
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
1618
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
1719
fi
18-
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
19-
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
20+
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
21+
GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
2022
else
21-
GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
23+
GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
2224
fi
23-
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null) ]]; then
25+
if [[ -n $GIT_STATUS ]]; then
2426
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
2527
else
2628
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
@@ -32,10 +34,10 @@ parse_git_dirty() {
3234

3335
# get the difference between the local and remote branches
3436
git_remote_status() {
35-
remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
37+
remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
3638
if [[ -n ${remote} ]] ; then
37-
ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
38-
behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
39+
ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
40+
behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
3941

4042
if [ $ahead -eq 0 ] && [ $behind -gt 0 ]
4143
then
@@ -52,24 +54,24 @@ git_remote_status() {
5254

5355
# Checks if there are commits ahead from remote
5456
function git_prompt_ahead() {
55-
if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
57+
if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
5658
echo "$ZSH_THEME_GIT_PROMPT_AHEAD"
5759
fi
5860
}
5961

6062
# Formats prompt string for current git commit short SHA
6163
function git_prompt_short_sha() {
62-
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
64+
SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
6365
}
6466

6567
# Formats prompt string for current git commit long SHA
6668
function git_prompt_long_sha() {
67-
SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
69+
SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
6870
}
6971

7072
# Get the status of the working tree
7173
git_prompt_status() {
72-
INDEX=$(git status --porcelain -b 2> /dev/null)
74+
INDEX=$(command git status --porcelain -b 2> /dev/null)
7375
STATUS=""
7476
if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
7577
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
@@ -96,7 +98,7 @@ git_prompt_status() {
9698
elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then
9799
STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
98100
fi
99-
if $(git rev-parse --verify refs/stash >/dev/null 2>&1); then
101+
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
100102
STATUS="$ZSH_THEME_GIT_PROMPT_STASHED$STATUS"
101103
fi
102104
if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
@@ -121,7 +123,7 @@ function git_compare_version() {
121123
local INPUT_GIT_VERSION=$1;
122124
local INSTALLED_GIT_VERSION
123125
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
124-
INSTALLED_GIT_VERSION=($(git --version 2>/dev/null));
126+
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null));
125127
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
126128

127129
for i in {1..3}; do

lib/key-bindings.zsh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ bindkey "^[[3~" delete-char
3030
bindkey "^[3;5~" delete-char
3131
bindkey "\e[3~" delete-char
3232

33+
# Edit the current command line in $EDITOR
34+
autoload -U edit-command-line
35+
zle -N edit-command-line
36+
bindkey '\C-x\C-e' edit-command-line
37+
3338
# consider emacs keybindings:
3439

3540
#bindkey -e ## emacs key bindings

lib/nvm.zsh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# get the node.js version
2+
function nvm_prompt_info() {
3+
[ -f $HOME/.nvm/nvm.sh ] || return
4+
local nvm_prompt
5+
nvm_prompt=$(node -v 2>/dev/null)
6+
[[ "${nvm_prompt}x" == "x" ]] && return
7+
nvm_prompt=${nvm_prompt:1}
8+
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
9+
}

lib/spectrum.zsh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ function spectrum_ls() {
2626
done
2727
}
2828

29+
# Show all 256 colors where the background is set to specific color
30+
function spectrum_bls() {
31+
for code in {000..255}; do
32+
((cc = code + 1))
33+
print -P -- "$BG[$code]$code: Test %{$reset_color%}"
34+
done
35+
}

lib/termsupport.zsh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ function omz_termsupport_preexec {
2929
emulate -L zsh
3030
setopt extended_glob
3131
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
32-
title "$CMD" "%n@%m: %100>...>${2:gs/%/%%}%<<"
32+
local LINE="${2:gs/$/\\$}"
33+
LINE="${LINE:gs/%/%%}"
34+
title "$CMD" "%n@%m: %100>...>$LINE%<<"
3335
}
3436

3537
autoload -U add-zsh-hook

lib/theme-and-appearance.zsh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ then
1111
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
1212
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
1313
gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
14+
elif [[ "$(uname -s)" == "OpenBSD" ]]; then
15+
# On OpenBSD, test if "colorls" is installed (this one supports colors);
16+
# otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
17+
colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
1418
else
1519
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
1620
fi

oh-my-zsh.sh

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Check for updates on initial load...
2-
if [ "$DISABLE_AUTO_UPDATE" != "true" ]
3-
then
2+
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
43
/usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh
54
fi
65

@@ -38,10 +37,20 @@ for plugin ($plugins); do
3837
fi
3938
done
4039

40+
# Figure out the SHORT hostname
41+
if [ -n "$commands[scutil]" ]; then
42+
# OS X
43+
SHORT_HOST=$(scutil --get ComputerName)
44+
else
45+
SHORT_HOST=${HOST/.*/}
46+
fi
47+
48+
# Save the location of the current completion dump file.
49+
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
50+
4151
# Load and run compinit
4252
autoload -U compinit
43-
compinit -i
44-
53+
compinit -i -d "${ZSH_COMPDUMP}"
4554

4655
# Load all of the plugins that were defined in ~/.zshrc
4756
for plugin ($plugins); do
@@ -59,22 +68,18 @@ done
5968
unset config_file
6069

6170
# Load the theme
62-
if [ "$ZSH_THEME" = "random" ]
63-
then
71+
if [ "$ZSH_THEME" = "random" ]; then
6472
themes=($ZSH/themes/*zsh-theme)
6573
N=${#themes[@]}
6674
((N=(RANDOM%N)+1))
6775
RANDOM_THEME=${themes[$N]}
6876
source "$RANDOM_THEME"
6977
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
7078
else
71-
if [ ! "$ZSH_THEME" = "" ]
72-
then
73-
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]
74-
then
79+
if [ ! "$ZSH_THEME" = "" ]; then
80+
if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then
7581
source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme"
76-
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]
77-
then
82+
elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then
7883
source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme"
7984
else
8085
source "$ZSH/themes/$ZSH_THEME.zsh-theme"

plugins/autojump/autojump.plugin.zsh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ if [ $commands[autojump] ]; then # check if autojump is installed
33
. /usr/share/autojump/autojump.zsh
44
elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
55
. /etc/profile.d/autojump.zsh
6+
elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation
7+
. /etc/profile.d/autojump.sh
8+
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
9+
. /usr/local/share/autojump/autojump.zsh
610
elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
711
. $HOME/.autojump/etc/profile.d/autojump.zsh
812
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports

0 commit comments

Comments
 (0)