added alias chroma

This commit is contained in:
plexigras 2018-08-10 11:52:00 +02:00
parent ff660d69e9
commit 04569241ae
3 changed files with 29 additions and 1 deletions

27
chroma/-alias.ch Normal file
View file

@ -0,0 +1,27 @@
# 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 (( $+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

View file

@ -181,6 +181,7 @@ FAST_HIGHLIGHT+=(
chroma-ruby chroma/-ruby.ch
chroma-whatis chroma/-whatis.ch
chroma-man chroma/-whatis.ch
chroma-alias chroma/-alias.ch
)
# Assignments seen, to know if math parameter exists

View file

@ -299,7 +299,7 @@ autoload -Uz -- is-at-least fast-theme fast-read-ini-file -fast-run-git-command
autoload -Uz -- chroma/-git.ch chroma/-example.ch chroma/-grep.ch chroma/-perl.ch chroma/-make.ch \
chroma/-awk.ch chroma/-vim.ch chroma/-source.ch chroma/-sh.ch chroma/-docker.ch \
chroma/-autoload.ch chroma/-ssh.ch chroma/-scp.ch chroma/-which.ch chroma/-printf.ch \
chroma/-ruby.ch chroma/-whatis.ch
chroma/-ruby.ch chroma/-whatis.ch chroma/-alias.ch
source "${ZERO:h}/fast-highlight"
source "${ZERO:h}/fast-string-highlight"