You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

  1. # vim:ft=zsh:et:sw=4
  2. (( next_word = 2 | 8192 ))
  3. [[ "$__arg_type" = 3 ]] && return 2
  4. local __first_call="$1" __wrd="$2" __start_pos="$3" __end_pos="$4"
  5. local __style
  6. if (( __first_call )); then
  7. FAST_HIGHLIGHT[chroma-node-file]=1
  8. elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
  9. return 1
  10. elif [[ "$__wrd" = -- ]]; then
  11. FAST_HIGHLIGHT[chroma-node-file]=2
  12. elif (( FAST_HIGHLIGHT[chroma-node-file] != 2 )) && [[ "$__wrd" = -* ]]; then
  13. if [[ "$__wrd" = -*e* || "$__wrd" = --eval ]]; then
  14. FAST_HIGHLIGHT[chroma-node-file]=0
  15. fi
  16. elif (( FAST_HIGHLIGHT[chroma-node-file] )); then
  17. if [[ "$__wrd" = debug || "$__wrd" = inspect ]]; then
  18. __style=${FAST_THEME_NAME}subcommand
  19. else
  20. FAST_HIGHLIGHT[chroma-node-file]=0
  21. if [[ -f ${~__wrd} || -f ${~__wrd}.js || -f ${~__wrd}/index.js ]]; then
  22. __style=${FAST_THEME_NAME}path
  23. else
  24. __style=${FAST_THEME_NAME}incorrect-subtle
  25. fi
  26. fi
  27. (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
  28. && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
  29. (( this_word = next_word ))
  30. _start_pos=$_end_pos
  31. return 0
  32. fi
  33. return 1