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.

40 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="${(Q)2}" __start_pos="$3" __end_pos="$4"
  5. local __style
  6. if (( __first_call )); then
  7. FAST_HIGHLIGHT[chroma-fast-theme-first]=0
  8. return 1
  9. elif (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
  10. return 1
  11. elif (( ${FAST_HIGHLIGHT[chroma-fast-theme-first]} )) || [[ $__wrd = -* ]]; then
  12. return 1
  13. else
  14. FAST_HIGHLIGHT[chroma-fast-theme-first]=1
  15. fi
  16. if [[ "$__wrd" = */* || "$__wrd" = (XDG|LOCAL|HOME|OPT):* ]]; then
  17. __wrd="${${__wrd/(#s)XDG:/${${XDG_CONFIG_HOME:-$HOME/.config}%/}/fsh/}%.ini}.ini"
  18. __wrd="${${__wrd/(#s)LOCAL://usr/local/share/fsh/}%.ini}.ini"
  19. __wrd="${${__wrd/(#s)HOME:/$HOME/.fsh/}%.ini}.ini"
  20. __wrd="${${__wrd/(#s)OPT://opt/local/share/fsh/}%.ini}.ini"
  21. __wrd=${~__wrd} # allow user to quote ~
  22. else
  23. __wrd="$FAST_BASE_DIR/themes/$__wrd.ini"
  24. fi
  25. if [[ -f $__wrd ]]; then
  26. __style=${FAST_THEME_NAME}path
  27. else
  28. __style=${FAST_THEME_NAME}incorrect-subtle
  29. fi
  30. (( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) \
  31. && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[$__style]}")
  32. (( this_word = next_word ))
  33. _start_pos=$_end_pos
  34. return 0