mirror of
https://github.com/zdharma-continuum/fast-syntax-highlighting.git
synced 2026-09-10 07:16:18 -04:00
many: Rename autoload functions to follow the standard recommendations
See: http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html#namespacing
This commit is contained in:
parent
429ace63e4
commit
23033dfbf8
|
|
@ -61,7 +61,7 @@ local -a __lines_list
|
|||
if (( __idx1 == 2 )); then
|
||||
__style=${FAST_THEME_NAME}subcommand
|
||||
elif (( __idx1 == 3 )); then
|
||||
-fast-run-command "docker images -q" chroma-docker-list ""
|
||||
.fast-run-command "docker images -q" chroma-docker-list ""
|
||||
[[ -n "${__lines_list[(r)$__wrd]}" ]] && {
|
||||
(( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && \
|
||||
reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ fsh__git__chroma__def=(
|
|||
:chroma/-git-get-subcommands() {
|
||||
local __svalue
|
||||
integer __ivalue
|
||||
LANG=C -fast-run-command "git help -a" chroma-${FAST_HIGHLIGHT[chroma-current]}-subcmd-list "" $(( 15 * 60 ))
|
||||
LANG=C .fast-run-command "git help -a" chroma-${FAST_HIGHLIGHT[chroma-current]}-subcmd-list "" $(( 15 * 60 ))
|
||||
if [[ "${__lines_list[1]}" = See* ]]; then
|
||||
# (**)
|
||||
# git >= v2.20, the aliases in the `git help -a' command
|
||||
|
|
@ -646,7 +646,7 @@ fsh__git__chroma__def=(
|
|||
# This allows to check if the command is an alias - we want to
|
||||
# highlight the aliased command just like the target command of
|
||||
# the alias
|
||||
-fast-run-command "+git config --get-regexp 'alias.*'" chroma-${FAST_HIGHLIGHT[chroma-current]}-alias-list "[[:space:]]#alias." $(( 15 * 60 ))
|
||||
.fast-run-command "+git config --get-regexp 'alias.*'" chroma-${FAST_HIGHLIGHT[chroma-current]}-alias-list "[[:space:]]#alias." $(( 15 * 60 ))
|
||||
fi
|
||||
|
||||
__tmp=${#__lines_list}
|
||||
|
|
@ -660,7 +660,7 @@ fsh__git__chroma__def=(
|
|||
# A generic handler
|
||||
:chroma/-git-verify-remote() {
|
||||
local _wrd="$4"
|
||||
-fast-run-git-command "git remote" "chroma-git-remotes-$PWD" "" $(( 2 * 60 ))
|
||||
.fast-run-git-command "git remote" "chroma-git-remotes-$PWD" "" $(( 2 * 60 ))
|
||||
[[ -n ${__lines_list[(r)$_wrd]} ]] && {
|
||||
__style=${FAST_THEME_NAME}correct-subtle; return 0
|
||||
} || {
|
||||
|
|
@ -672,7 +672,7 @@ fsh__git__chroma__def=(
|
|||
:chroma/-git-verify-ref() {
|
||||
local _wrd="$4"
|
||||
_wrd="${_wrd%%:*}"
|
||||
-fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-refs-$PWD" "refs/heads" $(( 2 * 60 ))
|
||||
.fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-refs-$PWD" "refs/heads" $(( 2 * 60 ))
|
||||
[[ -n ${__lines_list[(r)$_wrd]} ]] && \
|
||||
{ __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
|
||||
{ __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
|
||||
|
|
@ -759,7 +759,7 @@ fsh__git__chroma__def=(
|
|||
|
||||
:chroma/-git-verify-branch() {
|
||||
local _wrd="$4"
|
||||
-fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches-$PWD" "refs/heads" $(( 2 * 60 ))
|
||||
.fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches-$PWD" "refs/heads" $(( 2 * 60 ))
|
||||
[[ -n ${__lines_list[(r)$_wrd]} ]] && \
|
||||
{ __style=${FAST_THEME_NAME}correct-subtle; return 0; } || \
|
||||
{ __style=${FAST_THEME_NAME}incorrect-subtle; return 1; }
|
||||
|
|
@ -767,10 +767,10 @@ fsh__git__chroma__def=(
|
|||
|
||||
:chroma/-git-verify-also-unfetched-ref() {
|
||||
local _wrd="$4"
|
||||
-fast-run-git-command "git config --get checkout.defaultRemote" \
|
||||
.fast-run-git-command "git config --get checkout.defaultRemote" \
|
||||
"chroma-git-defaultRemote-$PWD" "" $(( 2 * 60 ))
|
||||
local remote="${__lines_list[1]:-origin}"
|
||||
-fast-run-git-command "git rev-list --count --no-walk
|
||||
.fast-run-git-command "git rev-list --count --no-walk
|
||||
--glob=\"refs/remotes/$remote/$_wrd\"" \
|
||||
"chroma-git-unfetched-ref-$PWD" "" $(( 2 * 60 ))
|
||||
|
||||
|
|
@ -811,7 +811,7 @@ fsh__git__chroma__def=(
|
|||
:chroma/-git-verify-commit() {
|
||||
local _wrd="$4"
|
||||
__lines_list=()
|
||||
-fast-run-git-command "git rev-parse --verify --quiet \"$_wrd\"" "chroma-git-commits-$PWD-$_wrd" "" $(( 1.5 * 60 ))
|
||||
.fast-run-git-command "git rev-parse --verify --quiet \"$_wrd\"" "chroma-git-commits-$PWD-$_wrd" "" $(( 1.5 * 60 ))
|
||||
if (( ${#__lines_list} )); then
|
||||
__style=${FAST_THEME_NAME}correct-subtle
|
||||
return 0
|
||||
|
|
@ -861,7 +861,7 @@ fsh__git__chroma__def=(
|
|||
|
||||
:chroma/-git-verify-tag-name() {
|
||||
local _wrd="$4"
|
||||
-fast-run-git-command "git tag" "chroma-git-tags-$PWD" "" $(( 2*60 ))
|
||||
.fast-run-git-command "git tag" "chroma-git-tags-$PWD" "" $(( 2*60 ))
|
||||
[[ -n ${__lines_list[(r)$_wrd]} ]] && \
|
||||
__style=${FAST_THEME_NAME}correct-subtle || \
|
||||
__style=${FAST_THEME_NAME}incorrect-subtle
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
|
|||
fi
|
||||
|
||||
if [[ "$__wrd" != -* ]] && (( FAST_HIGHLIGHT[chroma-git-got-subcommand] == 0 )); then
|
||||
-fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 5 * 60 ))
|
||||
.fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 5 * 60 ))
|
||||
# Grep for line: alias.{user-entered-subcmd}[[:space:]], and remove alias. prefix
|
||||
__lines_list=( ${${(M)__lines_list[@]:#alias.${__wrd}[[:space:]]##*}#alias.} )
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ if (( in_redirection > 0 || this_word & 128 )) || [[ $__wrd == "<<<" ]]; then
|
|||
fi
|
||||
|
||||
if [[ "$__wrd" != -* ]] && (( FAST_HIGHLIGHT[chroma-git-got-subcommand] == 0 )); then
|
||||
-fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 5 * 60 ))
|
||||
.fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 5 * 60 ))
|
||||
# Grep for line: alias.{user-entered-subcmd}[[:space:]], and remove alias. prefix
|
||||
__lines_list=( ${${(M)__lines_list[@]:#alias.${__wrd}[[:space:]]##*}#alias.} )
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ local -a __lines_list reply2
|
|||
__wrd="${(Q)__wrd}"
|
||||
|
||||
if [[ -f "${FAST_HIGHLIGHT[chroma-make-custom-dir]%/}/${FAST_HIGHLIGHT[chroma-make-custom-file]}" ]] && \
|
||||
-fast-make-targets < "${FAST_HIGHLIGHT[chroma-make-custom-dir]%/}/${FAST_HIGHLIGHT[chroma-make-custom-file]}"
|
||||
.fast-make-targets < "${FAST_HIGHLIGHT[chroma-make-custom-dir]%/}/${FAST_HIGHLIGHT[chroma-make-custom-file]}"
|
||||
then
|
||||
if [[ "${reply2[(r)$__wrd]}" ]]; then
|
||||
(( __start=__start_pos-${#PREBUFFER}, __end=__end_pos-${#PREBUFFER}, __start >= 0 )) && reply+=("$__start $__end ${FAST_HIGHLIGHT_STYLES[${FAST_THEME_NAME}correct-subtle]}")
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ else
|
|||
|
||||
# Check if the command is an alias - we want to highlight the
|
||||
# aliased command just like the target command of the alias
|
||||
-fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 10 * 60 ))
|
||||
.fast-run-command "git config --get-regexp 'alias.*'" chroma-git-alias-list "" $(( 10 * 60 ))
|
||||
# Grep for line: alias.{user-entered-subcmd}[[:space:]], and remove alias. prefix
|
||||
__lines_list=( ${${(M)__lines_list[@]:#alias.${__wrd}[[:space:]]##*}#alias.} )
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ else
|
|||
fi
|
||||
if (( __start_pos >= 0 )); then
|
||||
# if subcommand exists
|
||||
LANG=C -fast-run-command "git help -a" chroma-git-subcmd-list "" $(( 10 * 60 ))
|
||||
LANG=C .fast-run-command "git help -a" chroma-git-subcmd-list "" $(( 10 * 60 ))
|
||||
# (s: :) will split on every space, but because the expression
|
||||
# isn't double-quoted, the empty elements will be eradicated
|
||||
# Some further knowledge-base: s-flag is special, it skips
|
||||
|
|
@ -144,10 +144,10 @@ else
|
|||
if [[ "$__wrd" != -* || "${FAST_HIGHLIGHT[chrome-git-occurred-double-hyphen]}" -eq 1 ]]; then
|
||||
(( FAST_HIGHLIGHT[chroma-git-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-git-counter] ))
|
||||
if (( __idx1 == 2 )); then
|
||||
-fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
.fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
else
|
||||
__wrd="${__wrd%%:*}"
|
||||
-fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
.fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
fi
|
||||
# if remote/ref exists
|
||||
if [[ -n ${__lines_list[(r)$__wrd]} ]]; then
|
||||
|
|
@ -173,7 +173,7 @@ else
|
|||
fi
|
||||
elif (( ${FAST_HIGHLIGHT[chroma-git-fetch-multiple]} )) \
|
||||
&& [[ "$__wrd" != -* || "${FAST_HIGHLIGHT[chrome-git-occurred-double-hyphen]}" -eq 1 ]]; then
|
||||
-fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
.fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
if [[ -n ${__lines_list[(r)$__wrd]} ]]; then
|
||||
__style=${FAST_THEME_NAME}correct-subtle
|
||||
fi
|
||||
|
|
@ -283,12 +283,12 @@ else
|
|||
__style=${FAST_THEME_NAME}incorrect-subtle
|
||||
fi
|
||||
elif [[ "$__idx1" = 3 && "$FAST_HIGHLIGHT[chroma-git-remote-subcommand]" = "add" ]]; then
|
||||
-fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
.fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
if [[ -n ${__lines_list[(r)$__wrd]} ]]; then
|
||||
__style=${FAST_THEME_NAME}incorrect-subtle
|
||||
fi
|
||||
elif [[ "$__idx1" = 3 && -n "$FAST_HIGHLIGHT[chroma-git-remote-subcommand]" ]]; then
|
||||
-fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
.fast-run-git-command "git remote" "chroma-git-remotes" ""
|
||||
if [[ -n ${__lines_list[(r)$__wrd]} ]]; then
|
||||
__style=${FAST_THEME_NAME}correct-subtle
|
||||
else
|
||||
|
|
@ -305,7 +305,7 @@ else
|
|||
FAST_HIGHLIGHT[chroma-git-branch-change]=1
|
||||
return 1
|
||||
elif [[ "$__wrd" != -* ]]; then
|
||||
-fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
.fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
if [[ -n ${__lines_list[(r)$__wrd]} ]]; then
|
||||
__style=${FAST_THEME_NAME}correct-subtle
|
||||
elif (( FAST_HIGHLIGHT[chroma-git-branch-change] )); then
|
||||
|
|
@ -328,8 +328,8 @@ else
|
|||
if [[ "$__wrd" != -* ]]; then
|
||||
(( FAST_HIGHLIGHT[chroma-git-counter] += 1, __idx1 = FAST_HIGHLIGHT[chroma-git-counter] ))
|
||||
if [[ ${FAST_HIGHLIGHT[chroma-git-counter]} -eq 2 ]]; then
|
||||
-fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
-fast-run-git-command "+git tag" "chroma-git-tags" ""
|
||||
.fast-run-git-command "git for-each-ref --format='%(refname:short)' refs/heads" "chroma-git-branches" "refs/heads"
|
||||
.fast-run-git-command "+git tag" "chroma-git-tags" ""
|
||||
[[ -n ${__lines_list[(r)$__wrd]} ]] && __style=${FAST_THEME_NAME}incorrect-subtle
|
||||
elif [[ ${FAST_HIGHLIGHT[chroma-git-counter]} -eq 3 ]]; then
|
||||
fi
|
||||
|
|
@ -346,7 +346,7 @@ else
|
|||
return 1;
|
||||
;;
|
||||
(3)
|
||||
-fast-run-git-command "git tag" "chroma-git-tags" ""
|
||||
.fast-run-git-command "git tag" "chroma-git-tags" ""
|
||||
[[ -n ${__lines_list[(r)$__wrd]} ]] && \
|
||||
__style=${FAST_THEME_NAME}correct-subtle || \
|
||||
__style=${FAST_THEME_NAME}incorrect-subtle
|
||||
|
|
|
|||
|
|
@ -319,8 +319,8 @@ ZSH_HIGHLIGHT_MAXLENGTH=10000
|
|||
zmodload zsh/parameter 2>/dev/null
|
||||
zmodload zsh/system 2>/dev/null
|
||||
|
||||
autoload -Uz -- is-at-least fast-theme fast-read-ini-file -fast-run-git-command -fast-make-targets \
|
||||
-fast-run-command -fast-zts-read-all
|
||||
autoload -Uz -- is-at-least fast-theme .fast-read-ini-file .fast-run-git-command \
|
||||
.fast-make-targets .fast-run-command .fast-zts-read-all
|
||||
autoload -Uz -- :chroma/-git.ch :chroma/-hub.ch :chroma/-lab.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 \
|
||||
|
|
|
|||
|
|
@ -234,13 +234,13 @@ if [[ "$1" = */* || "$1" = (XDG|LOCAL|HOME|OPT):* ]]; then
|
|||
[[ ! -r "$1" ]] && { print -u2 "Theme \`$1' unreadable, aborting"; return 1; }
|
||||
|
||||
THEME_NAME="${1:t:r}"
|
||||
fast-read-ini-file "$1" out ""
|
||||
.fast-read-ini-file "$1" out ""
|
||||
else
|
||||
[[ ! -f "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "No such theme \`$1', aborting"; return 1; }
|
||||
[[ ! -r "$FAST_BASE_DIR/themes/$1.ini" ]] && { print -u2 "Theme \`$1' unreadable, aborting"; return 1; }
|
||||
|
||||
THEME_NAME="$1"
|
||||
fast-read-ini-file "$FAST_BASE_DIR/themes/$1.ini" out ""
|
||||
.fast-read-ini-file "$FAST_BASE_DIR/themes/$1.ini" out ""
|
||||
fi
|
||||
|
||||
[[ -z "$OPT_SECONDARY" ]] && { [[ "$THEME_NAME" = *"overlay"* ]] && local outfile="theme_overlay.zsh" || local outfile="current_theme.zsh"; } || local outfile="secondary_theme.zsh"
|
||||
|
|
|
|||
Loading…
Reference in a new issue