aboutsummaryrefslogtreecommitdiff
path: root/.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch
diff options
context:
space:
mode:
authorkj-sh6042025-07-16 22:10:52 -0400
committerkj-sh6042025-07-16 22:10:52 -0400
commit1e204d36c1fab9884f65618ccca019d8cd5f9386 (patch)
tree962ebadaa02a15d2f8441b290daf330bfbd48417 /.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch
parent7c9e54b5366ada655baf8c2b61914182840d6bb6 (diff)
refactor: update `zsh-fast-syntax-highlighting` plugin
Diffstat (limited to '.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch')
-rw-r--r--.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch37
1 files changed, 37 insertions, 0 deletions
diff --git a/.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch b/.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch
new file mode 100644
index 0000000..65f214c
--- /dev/null
+++ b/.config/shell/zsh-fast-syntax-highlighting/→chroma/-node.ch
@@ -0,0 +1,37 @@
+# vim:ft=zsh:et:sw=4
+(( next_word = 2 | 8192 ))
+[[ "$__arg_type" = 3 ]] && return 2
+
+local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
+local __style
+
+if (( __first_call )); then
+ FAST_HIGHLIGHT[chroma-node-file]=1
+elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
+ return 1
+elif [[ "$__wrd" = -- ]]; then
+ FAST_HIGHLIGHT[chroma-node-file]=2
+elif (( FAST_HIGHLIGHT[chroma-node-file] != 2 )) && [[ "$__wrd" = -* ]]; then
+ if [[ "$__wrd" = -*e* || "$__wrd" = --eval ]]; then
+ FAST_HIGHLIGHT[chroma-node-file]=0
+ fi
+elif (( FAST_HIGHLIGHT[chroma-node-file] )); then
+ if [[ "$__wrd" = debug || "$__wrd" = inspect ]]; then
+ __style=${FAST_THEME_NAME}subcommand
+ else
+ FAST_HIGHLIGHT[chroma-node-file]=0
+ if [[ -f ${~__wrd} || -f ${~__wrd}.js || -f ${~__wrd}/index.js ]]; then
+ __style=${FAST_THEME_NAME}path
+ else
+ __style=${FAST_THEME_NAME}incorrect-subtle
+ fi
+ fi
+ (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
+ && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
+ (( this_word = next_word ))
+ _start_pos=$_end_pos
+
+ return 0
+fi
+
+return 1