diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b20826e1..30f5ee95 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ * @z-shell -* @ss-o \ No newline at end of file +* @ss-o diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..eb24a6e0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: /~https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: /~https://github.com/koalaman/shellcheck-precommit + rev: v0.8.0 + hooks: + - id: shellcheck +# args: ["--severity=warning"] diff --git a/README.md b/README.md index 8c63fb76..678c2661 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ [![Project license](https://img.shields.io/github/license/z-shell/zi.svg?style=flat-square)](LICENSE) [![Pull Requests welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg?style=flat-square)](/~https://github.com/z-shell/zi/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) - +
Table of Contents diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 2bddfd3b..49ed2cb1 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -41,4 +41,4 @@ that relate to your submission. You don't want to duplicate effort. 3. Create your feature branch (`git checkout -b feat/amazing_feature`) 4. Commit your changes (`git commit -m 'feat: add amazing_feature'`) Z-Shell ZI uses [conventional commits](https://www.conventionalcommits.org), so please follow the specification in your commit messages. 5. Push to the branch (`git push origin feat/amazing_feature`) -6. [Open a Pull Request](/~https://github.com/z-shell/zi/compare?expand=1) \ No newline at end of file +6. [Open a Pull Request](/~https://github.com/z-shell/zi/compare?expand=1) diff --git a/docs/images/logo.svg b/docs/images/logo.svg index 23d97404..3d275231 100644 --- a/docs/images/logo.svg +++ b/docs/images/logo.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/docs/man/zi.1 b/docs/man/zi.1 index ac9d805f..d13a0b73 100644 --- a/docs/man/zi.1 +++ b/docs/man/zi.1 @@ -907,4 +907,4 @@ Whant to learn more? See Z-Shell News Blog: \fBhttps://z-shell.github.io\fR .RE 0 -.P \ No newline at end of file +.P diff --git a/zinit-install.zsh b/zinit-install.zsh index 94a494b1..30351fc3 100644 --- a/zinit-install.zsh +++ b/zinit-install.zsh @@ -1,6 +1,8 @@ # -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors. +# shellcheck shell=bash disable=SC1009,1073,1027,1036,1072 + builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { builtin print -P "${ZINIT[col-error]}ERROR:%f%b Couldn't find ${ZINIT[col-obj]}zinit-side.zsh%f%b."; return 1; } # FUNCTION: .zinit-parse-json [[[ @@ -17,10 +19,9 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || { builtin print -P "${ZINIT integer ___nest=${4:-1} ___idx=0 ___pair_idx ___level=0 \ ___start ___end ___sidx=1 ___had_quoted_value=0 local -a match mbegin mend ___pair_order - (( ${(P)+___varname} )) || typeset -gA "$___varname" - ___pair_map=( "{" "}" "[" "]" ) + while [[ $___workbuf = (#b)[^"{}[]\\\"'":,]#((["{[]}\"'":,])|[\\](*))(*) ]]; do if [[ -n ${match[3]} ]] { ___idx+=${mbegin[1]} @@ -2278,4 +2279,4 @@ zimv() { ) } } -# ]]] \ No newline at end of file +# ]]] diff --git a/zinit.zsh b/zinit.zsh index e8b91c77..77df6467 100644 --- a/zinit.zsh +++ b/zinit.zsh @@ -1,6 +1,8 @@ # -*- mode: sh; sh-indentation: 4; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # Copyright (c) 2016-2020 Sebastian Gniazdowski and contributors. +# shellcheck shell=bash disable=SC1073,1072,1050 # Zsh + # # Main state variables. # @@ -251,12 +253,12 @@ builtin setopt noaliases # "Fpath elements" - ie those elements that are inside the plug-in directory. # The name comes from the fact that they are the selected fpath elements → so just - # "items". + # "items". local -a fpath_elements fpath_elements=( ${fpath[(r)$PLUGIN_DIR/*]} ) # Add a function subdirectory to items, if any (this action is - # according to the Plug Standard version 1.07 and later). + # according to the Plug Standard version 1.07 and later). [[ -d $PLUGIN_DIR/functions ]] && fpath_elements+=( "$PLUGIN_DIR"/functions ) if (( ${+opts[(r)-X]} )); then @@ -1893,22 +1895,22 @@ builtin setopt noaliases .zinit-formatter-pid() { builtin emulate -L zsh -o extendedglob - # Remember extreme whitespace. + # Remember extreme whitespace. local pbz=${(M)1##(#s)[[:space:]]##} local kbz=${(M)1%%[[:space:]]##(#e)} - # Remove extreme whitespace. + # Remove extreme whitespace. 1=${1//((#s)[[:space:]]##|[[:space:]]##(#e))/} ((${+functions[.zinit-first]})) || source ${ZINIT[BIN_DIR]}/zinit-side.zsh .zinit-any-colorify-as-uspl2 "$1"; # Replace at least one character with an unbreakable space, - # because extreme whitespace is lost due to implementation problems ... + # because extreme whitespace is lost due to implementation problems ... pbz=${pbz/[[:blank:]]/ } local kbz_rev="${(j::)${(@Oas::)kbz}}" kbz="${(j::)${(@Oas::)${kbz_rev/[[:blank:]]/ }}}" - # Supply extreme whitespace back. + # Supply extreme whitespace back. REPLY=$pbz$REPLY$kbz } # ]]] @@ -1970,7 +1972,7 @@ builtin setopt noaliases if [[ $2 == (b|u|it|st|nb|nu|nit|nst) ]]; then append=$ZINIT[col-$2] elif [[ $2 == (…|ndsh|mdsh|mmdsh|-…|lr|) || -z $2 || -z $ZINIT[col-$2] ]]; then - # Resume previous escape code, if stored. + # Resume previous escape code, if stored. if [[ $ZINIT[__last-formatter-code] != (…|ndsh|mdsh|mmdsh|-…|lr|rst|nl|) ]]; then in_prepend=$ZINIT[col-$ZINIT[__last-formatter-code]] influx=$ZINIT[col-$ZINIT[__last-formatter-code]] @@ -1984,7 +1986,7 @@ builtin setopt noaliases # Replace new lines with characters that work the same but are not # deleted in the substitution $ (...) - vertical tab 0xB ↔ 13 in the system - # octagonal connected back carriage (015). + # octagonal connected back carriage (015). local nl=$'\n' vertical=$'\013' carriager=$'\015' REPLY=${REPLY//$nl/$vertical$carriager} @@ -2011,7 +2013,7 @@ $(.zinit-main-message-formatter "$match[6]" "$match[7]" "$match[8]"; \ )${${ZINIT[__last-formatter-code]::=${${${match[7]:#(…|ndsh|mdsh|mmdsh|-…|lr)}:+\ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→} - # Restore the default color at the end of the message. + # Restore the default color at the end of the message. msg=$msg$ZINIT[col-rst] # Output the processed message: builtin print -Pr ${opt:#--} -- $msg