summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/correction.zsh12
-rw-r--r--lib/git.zsh25
-rw-r--r--lib/history.zsh4
-rw-r--r--lib/termsupport.zsh2
-rw-r--r--lib/theme-and-appearance.zsh8
5 files changed, 27 insertions, 24 deletions
diff --git a/lib/correction.zsh b/lib/correction.zsh
index fc60dcdbd..176ec16d5 100644
--- a/lib/correction.zsh
+++ b/lib/correction.zsh
@@ -1,10 +1,2 @@
-setopt correct_all
-
-alias man='nocorrect man'
-alias mv='nocorrect mv'
-alias mysql='nocorrect mysql'
-alias mkdir='nocorrect mkdir'
-alias gist='nocorrect gist'
-alias heroku='nocorrect heroku'
-alias ebuild='nocorrect ebuild'
-alias hpodder='nocorrect hpodder'
+# correct commands, but not any arguments (correct_all would do that)
+setopt correct
diff --git a/lib/git.zsh b/lib/git.zsh
index b1dfce357..76fe9b142 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -9,14 +9,19 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
- if [[ $POST_1_7_2_GIT -gt 0 ]]; then
- SUBMODULE_SYNTAX="--ignore-submodules=dirty"
- fi
- if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
- echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
- else
- echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
- fi
+ 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
+ GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
+ if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
+ echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
+ else
+ echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
+ fi
+ fi
}
# get the difference between the local and remote branches
@@ -60,7 +65,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
@@ -110,7 +115,7 @@ function git_compare_version() {
local INPUT_GIT_VERSION=$1;
local INSTALLED_GIT_VERSION
INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION});
- INSTALLED_GIT_VERSION=($(git --version));
+ INSTALLED_GIT_VERSION=($(git --version 2>/dev/null));
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]});
for i in {1..3}; do
diff --git a/lib/history.zsh b/lib/history.zsh
index 876936b87..655945166 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -1,5 +1,7 @@
## Command history configuration
-HISTFILE=$HOME/.zsh_history
+if [ -z $HISTFILE ]; then
+ HISTFILE=$HOME/.zsh_history
+fi
HISTSIZE=10000
SAVEHIST=10000
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index 7470110b6..c056989eb 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -8,8 +8,6 @@ function title {
fi
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
- elif [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
- print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
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