1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-29 23:00:07 +00:00

group precommands with commands

This commit is contained in:
romkatv 2020-01-12 13:14:03 +01:00
parent b8981328bb
commit be359b6e76

View file

@ -5415,8 +5415,8 @@ function _p9k_parse_buffer() {
local -r var="\$$id|\${$id}|\"\$$id\"|\"\${$id}\"" local -r var="\$$id|\${$id}|\"\$$id\"|\"\${$id}\""
local -i e ic c=${2:-'1 << 62'} local -i e ic c=${2:-'1 << 62'}
local skip n s r state local skip n s r state cmd
local -a aln alp alf v commands local -a aln alp alf v
if [[ -o interactive_comments ]]; then if [[ -o interactive_comments ]]; then
ic=1 ic=1
@ -5474,8 +5474,8 @@ function _p9k_parse_buffer() {
a) a)
if [[ $token == $skip ]]; then if [[ $token == $skip ]]; then
if [[ $token == '{' ]]; then if [[ $token == '{' ]]; then
P9K_COMMANDS+=($commands) P9K_COMMANDS+=$cmd
commands=() cmd=
state= state=
else else
skip='{' skip='{'
@ -5490,7 +5490,7 @@ function _p9k_parse_buffer() {
if [[ $token == '()' ]]; then if [[ $token == '()' ]]; then
state= state=
else else
P9K_COMMANDS+=($commands) P9K_COMMANDS+=$cmd
if [[ $token == '}' ]]; then if [[ $token == '}' ]]; then
state=a state=a
skip=always skip=always
@ -5499,7 +5499,7 @@ function _p9k_parse_buffer() {
state=${skip:+s} state=${skip:+s}
fi fi
fi fi
commands=() cmd=
continue continue
elif [[ $state == t ]]; then elif [[ $state == t ]]; then
continue continue
@ -5582,17 +5582,18 @@ function _p9k_parse_buffer() {
;; ;;
esac esac
commands+=$token if (( $+__p9k_pb_precommand[$token] )); then
if (( $+__p9k_pb_precommand[$commands[-1]] )); then
state=p state=p
skip=$__p9k_pb_precommand[$commands[-1]] skip=$__p9k_pb_precommand[$token]
cmd+="$token "
else else
state=t state=t
[[ $token == ('(('*'))'|'`'*'`'|'$'*) ]] || cmd+="$token "
fi fi
done done
} always { } always {
P9K_COMMANDS+=($commands) P9K_COMMANDS+=$cmd
P9K_COMMANDS=(${(u)P9K_COMMANDS:#('(('*'))'|'`'*'`'|'$'*)}) P9K_COMMANDS=(${(u)P9K_COMMANDS% })
} }
} }