mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Merge e77c31edc7 into a811ab0ba7
This commit is contained in:
commit
1834fe2d8e
2 changed files with 42 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -7,3 +7,4 @@ custom/*
|
||||||
*.swp
|
*.swp
|
||||||
!custom/example.zshcache
|
!custom/example.zshcache
|
||||||
cache/
|
cache/
|
||||||
|
*~
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,32 @@ function omz_termsupport_preexec {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt extended_glob
|
setopt extended_glob
|
||||||
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd
|
||||||
local LINE="${2:gs/$/\\$}"
|
local LINE=${2}
|
||||||
LINE="${LINE:gs/%/%%}"
|
|
||||||
|
if [[ -o PROMPT_BANG ]]; then
|
||||||
|
# We must escape ! so that it is not interpreted as a history event number
|
||||||
|
LINE=${LINE:gs/\!/\!\!}
|
||||||
|
CMD=${CMD:gs/\!/\!\!}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -o PROMPT_SUBST ]]; then
|
||||||
|
# We must escape '\', '$', and '`'
|
||||||
|
# The backslash is the escape character, and so must be escaped first.
|
||||||
|
# Both '$' and '`' initiate command substitution, and
|
||||||
|
# the former initiates arithmetic and parameter expansion
|
||||||
|
CMD=${CMD:gs/\\/\\\\} # escapses \ -- must be first
|
||||||
|
CMD=${CMD:gs/$/\\$}
|
||||||
|
CMD=${CMD:gs/\`/\\\`}
|
||||||
|
local LINE=${LINE:gs/\\/\\\\} # escapes \ -- must be first
|
||||||
|
LINE=${LINE:gs/$/\\$}
|
||||||
|
LINE=${LINE:gs/\`/\\\`}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -o PROMPT_PERCENT ]]; then
|
||||||
|
# We must escape % so that it is not interpreted as starting an escape sequence
|
||||||
|
CMD=${CMD:gs/%/%%}
|
||||||
|
LINE=${LINE:gs/%/%%}
|
||||||
|
fi
|
||||||
title "$CMD" "%100>...>$LINE%<<"
|
title "$CMD" "%100>...>$LINE%<<"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue