summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/git.zsh2
-rw-r--r--lib/grep.zsh34
-rw-r--r--lib/history.zsh10
-rw-r--r--oh-my-zsh.sh14
-rw-r--r--plugins/mercurial/mercurial.plugin.zsh2
-rw-r--r--plugins/svn-fast-info/svn-fast-info.plugin.zsh12
-rw-r--r--plugins/svn/svn.plugin.zsh4
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh4
-rw-r--r--themes/agnoster.zsh-theme4
-rw-r--r--themes/bureau.zsh-theme2
-rw-r--r--themes/mortalscumbag.zsh-theme6
11 files changed, 50 insertions, 44 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index 748520a6f..118841f06 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -78,7 +78,7 @@ function git_prompt_long_sha() {
git_prompt_status() {
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS=""
- if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then
+ if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
fi
if $(echo "$INDEX" | grep '^A ' &> /dev/null); then
diff --git a/lib/grep.zsh b/lib/grep.zsh
index 276fec382..348ebe623 100644
--- a/lib/grep.zsh
+++ b/lib/grep.zsh
@@ -1,24 +1,24 @@
-#
-# Color grep results
-# Examples: http://rubyurl.com/ZXv
-#
-
-GREP_OPTIONS="--color=auto"
-
-# avoid VCS folders (if the necessary grep flags are available)
+# is x grep argument available?
grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
+
+# color grep results
+GREP_OPTIONS="--color=auto"
+
+# ignore VCS folders (if the necessary grep flags are available)
+VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
+
if grep-flag-available --exclude-dir=.cvs; then
- for PATTERN in .cvs .git .hg .svn; do
- GREP_OPTIONS+=" --exclude-dir=$PATTERN"
- done
+ GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
elif grep-flag-available --exclude=.cvs; then
- for PATTERN in .cvs .git .hg .svn; do
- GREP_OPTIONS+=" --exclude=$PATTERN"
- done
+ GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
fi
-unfunction grep-flag-available
-export GREP_OPTIONS="$GREP_OPTIONS"
-export GREP_COLOR='1;32'
+# export grep settings
+alias grep="grep $GREP_OPTIONS"
+
+# clean up
+unset GREP_OPTIONS
+unset VCS_FOLDERS
+unfunction grep-flag-available
diff --git a/lib/history.zsh b/lib/history.zsh
index 1d83e56e3..179c22848 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -1,9 +1,13 @@
## Command history configuration
-if [ -z $HISTFILE ]; then
+if [ -z "$HISTFILE" ]; then
HISTFILE=$HOME/.zsh_history
fi
-HISTSIZE=10000
-SAVEHIST=10000
+if [ -z "$HISTSIZE" ]; then
+ HISTSIZE=10000
+fi
+if [ -z "$SAVEHIST" ]; then
+ SAVEHIST=10000
+fi
setopt extended_history
setopt hist_expire_dups_first
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index d0e89f31b..d75b521c7 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -8,18 +8,20 @@ fi
# add a function path
fpath=($ZSH/functions $ZSH/completions $fpath)
-# Load all of the config files in ~/oh-my-zsh that end in .zsh
-# TIP: Add files you don't want in git to .gitignore
-for config_file ($ZSH/lib/*.zsh); do
- source $config_file
-done
-
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi
+# Load all of the config files in ~/oh-my-zsh that end in .zsh
+# TIP: Add files you don't want in git to .gitignore
+for config_file ($ZSH/lib/*.zsh); do
+ custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}"
+ [ -f "${custom_config_file}" ] && config_file=${custom_config_file}
+ source $config_file
+done
+
is_plugin() {
local base_dir=$1
diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh
index ff95d5e40..ed4d23713 100644
--- a/plugins/mercurial/mercurial.plugin.zsh
+++ b/plugins/mercurial/mercurial.plugin.zsh
@@ -42,7 +42,7 @@ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SU
function hg_dirty_choose {
if [ $(in_hg) ]; then
- hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'
+ hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'
if [ $pipestatus[-1] -eq 0 ]; then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
index ea19bcea0..9ea7f641d 100644
--- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh
+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -63,11 +63,11 @@ function svn_current_revision() {
function svn_status_info() {
local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
local svn_status="$(svn status 2> /dev/null)";
- if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
- if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
- if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
- if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
- if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
- if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
+ if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
+ if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
+ if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
+ if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
+ if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
+ if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
echo $svn_status_string
}
diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
index ba281d790..9f7a4c6eb 100644
--- a/plugins/svn/svn.plugin.zsh
+++ b/plugins/svn/svn.plugin.zsh
@@ -61,7 +61,7 @@ function svn_get_rev_nr() {
function svn_dirty_choose() {
if in_svn; then
root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'`
- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
@@ -78,7 +78,7 @@ function svn_dirty() {
function svn_dirty_choose_pwd () {
if in_svn; then
root=$PWD
- if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
+ if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo $1
else
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index 8df22e9ad..7a19cbdd3 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -5,7 +5,7 @@ _symfony_console () {
}
_symfony2_get_command_list () {
- `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }'
+ `_symfony_console` --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[a-z]+/ { print $1 }'
}
_symfony2 () {
@@ -23,4 +23,4 @@ alias sfcl='sf cache:clear'
alias sfcw='sf cache:warmup'
alias sfroute='sf router:debug'
alias sfcontainer='sf container:debug'
-alias sfgb='sf generate:bundle' \ No newline at end of file
+alias sfgb='sf generate:bundle'
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 7a62bd860..8c7be6e01 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -123,10 +123,10 @@ prompt_hg() {
st=""
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
branch=$(hg id -b 2>/dev/null)
- if `hg st | grep -Eq "^\?"`; then
+ if `hg st | grep -q "^\?"`; then
prompt_segment red black
st='±'
- elif `hg st | grep -Eq "^(M|A)"`; then
+ elif `hg st | grep -q "^(M|A)"`; then
prompt_segment yellow black
st='±'
else
diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme
index 443d1d5ee..148abec10 100644
--- a/themes/bureau.zsh-theme
+++ b/themes/bureau.zsh-theme
@@ -31,7 +31,7 @@ bureau_git_status () {
if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
- if $(echo "$_INDEX" | grep -E '^\?\? ' &> /dev/null); then
+ if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then
_STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED"
fi
if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then
diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme
index 5dbf2e4f6..ccce4197a 100644
--- a/themes/mortalscumbag.zsh-theme
+++ b/themes/mortalscumbag.zsh-theme
@@ -10,12 +10,12 @@ function my_git_prompt() {
fi
# is anything staged?
- if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
+ if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED"
fi
# is anything unstaged?
- if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then
+ if $(echo "$INDEX" | command grep -E -e '^[ MARC][MD] ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED"
fi
@@ -25,7 +25,7 @@ function my_git_prompt() {
fi
# is anything unmerged?
- if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
+ if $(echo "$INDEX" | command grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED"
fi