summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/functions.zsh2
-rw-r--r--lib/grep.zsh23
-rw-r--r--plugins/docker/_docker2
-rw-r--r--plugins/git-prompt/gitstatus.py2
-rw-r--r--plugins/history-substring-search/history-substring-search.zsh9
-rw-r--r--plugins/osx/osx.plugin.zsh2
-rwxr-xr-xtools/install.sh2
7 files changed, 29 insertions, 13 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index aaf8a03e3..fda84a953 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -1,5 +1,5 @@
function zsh_stats() {
- history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
+ fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
}
function uninstall_oh_my_zsh() {
diff --git a/lib/grep.zsh b/lib/grep.zsh
index 977435ee4..276fec382 100644
--- a/lib/grep.zsh
+++ b/lib/grep.zsh
@@ -3,11 +3,22 @@
# Examples: http://rubyurl.com/ZXv
#
-# avoid VCS folders
-GREP_OPTIONS=
-for PATTERN in .cvs .git .hg .svn; do
- GREP_OPTIONS+="--exclude-dir=$PATTERN "
-done
-GREP_OPTIONS+="--color=auto"
+GREP_OPTIONS="--color=auto"
+
+# avoid VCS folders (if the necessary grep flags are available)
+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
+elif grep-flag-available --exclude=.cvs; then
+ for PATTERN in .cvs .git .hg .svn; do
+ GREP_OPTIONS+=" --exclude=$PATTERN"
+ done
+fi
+unfunction grep-flag-available
+
export GREP_OPTIONS="$GREP_OPTIONS"
export GREP_COLOR='1;32'
diff --git a/plugins/docker/_docker b/plugins/docker/_docker
index 5acd19edf..c291037a3 100644
--- a/plugins/docker/_docker
+++ b/plugins/docker/_docker
@@ -166,7 +166,7 @@ __rm() {
__rmi() {
_arguments \
- '(-f,--force=)'{-f,--force=}'[Force]' \
+ '(-f,--force=)'{-f,--force=}'[Force]'
__docker_images
}
diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
index ef894bff2..256841432 100644
--- a/plugins/git-prompt/gitstatus.py
+++ b/plugins/git-prompt/gitstatus.py
@@ -16,7 +16,7 @@ symbols = {
}
output, error = Popen(
- ['git', 'status'], stdout=PIPE, stderr=PIPE).communicate()
+ ['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
if error:
import sys
diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh
index 53f707c79..22f03dd6d 100644
--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -163,8 +163,13 @@ function history-substring-search-down() {
zle -N history-substring-search-up
zle -N history-substring-search-down
-bindkey '\e[A' history-substring-search-up
-bindkey '\e[B' history-substring-search-down
+zmodload zsh/terminfo
+if [[ -n "$terminfo[kcuu1]" ]]; then
+ bindkey "$terminfo[kcuu1]" history-substring-search-up
+fi
+if [[ -n "$terminfo[kcud1]" ]]; then
+ bindkey "$terminfo[kcud1]" history-substring-search-down
+fi
#-----------------------------------------------------------------------------
# implementation details
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 608ec3789..63760b5ff 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -184,7 +184,7 @@ function itunes() {
return 0
;;
*)
- print "Unkonwn option: $opt"
+ print "Unknown option: $opt"
return 1
;;
esac
diff --git a/tools/install.sh b/tools/install.sh
index 71e19a389..fc7ad70cf 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then
fi
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
-hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
+hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
echo "git not installed"
exit
}