Make friendly to set -u

This commit is contained in:
Steven Shaw 2015-05-11 07:27:21 +00:00
commit 5c1cf2feea
8 changed files with 18 additions and 18 deletions

View file

@ -53,7 +53,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
# ... unless we really want to.
zstyle '*' single-ignored show
if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
if [ "x${COMPLETION_WAITING_DOTS:-}" = "xtrue" ]; then
expand-or-complete-with-dots() {
echo -n "\e[31m......\e[0m"
zle expand-or-complete

View file

@ -1,4 +1,4 @@
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
if [[ "${ENABLE_CORRECTION:-}" == "true" ]]; then
alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'

View file

@ -17,7 +17,7 @@ parse_git_dirty() {
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
FLAGS+='--ignore-submodules=dirty'
fi
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)

View file

@ -1,5 +1,5 @@
## Command history configuration
if [ -z "$HISTFILE" ]; then
if [ -z "${HISTFILE:-}" ]; then
HISTFILE=$HOME/.zsh_history
fi
@ -7,7 +7,7 @@ HISTSIZE=10000
SAVEHIST=10000
# Show history
case $HIST_STAMPS in
case ${HIST_STAMPS:-} in
"mm/dd/yyyy") alias history='fc -fl 1' ;;
"dd.mm.yyyy") alias history='fc -El 1' ;;
"yyyy-mm-dd") alias history='fc -il 1' ;;

View file

@ -17,6 +17,6 @@ alias please='sudo'
alias afind='ack-grep -il'
# only define LC_CTYPE if undefined
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
if [[ -z "${LC_CTYPE:-}" && -z "${LC_ALL:-}" ]]; then
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
fi

View file

@ -7,7 +7,7 @@
# (In screen, only short_tab_title is used)
# Limited support for Apple Terminal (Terminal can't set window and tab separately)
function title {
[[ "$EMACS" == *term* ]] && return
[[ "${EMACS:-}" == *term* ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is
@ -15,7 +15,7 @@ function title {
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "${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
fi
@ -26,7 +26,7 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~"
# Runs before showing the prompt
function omz_termsupport_precmd {
if [[ $DISABLE_AUTO_TITLE == true ]]; then
if [[ ${DISABLE_AUTO_TITLE:-} == true ]]; then
return
fi
@ -35,7 +35,7 @@ function omz_termsupport_precmd {
# Runs before executing the command
function omz_termsupport_preexec {
if [[ $DISABLE_AUTO_TITLE == true ]]; then
if [[ ${DISABLE_AUTO_TITLE:-} == true ]]; then
return
fi
@ -57,7 +57,7 @@ preexec_functions+=(omz_termsupport_preexec)
function omz_termsupport_cwd {
# Notify Terminal.app of current directory using undocumented OSC sequence
# found in OS X 10.9 and 10.10's /etc/bashrc
if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
if [[ ${TERM_PROGRAM:-} == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
local PWD_URL="file://$HOSTNAME${PWD// /%20}"
printf '\e]7;%s\a' "$PWD_URL"
fi

View file

@ -3,7 +3,7 @@ autoload -U colors && colors
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# Enable ls colors
if [ "$DISABLE_LS_COLORS" != "true" ]
if [ "${DISABLE_LS_COLORS:-}" != "true" ]
then
# Find the option for using colors in ls, depending on the version: Linux or BSD
if [[ "$(uname -s)" == "NetBSD" ]]; then
@ -24,7 +24,7 @@ setopt auto_cd
setopt multios
setopt cdablevars
if [[ x$WINDOW != x ]]
if [[ x${WINDOW:-} != x ]]
then
SCREEN_NO="%B$WINDOW%b "
else