mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-20 03:13:33 +01:00
Make friendly to set -u
This commit is contained in:
parent
9c755511f0
commit
5c1cf2feea
8 changed files with 18 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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' ;;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
10
oh-my-zsh.sh
10
oh-my-zsh.sh
|
|
@ -1,6 +1,6 @@
|
|||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
|
||||
if [ "${DISABLE_AUTO_UPDATE:-}" != "true" ]; then
|
||||
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=${DISABLE_UPDATE_PROMPT:-} zsh -f $ZSH/tools/check_for_upgrade.sh
|
||||
fi
|
||||
|
||||
# Initializes Oh My Zsh
|
||||
|
|
@ -10,13 +10,13 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
|
|||
|
||||
# Set ZSH_CUSTOM to the path where your custom config files
|
||||
# and plugins exists, or else we will use the default custom/
|
||||
if [[ -z "$ZSH_CUSTOM" ]]; then
|
||||
if [[ -z "${ZSH_CUSTOM:-}" ]]; then
|
||||
ZSH_CUSTOM="$ZSH/custom"
|
||||
fi
|
||||
|
||||
# Set ZSH_CACHE_DIR to the path where cache files sould be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
if [[ -z "${ZSH_CACHE_DIR:-}" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache/"
|
||||
fi
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ else
|
|||
fi
|
||||
|
||||
# Save the location of the current completion dump file.
|
||||
if [ -z "$ZSH_COMPDUMP" ]; then
|
||||
if [ -z "${ZSH_COMPDUMP:-}" ]; then
|
||||
ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue