summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/functions.zsh4
-rw-r--r--lib/git.zsh12
-rw-r--r--lib/nvm.zsh2
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index f9d4a9717..9f11318d2 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -3,11 +3,11 @@ function zsh_stats() {
}
function uninstall_oh_my_zsh() {
- env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh
+ env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
}
function upgrade_oh_my_zsh() {
- env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh
+ env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
}
function take() {
diff --git a/lib/git.zsh b/lib/git.zsh
index 1c76d5882..648a766b5 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -76,13 +76,19 @@ function git_current_branch() {
# Gets the number of commits ahead from remote
function git_commits_ahead() {
- if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then
- local COMMITS
- COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')
+ if $(command git rev-parse --git-dir > /dev/null 2>&1); then
+ local COMMITS="$(git rev-list --count @{upstream}..HEAD)"
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi
}
+# Gets the number of commits behind remote
+function git_commits_behind() {
+ if $(command git rev-parse --git-dir > /dev/null 2>&1); then
+ echo $(git rev-list --count HEAD..@{upstream})
+ fi
+}
+
# Outputs if current branch is ahead of remote
function git_prompt_ahead() {
if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then
diff --git a/lib/nvm.zsh b/lib/nvm.zsh
index 61d997fc0..4a8b6811e 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 "$NVM_DIR/nvm.sh" ]] || return
local nvm_prompt
nvm_prompt=$(node -v 2>/dev/null)
[[ "${nvm_prompt}x" == "x" ]] && return