mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +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() {
|
function _omz_git_prompt_status() {
|
||||||
[[ "$(__git_prompt_git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]] && return
|
[[ "$(__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
|
# Maps a git status prefix to an internal constant
|
||||||
# This cannot use the prompt constants, as they may be empty
|
# This cannot use the prompt constants, as they may be empty
|
||||||
local -A prefix_constant_map
|
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
|
# or any of the other prompt variables
|
||||||
function _defer_async_git_register() {
|
function _defer_async_git_register() {
|
||||||
# Check if git_prompt_info is used in a prompt variable
|
# 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\`)*)
|
*(\$\(git_prompt_info\)|\`git_prompt_info\`)*)
|
||||||
_omz_register_handler _omz_git_prompt_info
|
_omz_register_handler _omz_git_prompt_info
|
||||||
;;
|
;;
|
||||||
esac
|
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\`)*)
|
*(\$\(git_prompt_status\)|\`git_prompt_status\`)*)
|
||||||
_omz_register_handler _omz_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.
|
# (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\"; \
|
local LESSOPEN="| zsh -c 'source \"$ZSH_COLORIZE_PLUGIN_PATH\"; \
|
||||||
ZSH_COLORIZE_TOOL=$ZSH_COLORIZE_TOOL ZSH_COLORIZE_STYLE=$ZSH_COLORIZE_STYLE \
|
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'"
|
colorize_cat %s 2> /dev/null'"
|
||||||
|
|
||||||
# LESSCLOSE will be set to prevent any errors by executing a user script
|
# 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
|
# (z) splits into words using shell parsing
|
||||||
# (A) makes it an array even if there's only one element
|
# (A) makes it an array even if there's only one element
|
||||||
local word=${${(Az)LBUFFER}[-1]}
|
local word=${${(Az)LBUFFER}[-1]}
|
||||||
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
# Don't expand if the word looks like an environment variable assignment
|
||||||
zle _expand_alias
|
# (e.g. DEBUG=1 or KEY="value") to avoid expanding aliases in env vars
|
||||||
zle expand-word
|
if [[ $word != *"="* ]]; then
|
||||||
|
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
|
||||||
|
zle _expand_alias
|
||||||
|
zle expand-word
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
zle self-insert
|
zle self-insert
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue