mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-11-11 11:11:50 -05:00
fix(globalias): preserve quoted words and assignment values (#14092)
Only invoke alias completion when the complete shell word is an alias name. Completion otherwise treats assignment values and quoted text as standalone alias names, corrupting inputs such as DEBUG=1. Add a real ZLE regression test covering the reported assignments, quotes, escaped aliases, filtering, and existing expansion behavior. Assisted-by: OpenAI Codex
This commit is contained in:
@@ -4,7 +4,11 @@ globalias() {
|
||||
# (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
|
||||
# Completion also considers quoted strings and assignment values as aliases.
|
||||
# Only expand when the complete shell word is an alias name.
|
||||
if (( ${+aliases[$word]} || ${+galiases[$word]} )); then
|
||||
zle _expand_alias
|
||||
fi
|
||||
zle expand-word
|
||||
fi
|
||||
zle self-insert
|
||||
|
||||
Reference in New Issue
Block a user