zsh: fix indent

This commit is contained in:
PowerUser64 2022-01-30 20:29:17 -08:00
parent ffc7c57c48
commit 6ecb219644

78
.zshrc
View file

@ -483,49 +483,49 @@ function mzc_termsupport_preexec {
emulate -L zsh emulate -L zsh
# split command into array of arguments # split command into array of arguments
local -a cmdargs local -a cmdargs
cmdargs=("${(z)2}") # " <- syntax highlighting fix cmdargs=("${(z)2}") # " <- syntax highlighting fix
# if running fg, extract the command from the job description # if running fg, extract the command from the job description
if [[ "${cmdargs[1]}" = fg ]]; then if [[ "${cmdargs[1]}" = fg ]]; then
# get the job id from the first argument passed to the fg command # get the job id from the first argument passed to the fg command
local job_id jobspec="${cmdargs[2]#%}" local job_id jobspec="${cmdargs[2]#%}"
# logic based on jobs arguments: # logic based on jobs arguments:
# http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs # http://zsh.sourceforge.net/Doc/Release/Jobs-_0026-Signals.html#Jobs
# https://www.zsh.org/mla/users/2007/msg00704.html # https://www.zsh.org/mla/users/2007/msg00704.html
case "$jobspec" in case "$jobspec" in
<->) # %number argument: <->) # %number argument:
# use the same <number> passed as an argument # use the same <number> passed as an argument
job_id=${jobspec} ;; job_id=${jobspec} ;;
""|%|+) # empty, %% or %+ argument: ""|%|+) # empty, %% or %+ argument:
# use the current job, which appears with a + in $jobstates: # use the current job, which appears with a + in $jobstates:
# suspended:+:5071=suspended (tty output) # suspended:+:5071=suspended (tty output)
job_id=${(k)jobstates[(r)*:+:*]} ;; job_id=${(k)jobstates[(r)*:+:*]} ;;
-) # %- argument: -) # %- argument:
# use the previous job, which appears with a - in $jobstates: # use the previous job, which appears with a - in $jobstates:
# suspended:-:6493=suspended (signal) # suspended:-:6493=suspended (signal)
job_id=${(k)jobstates[(r)*:-:*]} ;; job_id=${(k)jobstates[(r)*:-:*]} ;;
[?]*) # %?string argument: [?]*) # %?string argument:
# use $jobtexts to match for a job whose command *contains* <string> # use $jobtexts to match for a job whose command *contains* <string>
job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;; job_id=${(k)jobtexts[(r)*${(Q)jobspec}*]} ;;
*) # %string argument: *) # %string argument:
# use $jobtexts to match for a job whose command *starts with* <string> # use $jobtexts to match for a job whose command *starts with* <string>
job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;; job_id=${(k)jobtexts[(r)${(Q)jobspec}*]} ;;
esac esac
# override preexec function arguments with job command # override preexec function arguments with job command
if [[ -n "${jobtexts[$job_id]}" ]]; then if [[ -n "${jobtexts[$job_id]}" ]]; then
1="${jobtexts[$job_id]}" 1="${jobtexts[$job_id]}"
2="${jobtexts[$job_id]}" 2="${jobtexts[$job_id]}"
fi fi
fi fi
# cmd name only, or if this is sudo or ssh, the next cmd # cmd name only, or if this is sudo or ssh, the next cmd
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
local LINE="${2:gs/%/%%}" local LINE="${2:gs/%/%%}"
title '$CMD' '%100>...>$LINE%<<' title '$CMD' '%100>...>$LINE%<<'
} }
# <<< # <<<