From 570158e464c9f57ab03c4162b4e6853b2c7c650d Mon Sep 17 00:00:00 2001 From: Nadhem Date: Mon, 3 Oct 2022 16:59:49 +0100 Subject: chore(lib): update deprecated grep aliases (#11161) --- lib/grep.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index a725e0f26..54e0f694e 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -24,8 +24,8 @@ else if [[ -n "$GREP_OPTIONS" ]]; then # export grep, egrep and fgrep settings alias grep="grep $GREP_OPTIONS" - alias egrep="egrep $GREP_OPTIONS" - alias fgrep="fgrep $GREP_OPTIONS" + alias egrep="grep -E $GREP_OPTIONS" + alias fgrep="grep -F $GREP_OPTIONS" # write to cache file if cache directory is writable if [[ -w "$ZSH_CACHE_DIR" ]]; then -- cgit v1.2.3-70-g09d2 From b9be3a43b4da579299b4426b1ba9121f746e2555 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 3 Oct 2022 18:52:50 +0200 Subject: fix(cli): change unrecognized `\s` in BSD awk (#11146) In BSD awk, \s is not a valid sequence interchangeable with "space or tab characters" as it is in GNU awk. This fix uses [ \t] instead, which is all the possibilities that we need to contemplate when reading the .zshrc file. Fixes #11146 --- lib/cli.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/cli.zsh b/lib/cli.zsh index db659c11f..f15bd6d63 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -241,21 +241,21 @@ function _omz::plugin::disable { # Remove plugins substitution awk script local awk_subst_plugins="\ - gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before - gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after + gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before + gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin) " # Disable plugins awk script local awk_script=" # if plugins=() is in oneline form, substitute disabled plugins and go to next line -/^\s*plugins=\([^#]+\).*\$/ { +/^[ \t]*plugins=\([^#]+\).*\$/ { $awk_subst_plugins print \$0 next } # if plugins=() is in multiline form, enable multi flag and disable plugins if they're there -/^\s*plugins=\(/ { +/^[ \t]*plugins=\(/ { multi=1 $awk_subst_plugins print \$0 @@ -330,14 +330,14 @@ function _omz::plugin::enable { # Enable plugins awk script local awk_script=" # if plugins=() is in oneline form, substitute ) with new plugins and go to the next line -/^\s*plugins=\([^#]+\).*\$/ { +/^[ \t]*plugins=\([^#]+\).*\$/ { sub(/\)/, \" $add_plugins&\") print \$0 next } # if plugins=() is in multiline form, enable multi flag -/^\s*plugins=\(/ { +/^[ \t]*plugins=\(/ { multi=1 } @@ -699,9 +699,9 @@ function _omz::theme::set { # Enable theme in .zshrc local awk_script=' -!set && /^\s*ZSH_THEME=[^#]+.*$/ { +!set && /^[ \t]*ZSH_THEME=[^#]+.*$/ { set=1 - sub(/^\s*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`") + sub(/^[ \t]*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`") print $0 next } -- cgit v1.2.3-70-g09d2 From 8487a5536d247927216dd22041c1c32bcd100256 Mon Sep 17 00:00:00 2001 From: Carlo Date: Tue, 18 Oct 2022 19:38:47 +0200 Subject: fix(cli): avoid using `column` (#11271) --- lib/cli.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/cli.zsh b/lib/cli.zsh index f15bd6d63..fed00d21d 100644 --- a/lib/cli.zsh +++ b/lib/cli.zsh @@ -416,14 +416,14 @@ function _omz::plugin::list { if (( ${#custom_plugins} )); then print -P "%U%BCustom plugins%b%u:" - print -l ${(q-)custom_plugins} | column -x + print -lac ${(q-)custom_plugins} fi if (( ${#builtin_plugins} )); then (( ${#custom_plugins} )) && echo # add a line of separation print -P "%U%BBuilt-in plugins%b%u:" - print -l ${(q-)builtin_plugins} | column -x + print -lac ${(q-)builtin_plugins} fi } @@ -674,13 +674,13 @@ function _omz::theme::list { # Print custom themes if there are any if (( ${#custom_themes} )); then print -P "%U%BCustom themes%b%u:" - print -l ${(q-)custom_themes} | column -x + print -lac ${(q-)custom_themes} echo fi # Print built-in themes print -P "%U%BBuilt-in themes%b%u:" - print -l ${(q-)builtin_themes} | column -x + print -lac ${(q-)builtin_themes} } function _omz::theme::set { -- cgit v1.2.3-70-g09d2