mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-26 01:57:26 +08:00
Compare commits
No commits in common. "b9be3a43b4da579299b4426b1ba9121f746e2555" and "11daa7dd5f22acadef1135000e92cc899e22c134" have entirely different histories.
b9be3a43b4
...
11daa7dd5f
16
lib/cli.zsh
16
lib/cli.zsh
@ -241,21 +241,21 @@ function _omz::plugin::disable {
|
|||||||
|
|
||||||
# Remove plugins substitution awk script
|
# Remove plugins substitution awk script
|
||||||
local awk_subst_plugins="\
|
local awk_subst_plugins="\
|
||||||
gsub(/[ \t]+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
gsub(/\s+(${(j:|:)dis_plugins})/, \"\") # with spaces before
|
||||||
gsub(/(${(j:|:)dis_plugins})[ \t]+/, \"\") # with spaces after
|
gsub(/(${(j:|:)dis_plugins})\s+/, \"\") # with spaces after
|
||||||
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
gsub(/\((${(j:|:)dis_plugins})\)/, \"\") # without spaces (only plugin)
|
||||||
"
|
"
|
||||||
# Disable plugins awk script
|
# Disable plugins awk script
|
||||||
local awk_script="
|
local awk_script="
|
||||||
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
# if plugins=() is in oneline form, substitute disabled plugins and go to next line
|
||||||
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
/^\s*plugins=\([^#]+\).*\$/ {
|
||||||
$awk_subst_plugins
|
$awk_subst_plugins
|
||||||
print \$0
|
print \$0
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
# if plugins=() is in multiline form, enable multi flag and disable plugins if they're there
|
||||||
/^[ \t]*plugins=\(/ {
|
/^\s*plugins=\(/ {
|
||||||
multi=1
|
multi=1
|
||||||
$awk_subst_plugins
|
$awk_subst_plugins
|
||||||
print \$0
|
print \$0
|
||||||
@ -330,14 +330,14 @@ function _omz::plugin::enable {
|
|||||||
# Enable plugins awk script
|
# Enable plugins awk script
|
||||||
local awk_script="
|
local awk_script="
|
||||||
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
|
# if plugins=() is in oneline form, substitute ) with new plugins and go to the next line
|
||||||
/^[ \t]*plugins=\([^#]+\).*\$/ {
|
/^\s*plugins=\([^#]+\).*\$/ {
|
||||||
sub(/\)/, \" $add_plugins&\")
|
sub(/\)/, \" $add_plugins&\")
|
||||||
print \$0
|
print \$0
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
# if plugins=() is in multiline form, enable multi flag
|
# if plugins=() is in multiline form, enable multi flag
|
||||||
/^[ \t]*plugins=\(/ {
|
/^\s*plugins=\(/ {
|
||||||
multi=1
|
multi=1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,9 +699,9 @@ function _omz::theme::set {
|
|||||||
|
|
||||||
# Enable theme in .zshrc
|
# Enable theme in .zshrc
|
||||||
local awk_script='
|
local awk_script='
|
||||||
!set && /^[ \t]*ZSH_THEME=[^#]+.*$/ {
|
!set && /^\s*ZSH_THEME=[^#]+.*$/ {
|
||||||
set=1
|
set=1
|
||||||
sub(/^[ \t]*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
|
sub(/^\s*ZSH_THEME=[^#]+.*$/, "ZSH_THEME=\"'$1'\" # set by `omz`")
|
||||||
print $0
|
print $0
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|||||||
@ -156,17 +156,11 @@ supports_hyperlinks() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Windows Terminal also supports hyperlinks
|
# Windows Terminal or Konsole also support hyperlinks
|
||||||
if [ -n "$WT_SESSION" ]; then
|
if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
|
|
||||||
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
|
|
||||||
# if [ -n "$KONSOLE_VERSION" ]; then
|
|
||||||
# return 0
|
|
||||||
# fi
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +185,7 @@ supports_truecolor() {
|
|||||||
fmt_link() {
|
fmt_link() {
|
||||||
# $1: text, $2: url, $3: fallback mode
|
# $1: text, $2: url, $3: fallback mode
|
||||||
if supports_hyperlinks; then
|
if supports_hyperlinks; then
|
||||||
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
|
printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -78,17 +78,11 @@ supports_hyperlinks() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Windows Terminal also supports hyperlinks
|
# Windows Terminal or Konsole also support hyperlinks
|
||||||
if [ -n "$WT_SESSION" ]; then
|
if [ -n "$WT_SESSION" ] || [ -n "$KONSOLE_VERSION" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
|
|
||||||
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
|
|
||||||
# if [ -n "$KONSOLE_VERSION" ]; then
|
|
||||||
# return 0
|
|
||||||
# fi
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +107,7 @@ supports_truecolor() {
|
|||||||
fmt_link() {
|
fmt_link() {
|
||||||
# $1: text, $2: url, $3: fallback mode
|
# $1: text, $2: url, $3: fallback mode
|
||||||
if supports_hyperlinks; then
|
if supports_hyperlinks; then
|
||||||
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
|
printf '\033]8;;%s\a%s\033]8;;\a\n' "$2" "$1"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user