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.

29 lines
1.1 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. if (( __first_call )) || [[ "$2" = -* ]]; then
  6. return 1
  7. else
  8. if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
  9. return 1
  10. elif (( $+aliases[(e)$__wrd] )) || (( ${+galiases[(e)$__wrd]} )); then
  11. (( __start=__start_pos-${#PREBUFFER}, __end=__start_pos+${#__wrd}-${#PREBUFFER}, __start >= 0 )) \
  12. && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
  13. elif (( $+functions[(e)$__wrd] )) || (( $+builtins[(e)$__wrd] )) || (( $+commands[(e)$__wrd] )) || (( $reswords[(Ie)$__wrd] )); then
  14. (( __start=__start_pos-${#PREBUFFER}, __end=__start_pos+${#__wrd}-${#PREBUFFER}, __start >= 0 )) \
  15. && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}")
  16. else
  17. return 1
  18. fi
  19. if [[ "$__wrd" != "$2" ]]; then
  20. return 1
  21. fi
  22. fi
  23. (( this_word = next_word ))
  24. _start_pos=$_end_pos
  25. return 0