mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue