summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2020-07-04 11:54:44 -0600
committerTuowen Zhao <ztuowen@gmail.com>2020-07-04 11:54:44 -0600
commit59344b5c59b7190ad3b14a2e8e02db8b5559141b (patch)
treea8e7ede89d3b896967d7d18d071107bd06c77897 /lib
parenta3be2e4084285d7625e63bfe4b951c58143e3c9c (diff)
parenta15f0f0e9ff17c1ca5c6d694d732e72c7c03a62b (diff)
downloadzsh-59344b5c59b7190ad3b14a2e8e02db8b5559141b.tar.gz
zsh-59344b5c59b7190ad3b14a2e8e02db8b5559141b.tar.bz2
zsh-59344b5c59b7190ad3b14a2e8e02db8b5559141b.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.zsh4
-rw-r--r--lib/git.zsh4
-rw-r--r--lib/history.zsh4
-rw-r--r--lib/termsupport.zsh6
-rw-r--r--lib/theme-and-appearance.zsh5
5 files changed, 16 insertions, 7 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index e25a9f0b1..73ac5a846 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -181,6 +181,10 @@ function _omz::pr::test {
# After testing, go back to the previous HEAD if the user wants
_omz::log prompt "do you want to go back to the previous branch? [Y/n] "
read -r -k 1
+
+ # If no newline entered, add a newline
+ [[ "$REPLY" != $'\n' ]] && echo
+ # If NO selected, do nothing else
[[ "$REPLY" = [nN] ]] && return
(
diff --git a/lib/git.zsh b/lib/git.zsh
index 00cb00b19..f7d4738ca 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -14,10 +14,10 @@ function parse_git_dirty() {
local -a FLAGS
FLAGS=('--porcelain')
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
- if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
+ if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
FLAGS+='--untracked-files=no'
fi
- case "$GIT_STATUS_IGNORE_SUBMODULES" in
+ case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
git)
# let git decide (this respects per-repo config in .gitmodules)
;;
diff --git a/lib/history.zsh b/lib/history.zsh
index 0f04de215..0ee8cfe7a 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -27,8 +27,8 @@ esac
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
-HISTSIZE=50000
-SAVEHIST=10000
+[ "$HISTSIZE" -lt 50000 ] && HISTSIZE=50000
+[ "$SAVEHIST" -lt 10000 ] && SAVEHIST=10000
## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
index 3f71eb06a..069b7f328 100644
--- a/lib/termsupport.zsh
+++ b/lib/termsupport.zsh
@@ -17,7 +17,7 @@ function title {
: ${2=$1}
case "$TERM" in
- cygwin|xterm*|putty*|rxvt*|konsole*|ansi)
+ cygwin|xterm*|putty*|rxvt*|konsole*|ansi|mlterm)
print -Pn "\e]2;$2:q\a" # set window name
print -Pn "\e]1;$1:q\a" # set tab name
;;
@@ -50,13 +50,13 @@ fi
# Runs before showing the prompt
function omz_termsupport_precmd {
- [[ "$DISABLE_AUTO_TITLE" == true ]] && return
+ [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
}
# Runs before executing the command
function omz_termsupport_preexec {
- [[ "$DISABLE_AUTO_TITLE" == true ]] && return
+ [[ "${DISABLE_AUTO_TITLE:-}" == true ]] && return
emulate -L zsh
setopt extended_glob
diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
index 5016d86ca..5c1b6db12 100644
--- a/lib/theme-and-appearance.zsh
+++ b/lib/theme-and-appearance.zsh
@@ -39,6 +39,11 @@ if [[ "$DISABLE_LS_COLORS" != "true" ]]; then
fi
fi
+# enable diff color if possible.
+if diff --color . . &>/dev/null; then
+ alias diff='diff --color'
+fi
+
setopt auto_cd
setopt multios
setopt prompt_subst