From 00ec11d3c0a2b2b7413ad84940ddec299aafbb04 Mon Sep 17 00:00:00 2001 From: DanielFGray Date: Sun, 16 Nov 2014 02:47:35 -0600 Subject: ignore any grep aliases that might be defined --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index aba095422..913a642b3 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 -- cgit v1.2.3-70-g09d2 From 1ebc98b9ede5ad5084b3e504e4fc8c01cb93be71 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 30 Nov 2014 17:37:47 -0800 Subject: Don't clobber HISTSIZE or SAVEHIST if they're already set --- lib/history.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 1d83e56e3..12dbcf4ee 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 -- cgit v1.2.3-70-g09d2 From 5bf715787a4483cafd70461417cb9a1bf8d1509f Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 30 Nov 2014 17:39:21 -0800 Subject: Existing code indents with spaces, not tabs, conform. --- lib/history.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 12dbcf4ee..179c22848 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -3,10 +3,10 @@ if [ -z "$HISTFILE" ]; then HISTFILE=$HOME/.zsh_history fi if [ -z "$HISTSIZE" ]; then - HISTSIZE=10000 + HISTSIZE=10000 fi if [ -z "$SAVEHIST" ]; then - SAVEHIST=10000 + SAVEHIST=10000 fi setopt extended_history -- cgit v1.2.3-70-g09d2 From 0bd3c9996fa58494fbefaad483abbe60ed332889 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:13:27 +0100 Subject: Extract VCS folders definition to avoid repetition --- lib/grep.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 276fec382..ad38ec6fc 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -6,18 +6,17 @@ GREP_OPTIONS="--color=auto" # avoid VCS folders (if the necessary grep flags are available) +VCS_FOLDERS="{.cvs,.git,.hg,.svn}" + grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 } 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 +unset VCS_FOLDERS unfunction grep-flag-available export GREP_OPTIONS="$GREP_OPTIONS" -- cgit v1.2.3-70-g09d2 From cf586b54b8aacd7fad7afc74d4f395da56e828b6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:14:23 +0100 Subject: Ignore .bzr folders in grep too --- lib/grep.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index ad38ec6fc..4a44113e1 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -6,7 +6,7 @@ GREP_OPTIONS="--color=auto" # avoid VCS folders (if the necessary grep flags are available) -VCS_FOLDERS="{.cvs,.git,.hg,.svn}" +VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 -- cgit v1.2.3-70-g09d2 From 0190eb084bfb39bfa5920f85c2fc33730236217c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:18:11 +0100 Subject: Use unaliased grep in flag check --- lib/grep.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 4a44113e1..06751db1a 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -9,7 +9,7 @@ GREP_OPTIONS="--color=auto" VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" grep-flag-available() { - echo | grep $1 "" >/dev/null 2>&1 + echo | command grep $1 "" >/dev/null 2>&1 } if grep-flag-available --exclude-dir=.cvs; then GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" -- cgit v1.2.3-70-g09d2 From 711843153d6e53a89d37931217f59c4f6a3a35db Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:36:57 +0100 Subject: Tidy up the grep.zsh library --- lib/grep.zsh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 06751db1a..4e55464c5 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,23 +1,24 @@ -# -# Color grep results -# Examples: http://rubyurl.com/ZXv -# +# is x grep argument available? +grep-flag-available() { + echo | grep $1 "" >/dev/null 2>&1 +} +# color grep results GREP_OPTIONS="--color=auto" -# avoid VCS folders (if the necessary grep flags are available) +# ignore VCS folders (if the necessary grep flags are available) VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" -grep-flag-available() { - echo | command grep $1 "" >/dev/null 2>&1 -} if grep-flag-available --exclude-dir=.cvs; then GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" elif grep-flag-available --exclude=.cvs; then GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" fi -unset VCS_FOLDERS -unfunction grep-flag-available +# export grep settings export GREP_OPTIONS="$GREP_OPTIONS" export GREP_COLOR='1;32' + +# clean up +unset VCS_FOLDERS +unfunction grep-flag-available -- cgit v1.2.3-70-g09d2 From dd270878053a73600382de1c3592c04d985e5e08 Mon Sep 17 00:00:00 2001 From: Ondřej Súkup Date: Mon, 24 Nov 2014 13:08:39 +0100 Subject: Change to alias and remove deprecated GREP_COLOR --- lib/grep.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 4e55464c5..348ebe623 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -16,9 +16,9 @@ elif grep-flag-available --exclude=.cvs; then fi # export grep settings -export GREP_OPTIONS="$GREP_OPTIONS" -export GREP_COLOR='1;32' +alias grep="grep $GREP_OPTIONS" # clean up +unset GREP_OPTIONS unset VCS_FOLDERS unfunction grep-flag-available -- cgit v1.2.3-70-g09d2 From 1978a0923c864cacdc520adff83ed63f62c91073 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 15 Dec 2014 08:11:04 -0800 Subject: Revert PR #3359 as this is breaking stuff for many folks. Need to rethink how we handle system defaults differently on this --- lib/history.zsh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 179c22848..e78a98e9e 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -2,12 +2,9 @@ if [ -z "$HISTFILE" ]; then HISTFILE=$HOME/.zsh_history fi -if [ -z "$HISTSIZE" ]; then - HISTSIZE=10000 -fi -if [ -z "$SAVEHIST" ]; then - SAVEHIST=10000 -fi + +HISTSIZE=10000 +SAVEHIST=10000 setopt extended_history setopt hist_expire_dups_first -- cgit v1.2.3-70-g09d2 From 16d07683058719811a7871cbf7bed066ac8fc784 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 14 Dec 2014 21:10:48 -0800 Subject: Quote path in case $HOME has a space in it. I've seen stranger things on OS X, unfortunately. This reverts commit 1f5cecee4768be192e439a72a873a6cfe8720927. --- lib/nvm.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/nvm.zsh b/lib/nvm.zsh index 5cadf7061..61d997fc0 100644 --- a/lib/nvm.zsh +++ b/lib/nvm.zsh @@ -1,6 +1,6 @@ # get the node.js version function nvm_prompt_info() { - [ -f $HOME/.nvm/nvm.sh ] || return + [ -f "$HOME/.nvm/nvm.sh" ] || return local nvm_prompt nvm_prompt=$(node -v 2>/dev/null) [[ "${nvm_prompt}x" == "x" ]] && return -- cgit v1.2.3-70-g09d2