summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/git.zsh17
-rw-r--r--lib/theme-and-appearance.zsh8
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/git.zsh b/lib/git.zsh
index 67075248e..b023c9ac3 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -9,16 +9,25 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
+ local GIT_STATUS=''
+ local CLEAN_MESSAGE='nothing to commit (working directory clean)'
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
+ fi
+ if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
+ else
+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
fi
- if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
+ if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
- fi
- fi
+ fi
+ else
+ echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
+ fi
}
# get the difference between the local and remote branches
@@ -62,7 +71,7 @@ function git_prompt_long_sha() {
git_prompt_status() {
INDEX=$(git status --porcelain -b 2> /dev/null)
STATUS=""
- if $(echo "$INDEX" | grep '^\?\? ' &> /dev/null); then
+ if $(echo "$INDEX" | 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/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index aec67721a..2677615c0 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -7,7 +7,13 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad"
if [ "$DISABLE_LS_COLORS" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
- ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
+ if [[ "$(uname -s)" == "NetBSD" ]]; then
+ # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
+ # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
+ gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
+ else
+ ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
+ fi
fi
#setopt no_beep