From 7e72e9ac87fc1c052726202f84a1e16466e06ad4 Mon Sep 17 00:00:00 2001 From: Blista Kanjo Date: Wed, 2 Aug 2023 22:22:54 -0400 Subject: feat: `zsh` fast-syntax-highlighting plugin --- .../zsh-fast-syntax-highlighting/:chroma/-alias.ch | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .config/shell/zsh-fast-syntax-highlighting/:chroma/-alias.ch (limited to '.config/shell/zsh-fast-syntax-highlighting/:chroma/-alias.ch') diff --git a/.config/shell/zsh-fast-syntax-highlighting/:chroma/-alias.ch b/.config/shell/zsh-fast-syntax-highlighting/:chroma/-alias.ch new file mode 100644 index 0000000..d581341 --- /dev/null +++ b/.config/shell/zsh-fast-syntax-highlighting/:chroma/-alias.ch @@ -0,0 +1,29 @@ +# 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" + +if (( __first_call )) || [[ "$2" = -* ]]; then + return 1 +else + if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then + return 1 + elif (( $+aliases[(e)$__wrd] )) || (( ${+galiases[(e)$__wrd]} )); then + (( __start=__start_pos-${#PREBUFFER}, __end=__start_pos+${#__wrd}-${#PREBUFFER}, __start >= 0 )) \ + && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}") + elif (( $+functions[(e)$__wrd] )) || (( $+builtins[(e)$__wrd] )) || (( $+commands[(e)$__wrd] )) || (( $reswords[(Ie)$__wrd] )); then + (( __start=__start_pos-${#PREBUFFER}, __end=__start_pos+${#__wrd}-${#PREBUFFER}, __start >= 0 )) \ + && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}incorrect-subtle]}") + else + return 1 + fi + if [[ "$__wrd" != "$2" ]]; then + return 1 + fi +fi + +(( this_word = next_word )) +_start_pos=$_end_pos + +return 0 -- cgit v1.2.3