From ed4e317bbbd9966da2b4b85893c8d55c9ffbfd66 Mon Sep 17 00:00:00 2001 From: Marco Trevisan Date: Wed, 3 Jun 2020 19:34:57 +0200 Subject: lib: don't override bigger HISTSIZE and SAVEHIST values (#8993) oh-my-zsh Changes the HISTSIZE and SAVEHIST values to fixed sizes, however if a bigger value is set in ~/.zshrc, it will override it, potentially causing the user history to be deleted. So, only set these values if no other is set and if it is lower than the default ones. --- lib/history.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2 From b706a919172955e16a1ab97f36a95b9ee4d9f1dc Mon Sep 17 00:00:00 2001 From: joshuashaffer Date: Fri, 19 Jun 2020 17:16:31 -0400 Subject: core: add title support for mlterm (#8303) --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 3f71eb06a..e3237ca34 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 ;; -- cgit v1.2.3-70-g09d2 From e606ac70514fe31e40af53b818f07a967d185185 Mon Sep 17 00:00:00 2001 From: Patrick Moore Date: Tue, 30 Jun 2020 09:54:27 -0700 Subject: Handle unset variables in various parts of the codebase (#8944) DISABLE_UNTRACKED_FILES_DIRTY, DISABLE_AUTO_TITLE, GIT_STATUS_IGNORE_SUBMODULES are not set Handle these variables not being set with conditional access. If the user has set -u option to report attempts to use undeclared / unassigned variable, accessing the variables needs to be conditional. --- lib/git.zsh | 4 ++-- lib/termsupport.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') 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/termsupport.zsh b/lib/termsupport.zsh index e3237ca34..069b7f328 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -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 -- cgit v1.2.3-70-g09d2 From 62648d71bb05116287206d83181f9daa5a59ba67 Mon Sep 17 00:00:00 2001 From: Monson Shao Date: Thu, 2 Jul 2020 02:51:13 +0800 Subject: lib: enable diff color (#8807) --- lib/theme-and-appearance.zsh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3-70-g09d2 From a15f0f0e9ff17c1ca5c6d694d732e72c7c03a62b Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 3 Jul 2020 19:05:40 +0200 Subject: cli: beauty touches on 'omz pr test' command --- lib/cli.zsh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') 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 ( -- cgit v1.2.3-70-g09d2