diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2022-11-05 14:55:11 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2022-11-05 14:55:11 -0700 |
commit | 04b8c052e5b624873b352889423c753ed1baf9c4 (patch) | |
tree | 78e14fe69e61d69709f31f91b7ae29fe8bc74477 /lib | |
parent | 1a6dcd017dbf564058a729032de3db139fcf9c7e (diff) | |
parent | 80fdbc9b91a9acca42fb90065b5e64a9722978a7 (diff) | |
download | zsh-04b8c052e5b624873b352889423c753ed1baf9c4.tar.gz zsh-04b8c052e5b624873b352889423c753ed1baf9c4.tar.bz2 zsh-04b8c052e5b624873b352889423c753ed1baf9c4.zip |
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cli.zsh | 24 | ||||
-rw-r--r-- | lib/grep.zsh | 4 |
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh index db659c11f..fed00d21d 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 } @@ -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 { @@ -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 } 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 |