Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chroma]: Zi syntax #33

Merged
merged 2 commits into from
Aug 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 23 additions & 44 deletions →chroma/-zi.ch
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fsh__zi__chroma__def=(

subcmd:snippet "SNIPPET_0_opt // SNIPPET_1_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"

SNIPPET_0_opt "(-f|--command)
SNIPPET_0_opt "(-h|--help|-f|--force|--command|-x)
<<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"

SNIPPET_1_arg "NO-OP // ::→chroma/-zi-verify-snippet"
Expand Down Expand Up @@ -83,7 +83,7 @@ fsh__zi__chroma__def=(
subcmd:update "UPDATE_0_opt // PLGSNP_1_arg // PLGSNP_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"

UPDATE_0_opt "
(--all|-r|--reset|-q|--quiet|-p|--parallel)
(-L|--plugins|-s|--snippets|-p|--parallel|-a|--all|-q|--quiet|-r|--reset|-u|--urge|-n|--no-pager|-v|--verbose|-h|--help)
<<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"

## }}}
Expand All @@ -95,7 +95,7 @@ fsh__zi__chroma__def=(

subcmd:light "LIGHT_0_opt // LOAD_1_arg // LOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"

LIGHT_0_opt "-b
LIGHT_0_opt "-h|--help|-b
<<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"

## }}}
Expand All @@ -107,7 +107,7 @@ fsh__zi__chroma__def=(

subcmd:unload "UNLOAD_0_opt // UNLOAD_1_arg // UNLOAD_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"

UNLOAD_0_opt "-q
UNLOAD_0_opt "-h|--help|-q|--quiet
<<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"

UNLOAD_1_arg "NO-OP // ::→chroma/-zi-verify-loaded-plugin"
Expand Down Expand Up @@ -138,7 +138,7 @@ fsh__zi__chroma__def=(
"DELETE_0_opt // PLGSNP_1_arg // PLGSNP_2_arg // NO_MATCH_#_opt // NO_MATCH_#_arg"

DELETE_0_opt "
(--all|--clean|-y|--yes|-q|--quiet)
(-a|--all|-c|--clean|-y|--yes|-q|--quiet|-h|--help)
<<>> NO-OP // ::→chroma/main-chroma-std-aopt-action"

## }}}
Expand Down Expand Up @@ -196,25 +196,21 @@ fsh__zi__chroma__def=(
→chroma/-zi-verify-plugin() {
local _scmd="$1" _wrd="$4"

[[ -d "$_wrd" ]] && \
{ __style=${FAST_THEME_NAME}correct-subtle; return 0; }
[[ -d "$_wrd" ]] && { __style=${FAST_THEME_NAME}correct-subtle; return 0; }

typeset -a plugins
plugins=( "${ZI[PLUGINS_DIR]}"/*(N:t) )
plugins=( "${plugins[@]//---//}" )
plugins=( "${plugins[@]:#_local/zi}" )
plugins=( "${plugins[@]:#custom}" )

[[ -n "${plugins[(r)$_wrd]}" ]] && \
__style=${FAST_THEME_NAME}correct-subtle || \
return 1
[[ -n "${plugins[(r)$_wrd]}" ]] && __style=${FAST_THEME_NAME}correct-subtle || return 1
#__style=${FAST_THEME_NAME}incorrect-subtle
return 0
}

→chroma/-zi-verify-plugin-or-snippet() {
→chroma/-zi-verify-plugin "$1" "" "" "$4" || \
→chroma/-zi-verify-snippet "$1" "" "" "$4"
→chroma/-zi-verify-plugin "$1" "" "" "$4" || →chroma/-zi-verify-snippet "$1" "" "" "$4"
return $?
}

Expand Down Expand Up @@ -312,44 +308,27 @@ fsh__zi__chroma__def=(
}

→chroma/-zi-check-ice-mod() {
local _scmd="$1" _wrd="$4"
[[ "$_wrd" = (svn(\'|\")*|svn) ]] && \
FAST_HIGHLIGHT[chroma-zi-ice-elements-svn]=1
[[ "$_wrd" = (#b)(id-as(:|)(\'|\")(*)(\'|\")|id-as:(*)|id-as(*)) ]] && \
FAST_HIGHLIGHT[chroma-zi-ice-elements-id-as]="${match[4]}${match[6]}${match[7]}"
local _scmd="$1" _wrd="$4"
[[ "$_wrd" = (svn(\'|\")*|svn) ]] && FAST_HIGHLIGHT[chroma-zi-ice-elements-svn]=1
[[ "$_wrd" = (#b)(id-as(:|)(\'|\")(*)(\'|\")|id-as:(*)|id-as(*)) ]] && \
FAST_HIGHLIGHT[chroma-zi-ice-elements-id-as]="${match[4]}${match[6]}${match[7]}"

# Copy from lib/zsh/autoload.zsh / -zplg-recall
# .zi-recall
local -a ice_order nval_ices ext_val_ices
ext_val_ices=( ${(@)${(@Ms.|.)ZI_EXTS[ice-mods]:#*\'\'*}//\'\'/} )
ext_val_ices=( ${(@)${(@Akons:|:u)${ZI_EXTS[ice-mods]//\'\'/}}/(#s)<->-/} )

ice_order=(
svn proto from teleid bindmap cloneopts id-as depth if wait load
unload blockf pick bpick src as ver silent lucid notify mv cp
atinit atclone atload atpull nocd run-atpull has cloneonly make
service trackbinds multisrc compile nocompile nocompletions
reset-prompt wrap reset sh \!sh bash \!bash ksh \!ksh csh
\!csh aliases countdown ps-on-unload ps-on-update trigger-load
light-mode is-snippet atdelete pack git verbose on-update-of
subscribe extract param opts autoload subst install pullopts debug
null binary

# Include all additional ices – after
# stripping them from the possible: ''
${(@s.|.)${ZI_EXTS[ice-mods]//\'\'/}}
${${(s.|.)ZI[ice-list]}}
# Include all additional ices – after stripping them from the possible: ''
${(@)${(@Akons:|:u)${ZI_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}
)
nval_ices=(
blockf silent lucid trackbinds cloneonly nocd run-atpull
nocompletions sh \!sh bash \!bash ksh \!ksh csh \!csh
aliases countdown light-mode is-snippet git verbose
cloneopts pullopts debug null binary make nocompile notify reset

# Include only those additional ices,
# don't have the '' in their name, i.e.
# aren't designed to hold value
${(@)${(@s.|.)ZI_EXTS[ice-mods]}:#*\'\'*}

# Must be last
svn
${(s.|.)ZI[nval-ice-list]}
# Include only those additional ices,
# don't have the '' in their name, i.e. aren't designed to hold value
${(@)${(@)${(@Akons:|:u)${ZI_EXTS[ice-mods]//\'\'/}}/(#s)<->-/}}
# Must be last
svn
)

if [[ "$_wrd" = (#b)(${(~j:|:)${ice_order[@]:#(${(~j:|:)nval_ices[@]:#(${(~j:|:)ext_val_ices[@]})})}})(*) ]]; then
Expand Down