mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-22 04:51:12 +02:00
Merge c5fb48da9d into 0eecd2821e
This commit is contained in:
commit
8ca26a564f
3 changed files with 14 additions and 5 deletions
|
|
@ -42,6 +42,10 @@ function _omz_git_prompt_info() {
|
|||
function _omz_git_prompt_status() {
|
||||
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
||||
|
||||
# Use C locale for regex operations to avoid "illegal byte sequence" errors
|
||||
# when branch names contain non-ASCII characters (e.g. Chinese, Japanese)
|
||||
local LC_ALL=C
|
||||
|
||||
# Maps a git status prefix to an internal constant
|
||||
# This cannot use the prompt constants, as they may be empty
|
||||
local -A prefix_constant_map
|
||||
|
|
@ -162,13 +166,13 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt \
|
|||
# or any of the other prompt variables
|
||||
function _defer_async_git_register() {
|
||||
# Check if git_prompt_info is used in a prompt variable
|
||||
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||
case "${PS1:-}:${PS2:-}:${PS3:-}:${PS4:-}:${RPROMPT:-}:${RPS1:-}:${RPS2:-}:${RPS3:-}:${RPS4:-}" in
|
||||
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
||||
_omz_register_handler _omz_git_prompt_info
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${PS1}:${PS2}:${PS3}:${PS4}:${RPROMPT}:${RPS1}:${RPS2}:${RPS3}:${RPS4}" in
|
||||
case "${PS1:-}:${PS2:-}:${PS3:-}:${PS4:-}:${RPROMPT:-}:${RPS1:-}:${RPS2:-}:${RPS3:-}:${RPS4:-}" in
|
||||
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
|
||||
_omz_register_handler _omz_git_prompt_status
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ colorize_less() {
|
|||
# (e.g. when not scrolled to the bottom) while already the next file will be displayed.
|
||||
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
||||
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
||||
ZSH_COLORIZE_CHROMA_FORMATTER=$ZSH_COLORIZE_CHROMA_FORMATTER \
|
||||
colorize_cat %s 2> /dev/null'"
|
||||
|
||||
# LESSCLOSE will be set to prevent any errors by executing a user script
|
||||
|
|
|
|||
|
|
@ -3,9 +3,13 @@ globalias() {
|
|||
# (z) splits into words using shell parsing
|
||||
# (A) makes it an array even if there's only one element
|
||||
local word=${${(Az)LBUFFER}[-1]}
|
||||
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
||||
zle _expand_alias
|
||||
zle expand-word
|
||||
# Don't expand if the word looks like an environment variable assignment
|
||||
# (e.g. DEBUG=1 or KEY="value") to avoid expanding aliases in env vars
|
||||
if [[ $word != *"="* ]]; then
|
||||
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
||||
zle _expand_alias
|
||||
zle expand-word
|
||||
fi
|
||||
fi
|
||||
zle self-insert
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue