From 3c3a2238413dd1ff4d135b4116d5ad18c0a1b4bf Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Sun, 14 Nov 2021 21:42:32 +0100 Subject: [PATCH 01/27] Overengineer the installer --- .github/workflows/installer.yaml | 116 +++++++++ doc/install.sh | 394 ++++++++++++++++++++++--------- 2 files changed, 392 insertions(+), 118 deletions(-) create mode 100644 .github/workflows/installer.yaml diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml new file mode 100644 index 000000000..110a76e9a --- /dev/null +++ b/.github/workflows/installer.yaml @@ -0,0 +1,116 @@ +name: zinit installer +on: [push, workflow_dispatch] + +jobs: + zinit-installer: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + # TODO: macOS (jobs hang...) + # TODO: Windows... + # os: [ubuntu-latest, macos-11] + # os: [ubuntu-latest, macos-latest, windows-latest] + annexes: ["with-annexes", "without-annexes"] + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Grab git slugs (short commit id, branch etc.) + uses: rlespinasse/github-slug-action@v3.x + + - name: Install dependencies (ubuntu) + if: startsWith(matrix.os, 'ubuntu-latest') + run: | + sudo apt-get update + sudo apt-get install -y curl git zsh + + - name: Install dependencies (macOS) + if: startsWith(matrix.os, 'macos') + run: | + brew install curl git zsh + + - name: Install zinit (with annexes) + if: matrix.annexes == 'with-annexes' + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + sh -x ./doc/install.sh + + - name: Install zinit (w/o annexes) + if: matrix.annexes == 'without-annexes' + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + export NO_ANNEXES=true + + sh -x ./doc/install.sh + + - name: Upload zshrc and zinit files + uses: actions/upload-artifact@v2 + with: + name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }} + path: | + /home/runner/.zshrc + /home/runner/.local/share/zinit + + - name: Test zinit install + run: | + export TERM=xterm + zsh -silc 'zinit --help; exit $?' + + # TODO: DRY! + # Re-using steps in GH Actions is a pain though. + zinit-updater: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + # TODO: macOS (jobs hang...) + # TODO: Windows... + # os: [ubuntu-latest, macos-11] + # os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Grab git slugs (short commit id, branch etc.) + uses: rlespinasse/github-slug-action@v3.x + + - name: Install dependencies (ubuntu) + if: startsWith(matrix.os, 'ubuntu-latest') + run: | + sudo apt-get update + sudo apt-get install -y curl git zsh + + - name: Install dependencies (macOS) + if: startsWith(matrix.os, 'macos') + run: | + brew install curl git zsh + + - name: Install previous zinit version (${{ github.event.before }}) + env: + PREVIOUS_COMMIT: ${{ github.event.before }} + run: | + export ZINIT_COMMIT="$PREVIOUS_COMMIT" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + ./doc/install.sh + + - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + ./doc/install.sh diff --git a/doc/install.sh b/doc/install.sh index f7a9e80ba..cb61a9631 100755 --- a/doc/install.sh +++ b/doc/install.sh @@ -1,161 +1,319 @@ -#!/bin/sh +#!/usr/bin/env sh -# -# Clone or pull -# +{ # Colors + COLOR_RESET='' + COLOR_BLUE='' + COLOR_BOLD_RED='' + COLOR_BOLD_GREEN='' + COLOR_BOLD_YELLOW='' + COLOR_BOLD_BLUE='' + COLOR_BOLD_MAGENTA='' + COLOR_BOLD_CYAN='' +} -ZINIT_HOME="${ZINIT_HOME:-$ZPLG_HOME}" -if [ -z "$ZINIT_HOME" ]; then - ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit" -fi +echo_fancy() { + emoji="$1" + color="$2" + shift 2 -ZINIT_BIN_DIR_NAME="${ZINIT_BIN_DIR_NAME:-$ZPLG_BIN_DIR_NAME}" -if [ -z "$ZINIT_BIN_DIR_NAME" ]; then - ZINIT_BIN_DIR_NAME="zinit.git" -fi + msg="" + # prepend emoji, unless NO_EMOJI is set + if [ -z "$NO_EMOJI" ]; then + msg="$emoji" + fi -if ! test -d "$ZINIT_HOME"; then - mkdir -p "$ZINIT_HOME" - chmod g-w "$ZINIT_HOME" - chmod o-w "$ZINIT_HOME" -fi + # wrap every word in color (needed in case there are custom colors in + # the message itself), unless NO_COLOR is set + for str in "$@" + do + # FIXME: NO_COLOR only applies if there are no colors in the msg + if [ -z "$NO_COLOR" ]; then + msg="${msg}${color}" + fi + msg="${msg}${str}" + done + + # Actual output + echo "${msg}${COLOR_RESET}" >&2 + # fake "local" vars + unset emoji color str msg +} + +echo_info() { + echo_fancy "πŸ”΅" "${COLOR_BOLD_BLUE}" "INFO: ${*}" +} + +echo_success() { + echo_fancy "βœ…" "${COLOR_BOLD_GREEN}" "SUCCESS: ${*}" +} -if ! command -v git >/dev/null 2>&1; then - echo "β–“β–’β–‘ Something went wrong: git is not available, cannot proceed." +echo_warn() { + echo_fancy "🚧" "${COLOR_BOLD_YELLOW}" "WARNING: ${*}" +} + +echo_error() { + echo_fancy "❌" "${COLOR_BOLD_RED}" "ERROR: ${*}" +} + +check_dependencies() { + if ! command -v git >/dev/null 2>&1; then + echo_error "${COLOR_BOLD_GREEN}git${COLOR_RESET} is not installed" exit 1 -fi + fi +} -ZINIT_BRANCH="${ZINIT_BRANCH:-master}" -ZINIT_TMPDIR="$(mktemp -d)" # use -d instead of --directory for macos (BSD) compatibility -if [ ! -d "$ZINIT_TMPDIR" ]; then - echo "Tempdir creation failed. This ain't good." >&2 +show_environment() { + echo_info "About to setup zinit from $ZINIT_REPO" \ + "(branch: $ZINIT_BRANCH - commit: ${ZINIT_COMMIT:-N/A})" \ + "to ${ZINIT_INSTALL_DIR}" +} + +create_zinit_home() { + if ! test -d "${ZINIT_HOME}"; then + mkdir -p "${ZINIT_HOME}" + chmod g-w "${ZINIT_HOME}" + chmod o-w "${ZINIT_HOME}" + fi +} + +create_zinit_tmpdir() { + # use -d instead of --directory for macos (BSD) compatibility + ZINIT_TMPDIR="$(mktemp -d)" + if [ ! -d "$ZINIT_TMPDIR" ]; then + echo_error "Tempdir creation failed. This ain't good" exit 1 -fi + fi + + trap 'rm -rvf "$ZINIT_TMPDIR"' EXIT INT +} # Get the download-progress bar tool -GIT_PROCESS_SCRIPT_URL="https://raw.githubusercontent.com/zdharma-continuum/zinit/${ZINIT_BRANCH}/git-process-output.zsh" -trap 'rm -rvf "$ZINIT_TMPDIR"' EXIT INT -if command -v curl >/dev/null 2>&1; then - curl -fsSL -o "${ZINIT_TMPDIR}/git-process-output.zsh" "$GIT_PROCESS_SCRIPT_URL" -elif command -v wget >/dev/null 2>&1; then - wget -q -O "${ZINIT_TMPDIR}/git-process-output.zsh" "$GIT_PROCESS_SCRIPT_URL" -fi -chmod a+x "${ZINIT_TMPDIR}/git-process-output.zsh" 2>/dev/null +download_git_output_processor() { + url="https://raw.githubusercontent.com/${ZINIT_REPO}/${ZINIT_COMMIT:-${ZINIT_BRANCH}}/git-process-output.zsh" + script_path="${ZINIT_TMPDIR}/git-process-output.zsh" -echo -if test -d "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME/.git"; then - cd "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME" || { echo "Failed to cd to $ZINIT_HOME/$ZINIT_BIN_DIR_NAME" >&2; exit 1; } - echo "β–“β–’β–‘ Updating ZDHARMA-CONTINUUM Initiative Plugin Manager to $ZINIT_HOME/$ZINIT_BIN_DIR_NAME" - git pull origin "${ZINIT_BRANCH}" -else - cd "$ZINIT_HOME" || { echo "Failed to cd to $ZINIT_HOME" >&2; exit 1; } - echo "β–“β–’β–‘ Installing ZDHARMA-CONTINUUM Initiative Plugin Manager to $ZINIT_HOME/$ZINIT_BIN_DIR_NAME" - { - git clone --progress --branch "$ZINIT_BRANCH" \ - https://github.com/zdharma-continuum/zinit.git \ - "$ZINIT_BIN_DIR_NAME" 2>&1 | { - "${ZINIT_TMPDIR}/git-process-output.zsh" || cat; - } - } 2>/dev/null - if [ -d "$ZINIT_BIN_DIR_NAME" ]; then - echo - echo "β–“β–’β–‘ Zinit succesfully installed at $ZINIT_HOME/$ZINIT_BIN_DIR_NAME". - VERSION="$(command git -C "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME" describe --tags 2>/dev/null)" - echo "β–“β–’β–‘ Version: $VERSION" - else - echo - echo "β–“β–’β–‘ Something went wrong, couldn't install Zinit to $ZINIT_HOME/$ZINIT_BIN_DIR_NAME" - fi -fi + echo_info "Fetching git-process-output.zsh from $url" + if command -v curl >/dev/null 2>&1; then + curl -fsSL -o "$script_path" "$url" + elif command -v wget >/dev/null 2>&1; then + wget -q -O "$script_path" "$url" + fi + + # shellcheck disable=2181 + if [ "$?" -eq 0 ] + then + echo_success 'Download finished!' + else + echo_warn "Download failed." + fi + + chmod a+x "$script_path" 2>/dev/null + unset url script_path +} + +zinit_git_exec() { + command git -C "${ZINIT_INSTALL_DIR}" "$@" +} + +zinit_checkout_ref() { + ref="${ZINIT_BRANCH}" + git_obj_type="branch" + + if [ -n "$ZINIT_COMMIT" ] + then + ref="$ZINIT_COMMIT" + git_obj_type="commit" + fi + + if zinit_git_exec checkout "$ref" >/dev/null 2>&1; then + echo_success "Checked out $git_obj_type $ref" + else + echo_error "Failed to check out $git_obj_type $ref" + fi + + unset ref git_obj_type +} + +zinit_current_version() { + zinit_git_exec describe --tags 2>/dev/null +} + +zinit_update() { + cd "${ZINIT_INSTALL_DIR}" || { + echo_error "Failed to cd to ${ZINIT_INSTALL_DIR}" + exit 1 + } + + echo_info "Updating ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} in" \ + "in ${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}" + { # Clean up repo + zinit_git_exec clean -d -f -f + zinit_git_exec reset --hard HEAD + } >/dev/null 2>&1 + + # fetch our branch (to ensure the target commit exists locally) + zinit_git_exec fetch origin "$ZINIT_BRANCH" + + zinit_checkout_ref + if zinit_git_exec pull origin "$ZINIT_BRANCH"; then + echo_success "Updated zinit to $(zinit_current_version)" + fi +} + +zinit_install() { + cd "${ZINIT_HOME}" || { + echo_error "Failed to cd to ${ZINIT_HOME}" + exit 1 + } + + echo_info "Installing ${COLOR_BOLD_CYAN}zinit${COLOR_RESET} to " \ + "${COLOR_BOLD_MAGENTA}${ZINIT_INSTALL_DIR}" + { + command git clone --progress --branch "$ZINIT_BRANCH" \ + "https://github.com/${ZINIT_REPO}" \ + "${ZINIT_REPO_DIR_NAME}" 2>&1 | { + "${ZINIT_TMPDIR}/git-process-output.zsh" || cat; + } + } 2>/dev/null + + zinit_checkout_ref + + if [ -d "${ZINIT_REPO_DIR_NAME}" ]; then + echo_success "Zinit succesfully installed to " \ + "${COLOR_BOLD_GREEN}${ZINIT_INSTALL_DIR}" + echo_info "Zinit Version: ${COLOR_BOLD_GREEN}$(zinit_current_version)" + else + echo_error "Failed to install Zinit to ${COLOR_BOLD_YELLOW}${ZINIT_INSTALL_DIR}" + fi +} -# # Modify .zshrc -# -THE_ZDOTDIR="${ZDOTDIR:-$HOME}" -RCUPDATE=1 -if grep -E '(zinit|zplugin)\.zsh' "$THE_ZDOTDIR/.zshrc" >/dev/null 2>&1; then - echo "β–“β–’β–‘ .zshrc already contains \`zinit …' commands – not making changes." - RCUPDATE=0 -fi +edit_zshrc() { + rc_update=1 + if grep -E '(zinit|zplugin)\.zsh' "${ZSHRC}" >/dev/null 2>&1; then + echo_warn "${ZSHRC} already contains zinit commands. Not making any changes." + rc_update=0 + fi -if [ $RCUPDATE -eq 1 ]; then - echo "β–“β–’β–‘ Updating $THE_ZDOTDIR/.zshrc (10 lines of code, at the bottom)" - ZINIT_HOME="$(echo "$ZINIT_HOME" | sed "s|$HOME|\$HOME|")" - command cat <<-EOF >> "$THE_ZDOTDIR/.zshrc" + if [ $rc_update -eq 1 ]; then + echo_info "Updating ${ZSHRC} (10 lines of code, at the bottom)" + zinit_home_escaped="$(echo "${ZINIT_HOME}" | sed "s|$HOME|\$HOME|")" + command cat <<-EOF >> "$ZSHRC" ### Added by Zinit's installer -if [[ ! -f $ZINIT_HOME/$ZINIT_BIN_DIR_NAME/zinit.zsh ]]; then - print -P "%F{33}β–“β–’β–‘ %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" - command mkdir -p "$ZINIT_HOME" && command chmod g-rwX "$ZINIT_HOME" - command git clone https://github.com/zdharma-continuum/zinit "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME" && \\ +if [[ ! -f ${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh ]]; then + print -P "%F{33}β–“β–’β–‘ %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}${ZINIT_REPO}%F{220})…%f" + command mkdir -p "${zinit_home_escaped}" && command chmod g-rwX "${zinit_home_escaped}" + command git clone https://github.com/${ZINIT_REPO} "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}" && \\ print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" || \\ print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" fi -source "$ZINIT_HOME/$ZINIT_BIN_DIR_NAME/zinit.zsh" +source "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh" autoload -Uz _zinit (( \${+_comps} )) && _comps[zinit]=_zinit EOF - file="$(mktemp)" - command cat <<-EOF >>"$file" + fi + + unset rc_update zinit_home_escaped +} + +query_for_annexes() { + zshrc_annex_file="$(mktemp)" + command cat <<-EOF >>"$zshrc_annex_file" # Load a few important annexes, without Turbo # (this is currently required for annexes) zinit light-mode for \\ - zdharma-continuum/zinit-annex-rust \\ zdharma-continuum/zinit-annex-as-monitor \\ + zdharma-continuum/zinit-annex-bin-gem-node \\ zdharma-continuum/zinit-annex-patch-dl \\ - zdharma-continuum/zinit-annex-bin-gem-node + zdharma-continuum/zinit-annex-rust EOF -echo -echo "β–“β–’β–‘ Would you like to add 4 useful plugins" \ - "- the most useful annexes (Zinit extensions that add new" \ - "functions-features to the plugin manager) to the zshrc as well?" \ - "It will be the following snippet:" - command cat "$file" - printf "β–“β–’β–‘ Enter y/n and press Return: " - read -r input - if [ "$input" = y ] || [ "$input" = Y ]; then - command cat "$file" >> "$THE_ZDOTDIR"/.zshrc - echo - echo "β–“β–’β–‘ Done." - echo - else - echo - echo "β–“β–’β–‘ Done (skipped the annexes chunk)." - echo - fi + # Ask user if we should add the annexes to his zshrc + # If NO_INPUT is set, but NO_ANNEXES is the annexes bit gets appended to the + # config (ie. default to yes if NO_INPUT, unless NO_ANNEXES) + reply=n + if [ -n "$NO_INPUT" ] + then + [ -z "$NO_ANNEXES" ] && reply=y + else + echo "β–“β–’β–‘${COLOR_RESET} Would you like to add 4 useful plugins" \ + "- the most useful annexes (Zinit extensions that add new" \ + "functions-features to the plugin manager) to the zshrc as well?" \ + "It will be the following snippet:" + command cat "$zshrc_annex_file" + printf "β–“β–’β–‘${COLOR_RESET} Enter y/n and press Return: " + read -r reply + fi - command cat <<-EOF >> "$THE_ZDOTDIR/.zshrc" + if [ "$reply" = y ] || [ "$reply" = Y ]; then + command cat "$zshrc_annex_file" >> "$ZSHRC" + echo_success 'Done!' + else + echo_warning "Skipped the annexes." + fi + + command cat <<-EOF >> "$ZSHRC" ### End of Zinit's installer chunk EOF -fi + unset reply zshrc_annex_file +} -command cat <<-EOF -β–“β–’β–‘ A quick intro to Zinit: below are all the available Zinit -β–“β–’β–‘ ice-modifiers, grouped by their role by different colors): -β–“β–’β–‘ -β–“β–’β–‘ id-as'' as'' from'' wait'' trigger-load'' load'' unload'' -β–“β–’β–‘ pick'' src'' multisrc'' pack'' param'' extract'' atclone'' -β–“β–’β–‘ atpull'' atload'' atinit'' make'' mv'' cp'' reset'' -β–“β–’β–‘ countdown'' compile'' nocompile'' nocd'' if'' has'' -β–“β–’β–‘ cloneopts'' depth'' proto'' on-update-of'' subscribe'' -β–“β–’β–‘ bpick'' cloneonly'' service'' notify'' wrap-track'' -β–“β–’β–‘ bindmap'' atdelete'' ver'' +display_tutorial() { + command cat <<-EOF -β–“β–’β–‘ No-value (flag-only) ices: -β–“β–’β–‘ svn git silent lucid light-mode is-snippet blockf nocompletions -β–“β–’β–‘ run-atpull reset-prompt trackbinds aliases sh bash ksh csh +${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} A quick intro to Zinit: below are all the available Zinit +${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} ice-modifiers, grouped by their role by different colors): +${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} +β–“β–’β–‘${COLOR_RESET} id-as'' as'' from'' wait'' trigger-load'' load'' unload'' +β–“β–’β–‘${COLOR_RESET} pick'' src'' multisrc'' pack'' param'' ${COLOR_RESET}extract'' atclone'' +β–“β–’β–‘${COLOR_RESET} atpull'' atload'' atinit'' make'' mv'' cp'' reset'' +β–“β–’β–‘${COLOR_RESET} countdown'' compile'' nocompile'' ${COLOR_RESET}nocd'' if'' has'' +β–“β–’β–‘${COLOR_RESET} cloneopts'' depth'' proto'' on-update-of'' subscribe'' +β–“β–’β–‘${COLOR_RESET} bpick'' cloneonly'' service'' notify'' wrap-track'' +β–“β–’β–‘${COLOR_RESET} bindmap'' atdelete'' ver'' + +${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} No-value (flag-only) ices: +β–“β–’β–‘${COLOR_RESET} svn git silent lucid ${COLOR_RESET}light-mode is-snippet blockf nocompletions +β–“β–’β–‘${COLOR_RESET} run-atpull reset-prompt trackbinds aliases sh bash ksh csh${COLOR_RESET} For more information see: -- The zdharma-continuum GitHub organization, which hosts zinit and all related components +- The zdharma-continuum${COLOR_RESET} GitHub organization, which hosts zinit and all related components - https://github.com/zdharma-continuum -- README section on the ice-modifiers: - - https://github.com/zdharma-continuum/zinit#ice-modifiers -- An introduction to Zinit on the wiki: +- README${COLOR_RESET} section on the ice-modifiers: + - https://github.com/${ZINIT_REPO}#ice-modifiers +- An introduction${COLOR_RESET} to Zinit on the wiki: - https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ -- For-Syntax article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: +- For-Syntax${COLOR_RESET} article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: - https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ EOF +} + +ZINIT_REPO="${ZINIT_REPO:-zdharma-continuum/zinit}" +ZINIT_BRANCH="${ZINIT_BRANCH:-master}" +ZINIT_COMMIT="${ZINIT_COMMIT:-}" # no default value +ZINIT_HOME="${ZINIT_HOME:-${XDG_DATA_HOME:-${HOME}/.local/share}/zinit}" +ZINIT_REPO_DIR_NAME="${ZINIT_REPO_DIR_NAME:-zinit.git}" +ZINIT_INSTALL_DIR=${ZINIT_INSTALL_DIR:-${ZINIT_HOME}/${ZINIT_REPO_DIR_NAME}} +ZSHRC="${ZDOTDIR:-$HOME}/.zshrc" + +show_environment +check_dependencies +create_zinit_home +create_zinit_tmpdir +download_git_output_processor + +if [ -d "${ZINIT_INSTALL_DIR}/.git" ]; then + zinit_update +else + zinit_install +fi + +edit_zshrc +query_for_annexes +display_tutorial + +# vim: set ft=sh et ts=2 sw=2 : From c4d30495919e2cf2e74d5dd64d3dd59eb70494cc Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 19:56:52 +0100 Subject: [PATCH 02/27] Fix #60: Move the installer to scripts/ --- .github/workflows/installer.yaml | 8 ++++---- README.md | 2 +- {doc => scripts}/install.sh | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename {doc => scripts}/install.sh (100%) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 110a76e9a..01013f879 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -39,7 +39,7 @@ jobs: export ZINIT_BRANCH="$GITHUB_REF_SLUG" export NO_INPUT=true - sh -x ./doc/install.sh + sh -x ./scripts/install.sh - name: Install zinit (w/o annexes) if: matrix.annexes == 'without-annexes' @@ -50,7 +50,7 @@ jobs: export NO_INPUT=true export NO_ANNEXES=true - sh -x ./doc/install.sh + sh -x ./scripts/install.sh - name: Upload zshrc and zinit files uses: actions/upload-artifact@v2 @@ -104,7 +104,7 @@ jobs: export ZINIT_BRANCH="$GITHUB_REF_SLUG" export NO_INPUT=true - ./doc/install.sh + ./scripts/install.sh - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} run: | @@ -113,4 +113,4 @@ jobs: export ZINIT_BRANCH="$GITHUB_REF_SLUG" export NO_INPUT=true - ./doc/install.sh + ./scripts/install.sh diff --git a/README.md b/README.md index 9b6c3157d..b5fbb478e 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ read it to get the most out of Zinit. The easiest way to install Zinit is to execute: ```zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/doc/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/install.sh)" ``` This will install Zinit in `~/.zinit/bin`. diff --git a/doc/install.sh b/scripts/install.sh similarity index 100% rename from doc/install.sh rename to scripts/install.sh From e7a007aa74667e7d6d4ae850aef8654833192fb4 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 20:02:30 +0100 Subject: [PATCH 03/27] Add NO_EDIT and NO_TUTORIAL to skip resp. the zshrc edits or the tutorial --- scripts/install.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index cb61a9631..fa80aa4c2 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -292,13 +292,14 @@ For more information see: EOF } +# Globals. Can be overridden. ZINIT_REPO="${ZINIT_REPO:-zdharma-continuum/zinit}" ZINIT_BRANCH="${ZINIT_BRANCH:-master}" ZINIT_COMMIT="${ZINIT_COMMIT:-}" # no default value ZINIT_HOME="${ZINIT_HOME:-${XDG_DATA_HOME:-${HOME}/.local/share}/zinit}" ZINIT_REPO_DIR_NAME="${ZINIT_REPO_DIR_NAME:-zinit.git}" ZINIT_INSTALL_DIR=${ZINIT_INSTALL_DIR:-${ZINIT_HOME}/${ZINIT_REPO_DIR_NAME}} -ZSHRC="${ZDOTDIR:-$HOME}/.zshrc" +ZSHRC="${ZSHRC:-${ZDOTDIR:-${HOME}/.zshrc}}" show_environment check_dependencies @@ -312,8 +313,15 @@ else zinit_install fi -edit_zshrc -query_for_annexes -display_tutorial +if [ -z "$NO_EDIT" ] +then + edit_zshrc + query_for_annexes +fi + +if [ -z "$NO_TUTORIAL" ] +then + display_tutorial +fi # vim: set ft=sh et ts=2 sw=2 : From ac892821baff0456c510712d86c6d7f08816e4ff Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 20:07:31 +0100 Subject: [PATCH 04/27] Update default paths --- README.md | 24 ++++++++++++------------ doc/zinit.1 | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index b5fbb478e..dc68e2395 100644 --- a/README.md +++ b/README.md @@ -150,7 +150,7 @@ The easiest way to install Zinit is to execute: sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/install.sh)" ``` -This will install Zinit in `~/.zinit/bin`. +This will install Zinit in `~/.local/share/zinit/zinit.git`. `.zshrc` will be updated with three lines of code that will be added to the bottom. The lines will be sourcing `zinit.zsh` and setting up completion for command `zinit`. @@ -158,17 +158,17 @@ After installing and reloading the shell compile Zinit with `zinit self-update`. ### Manual Installation -To manually install Zinit clone the repo to e.g. `~/.zinit/bin`: +To manually install Zinit clone the repo to e.g. `~/.local/share/zinit/zinit.git`: ```sh -mkdir ~/.zinit -git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin +mkdir -p ~/.local/share/zinit +git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/zinit.git ``` and source it from `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)): ```sh -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/zinit.git/zinit.zsh ``` If you place the `source` below `compinit`, then add those two lines after the `source`: @@ -920,7 +920,7 @@ after `compinit` will be called (and the original `compdef` function will become available), to execute all detected `compdef` calls. To summarize: ```zsh -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/zinit.git/zinit.zsh zinit load "some/plugin" ... @@ -963,7 +963,7 @@ helper functions (`zicompinit`,`zicdreplay` & `zicdclear` – see below for expl of the last one). To summarize: ```zsh -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/zinit.git/zinit.zsh # Load using the for-syntax zinit wait lucid for \ @@ -982,7 +982,7 @@ before commands loading other plugins or snippets, and issue `zinit cdclear` (or `zicdclear`, designed to be used in hooks like `atload''`): ```zsh -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/zinit.git/zinit.zsh zinit snippet OMZP::git zinit cdclear -q # <- forget completions provided by Git plugin @@ -1081,8 +1081,8 @@ declare -A ZINIT # initial Zinit's hash definition, if configuring before loadi | Hash Field | Description | | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.zinit/bin" | -| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.zinit" | +| ZINIT\[BIN_DIR\] | Where Zinit code resides, e.g.: "~/.local/share/zinit/zinit.git" | +| ZINIT\[HOME_DIR\] | Where Zinit should create all working directories, e.g.: "~/.local/share/zinit" | | ZINIT\[MAN_DIR\] | Directory where plugins can store their manpages (`atclone"cp -vf myplugin.1 $ZINIT[MAN_DIR]/man1"`). If overridden, this directory will not necessarily be used by `man` (See #8). Default: `$ZPFX/man` | | ZINIT\[PLUGINS_DIR\] | Override single working directory – for plugins, e.g. "/opt/zsh/zinit/plugins" | | ZINIT\[COMPLETIONS_DIR\] | As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" | @@ -1092,7 +1092,7 @@ declare -A ZINIT # initial Zinit's hash definition, if configuring before loadi | ZINIT\[MUTE_WARNINGS\] | If set to `1`, then mutes some of the Zinit warnings, specifically the `plugin already registered` warning | | ZINIT\[OPTIMIZE_OUT_DISK_ACCESSES\] | If set to `1`, then Zinit will skip checking if a Turbo-loaded object exists on the disk. By default Zinit skips Turbo for non-existing objects (plugins or snippets) to install them before the first prompt – without any delays, during the normal processing of `zshrc`. This option can give a performance gain of about 10 ms out of 150 ms (i.e.: Zsh will start up in 140 ms instead of 150 ms). | -There is also `$ZPFX`, set by default to `~/.zinit/polaris` – a directory +There is also `$ZPFX`, set by default to `~/.local/share/zinit/polaris` – a directory where software with `Makefile`, etc. can be pointed to, by e.g. `atclone'./configure --prefix=$ZPFX'`. ## Non-GitHub (Local) Plugins @@ -1135,7 +1135,7 @@ zinit as"null" wait"1" lucid for \ ``` -Target directory for installed files is `$ZPFX` (`~/.zinit/polaris` by default). +Target directory for installed files is `$ZPFX` (`~/.local/share/zinit/polaris` by default). # Supporting diff --git a/doc/zinit.1 b/doc/zinit.1 index e8fe331c5..8b315a1a5 100644 --- a/doc/zinit.1 +++ b/doc/zinit.1 @@ -321,15 +321,15 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/ma .fi .RE .P -This will install zinit in \fB~/.zinit/bin\fR. \fB.zshrc\fR will be updated with three lines of code that will be added to the bottom. The lines will be sourcing \fBzinit.zsh\fR and setting up completion for command \fBzinit\fR. After installing and reloading the shell compile zinit with \fBzinit self-update\fR. +This will install zinit in \fB~/.local/share/zinit/bin\fR. \fB.zshrc\fR will be updated with a few lines of code that will be added to the bottom. The lines will be sourcing \fBzinit.zsh\fR and setting up completion for command \fBzinit\fR. After installing and reloading the shell compile zinit with \fBzinit self-update\fR. .SS "Option 2 - Manual Installation" .P -To manually install zinit clone the repo to e.g. \fB~/.zinit/bin\fR: +To manually install zinit clone the repo to e.g. \fB~/.local/share/zinit/bin\fR: .P .RS 2 .nf -mkdir ~/.zinit -git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin +mkdir ~/.local/share/zinit +git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/bin .fi .RE .P @@ -337,7 +337,7 @@ and source it from \fB.zshrc\fR (above compinit): .P .RS 2 .nf -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/bin/zinit.zsh .fi .RE .P @@ -715,7 +715,7 @@ compinit\fR. This should be done after loading of all plugins and before possibl .P .RS 2 .nf -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/bin/zinit.zsh zinit load "some/plugin" ... @@ -751,7 +751,7 @@ If you want to ignore compdefs provided by some plugins or snippets, place their .P .RS 2 .nf -source ~/.zinit/bin/zinit.zsh +source ~/.local/share/zinit/bin/zinit.zsh zinit snippet OMZ::plugins/git/git.plugin.zsh zinit cdclear -q # <- forget completions provided by Git plugin @@ -832,8 +832,8 @@ tab(@); cb cb l l . Hash Field@Description -ZPLGM\fBBIN_DIR\fR@Β Where zinit code resides, e.g.: "~/.zinit/bin" -ZPLGM\fBHOME_DIR\fR@Β Where zinit should create all working directories, e.g.: "~/.zinit" +ZPLGM\fBBIN_DIR\fR@Β Where zinit code resides, e.g.: "~/.local/share/zinit/bin" +ZPLGM\fBHOME_DIR\fR@Β Where zinit should create all working directories, e.g.: "~/.local/share/zinit" ZPLGM\fBPLUGINS_DIR\fR@Override single working directory \[en] for plugins, e.g. "/opt/zsh/zinit/plugins" ZPLGM\fBCOMPLETIONS_DIR\fR@As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" ZPLGM\fBSNIPPETS_DIR\fR@Β As above, but for snippets @@ -842,7 +842,7 @@ ZPLGM\fBCOMPINIT_OPTS\fR@Options for \fBcompinit\fR call (i.e. done by \fBzpcomp ZPLGM\fBMUTE_WARNINGS\fR@If set to \fB1\fR, then mutes some of the zinit warnings, specifically the \fBplugin already registered\fR warning .TE .P -There is also \fB$ZPFX\fR, set by default to \fB~/.zinit/polaris\fR \[en] a directory where software with \fBMakefile\fR, etc. can be pointed to, by e.g. \fBatclone'./configure --prefix=$ZPFX'\fR. +There is also \fB$ZPFX\fR, set by default to \fB~/.local/share/zinit/polaris\fR \[en] a directory where software with \fBMakefile\fR, etc. can be pointed to, by e.g. \fBatclone'./configure --prefix=$ZPFX'\fR. .SS "Non-GitHub (Local) Plugins" .P Use \fBcreate\fR subcommand with user name \fB_local\fR (the default) to create plugin's skeleton in \fB$ZPLGM\[lB]PLUGINS_DIR\[rB]\fR. It will be not connected with GitHub repository (because of user name being \fB_local\fR). To enter the plugin's directory use \fBcd\fR command with just plugin's name (without \fB_local\fR, it's optional). @@ -880,7 +880,7 @@ zinit light k4rthik/git-cal .fi .RE .P -Target directory for installed files is \fB$ZPFX\fR (\fB~/.zinit/polaris\fR by default). +Target directory for installed files is \fB$ZPFX\fR (\fB~/.local/share/zinit/polaris\fR by default). .SS "Preinstalling Plugins" .P If you create a Docker image that uses zinit, or want to install Turbo-loaded plugins before the shell starts interactively, you can invoke the zinit-scheduler function in such a way, that it: From 32d67c4f3da212d2d2389a8aef7cfad7945adbd0 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 20:09:24 +0100 Subject: [PATCH 05/27] Move mod-install.sh to scripts/ --- README.md | 2 +- doc/zinit.1 | 2 +- {doc => scripts}/mod-install.sh | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {doc => scripts}/mod-install.sh (100%) diff --git a/README.md b/README.md index dc68e2395..012bfe2b9 100644 --- a/README.md +++ b/README.md @@ -1035,7 +1035,7 @@ To install just the binary Zinit module **standalone** (Zinit is not needed, the other plugin manager), execute: ```zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/doc/mod-install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/mod-install.sh)" ``` This script will display what to add to `~/.zshrc` (2 lines) and show usage instructions. diff --git a/doc/zinit.1 b/doc/zinit.1 index 8b315a1a5..d5dd21aac 100644 --- a/doc/zinit.1 +++ b/doc/zinit.1 @@ -788,7 +788,7 @@ To install just the binary zinit module \fBstandalone\fR (zinit is not needed, t .P .RS 2 .nf -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/mod-install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/scripts/mod-install.sh)" .fi .RE .P diff --git a/doc/mod-install.sh b/scripts/mod-install.sh similarity index 100% rename from doc/mod-install.sh rename to scripts/mod-install.sh From 0742fe925a5ccd7270594f97b377d09a41836afb Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 20:12:52 +0100 Subject: [PATCH 06/27] Only chmod +x the git output script if it was downloaded --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index fa80aa4c2..6733f636c 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -102,12 +102,12 @@ download_git_output_processor() { # shellcheck disable=2181 if [ "$?" -eq 0 ] then + chmod a+x "$script_path" 2>/dev/null echo_success 'Download finished!' else echo_warn "Download failed." fi - chmod a+x "$script_path" 2>/dev/null unset url script_path } From c27252c9833983243bdf29a6c818abf344df0540 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:09:51 +0100 Subject: [PATCH 07/27] Remove the last remaining inline color escape sequences --- scripts/install.sh | 59 +++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 6733f636c..3a25b1d9a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,13 +2,23 @@ { # Colors COLOR_RESET='' - COLOR_BLUE='' COLOR_BOLD_RED='' COLOR_BOLD_GREEN='' COLOR_BOLD_YELLOW='' COLOR_BOLD_BLUE='' COLOR_BOLD_MAGENTA='' COLOR_BOLD_CYAN='' + + # The over-the-top fancy ones + COLOR_PALE_MAGENTA='' + COLOR_PALE_BLUE='' + COLOR_ORANGE='' + COLOR_CYAN_ISH='' + COLOR_PALE_YELLOW='' + COLOR_PALE_MAGENTA='' + COLOR_PALE_GREEN='' + COLOR_PALE_BROWN='' + COLOR_BOLD_WHITE_ON_BLACK='' } echo_fancy() { @@ -202,11 +212,11 @@ edit_zshrc() { ### Added by Zinit's installer if [[ ! -f ${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh ]]; then - print -P "%F{33}β–“β–’β–‘ %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}${ZINIT_REPO}%F{220})…%f" + print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}${ZINIT_REPO}%F{220})…%f" command mkdir -p "${zinit_home_escaped}" && command chmod g-rwX "${zinit_home_escaped}" command git clone https://github.com/${ZINIT_REPO} "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}" && \\ - print -P "%F{33}β–“β–’β–‘ %F{34}Installation successful.%f%b" || \\ - print -P "%F{160}β–“β–’β–‘ The clone has failed.%f%b" + print -P "%F{33} %F{34}Installation successful.%f%b" || \\ + print -P "%F{160} The clone has failed.%f%b" fi source "${zinit_home_escaped}/${ZINIT_REPO_DIR_NAME}/zinit.zsh" @@ -239,12 +249,13 @@ EOF then [ -z "$NO_ANNEXES" ] && reply=y else - echo "β–“β–’β–‘${COLOR_RESET} Would you like to add 4 useful plugins" \ + echo "${COLOR_PALE_MAGENTA}${COLOR_RESET} Would you like to add 4 useful plugins" \ "- the most useful annexes (Zinit extensions that add new" \ "functions-features to the plugin manager) to the zshrc as well?" \ "It will be the following snippet:" command cat "$zshrc_annex_file" - printf "β–“β–’β–‘${COLOR_RESET} Enter y/n and press Return: " + # shellcheck disable=2059 + printf "${COLOR_PALE_MAGENTA}${COLOR_RESET} Enter y/n and press Return: " read -r reply fi @@ -265,29 +276,29 @@ EOF display_tutorial() { command cat <<-EOF -${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} A quick intro to Zinit: below are all the available Zinit -${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} ice-modifiers, grouped by their role by different colors): -${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} -β–“β–’β–‘${COLOR_RESET} id-as'' as'' from'' wait'' trigger-load'' load'' unload'' -β–“β–’β–‘${COLOR_RESET} pick'' src'' multisrc'' pack'' param'' ${COLOR_RESET}extract'' atclone'' -β–“β–’β–‘${COLOR_RESET} atpull'' atload'' atinit'' make'' mv'' cp'' reset'' -β–“β–’β–‘${COLOR_RESET} countdown'' compile'' nocompile'' ${COLOR_RESET}nocd'' if'' has'' -β–“β–’β–‘${COLOR_RESET} cloneopts'' depth'' proto'' on-update-of'' subscribe'' -β–“β–’β–‘${COLOR_RESET} bpick'' cloneonly'' service'' notify'' wrap-track'' -β–“β–’β–‘${COLOR_RESET} bindmap'' atdelete'' ver'' - -${COLOR_BLUE}β–“β–’β–‘${COLOR_RESET} No-value (flag-only) ices: -β–“β–’β–‘${COLOR_RESET} svn git silent lucid ${COLOR_RESET}light-mode is-snippet blockf nocompletions -β–“β–’β–‘${COLOR_RESET} run-atpull reset-prompt trackbinds aliases sh bash ksh csh${COLOR_RESET} +A quick intro to Zinit: below are all the available Zinit +ice-modifiers, grouped by role (color groups): + +id-as'' as'' from'' ${COLOR_PALE_BLUE}wait'' trigger-load'' load'' unload'' +${COLOR_CYAN_ISH}pick'' src'' multisrc'' ${COLOR_ORANGE}pack'' param'' ${COLOR_RESET}extract'' ${COLOR_PALE_YELLOW}atclone'' +${COLOR_PALE_YELLOW}atpull'' atload'' atinit'' make'' mv'' cp'' reset'' +${COLOR_PALE_YELLOW}countdown'' ${COLOR_PALE_RED}compile'' nocompile'' ${COLOR_RESET}nocd'' ${COLOR_PALE_MAGENTA}if'' has'' +${COLOR_PALE_BROWN}cloneopts'' depth'' proto'' ${COLOR_PALE_GREEN}on-update-of'' subscribe'' +bpick'' cloneonly'' service'' notify'' wrap-track'' +bindmap'' atdelete'' ver'' + +Value-less (flag-only) ices: +${COLOR_PALE_YELLOW}svn git ${COLOR_PALE_GREEN}silent lucid ${COLOR_RESET}light-mode is-snippet blockf nocompletions +run-atpull reset-prompt trackbinds aliases ${COLOR_PALE_BLUE}sh bash ksh csh${COLOR_RESET} For more information see: -- The zdharma-continuum${COLOR_RESET} GitHub organization, which hosts zinit and all related components +- The ${COLOR_BOLD_WHITE_ON_BLACK}zdharma-continuum${COLOR_RESET} GitHub organization, which hosts zinit and all related components - https://github.com/zdharma-continuum -- README${COLOR_RESET} section on the ice-modifiers: +- ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers: - https://github.com/${ZINIT_REPO}#ice-modifiers -- An introduction${COLOR_RESET} to Zinit on the wiki: +- ${COLOR_BOLD_WHITE_ON_BLACK}An introduction${COLOR_RESET} to Zinit on the wiki: - https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ -- For-Syntax${COLOR_RESET} article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: +- ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: - https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ EOF } From dd704137e5d4b08b5b3bd5bdb809fa20a086a6e6 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:13:58 +0100 Subject: [PATCH 08/27] We need more emojis. --- scripts/install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 3a25b1d9a..38b057963 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -276,8 +276,8 @@ EOF display_tutorial() { command cat <<-EOF -A quick intro to Zinit: below are all the available Zinit -ice-modifiers, grouped by role (color groups): +🌻 Here's a quick intro to Zinit. Below are all the available Zinit +ice-modifiers, grouped by role (color): id-as'' as'' from'' ${COLOR_PALE_BLUE}wait'' trigger-load'' load'' unload'' ${COLOR_CYAN_ISH}pick'' src'' multisrc'' ${COLOR_ORANGE}pack'' param'' ${COLOR_RESET}extract'' ${COLOR_PALE_YELLOW}atclone'' @@ -293,13 +293,13 @@ run-atpull reset-prompt trackbinds aliases ${COLOR_PALE_BLUE}sh bash ksh csh${CO For more information see: - The ${COLOR_BOLD_WHITE_ON_BLACK}zdharma-continuum${COLOR_RESET} GitHub organization, which hosts zinit and all related components - - https://github.com/zdharma-continuum + - πŸ”– https://github.com/zdharma-continuum - ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers: - - https://github.com/${ZINIT_REPO}#ice-modifiers + - 🧊 https://github.com/${ZINIT_REPO}#ice-modifiers - ${COLOR_BOLD_WHITE_ON_BLACK}An introduction${COLOR_RESET} to Zinit on the wiki: - - https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ + - πŸ“š https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ - ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: - - https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ + - πŸ“– https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ EOF } From 5253de61798136e492e616227451ecdda0426e98 Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Mon, 15 Nov 2021 14:29:55 -0600 Subject: [PATCH 09/27] Update scripts/install.sh --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 38b057963..0b35a87af 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -241,7 +241,7 @@ zinit light-mode for \\ zdharma-continuum/zinit-annex-rust EOF - # Ask user if we should add the annexes to his zshrc + # Ask user if we should add the annexes to their zshrc # If NO_INPUT is set, but NO_ANNEXES is the annexes bit gets appended to the # config (ie. default to yes if NO_INPUT, unless NO_ANNEXES) reply=n From 4c2b461344722b5ff4aa1bcc8abcbb951a7abf5a Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:31:26 +0100 Subject: [PATCH 10/27] Update tutorial section --- scripts/install.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 0b35a87af..d6008b7f8 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -276,18 +276,19 @@ EOF display_tutorial() { command cat <<-EOF -🌻 Here's a quick intro to Zinit. Below are all the available Zinit -ice-modifiers, grouped by role (color): +🌻 Welcome! Here's a quick intro to Zinit. + +Below are all the available Zinit ice-modifiers, grouped by role (color): id-as'' as'' from'' ${COLOR_PALE_BLUE}wait'' trigger-load'' load'' unload'' ${COLOR_CYAN_ISH}pick'' src'' multisrc'' ${COLOR_ORANGE}pack'' param'' ${COLOR_RESET}extract'' ${COLOR_PALE_YELLOW}atclone'' -${COLOR_PALE_YELLOW}atpull'' atload'' atinit'' make'' mv'' cp'' reset'' -${COLOR_PALE_YELLOW}countdown'' ${COLOR_PALE_RED}compile'' nocompile'' ${COLOR_RESET}nocd'' ${COLOR_PALE_MAGENTA}if'' has'' +atpull'' atload'' atinit'' make'' mv'' cp'' reset'' +countdown'' ${COLOR_PALE_RED}compile'' nocompile'' ${COLOR_RESET}nocd'' ${COLOR_PALE_MAGENTA}if'' has'' ${COLOR_PALE_BROWN}cloneopts'' depth'' proto'' ${COLOR_PALE_GREEN}on-update-of'' subscribe'' bpick'' cloneonly'' service'' notify'' wrap-track'' bindmap'' atdelete'' ver'' -Value-less (flag-only) ices: +🏁 Value-less (flag-only) ices: ${COLOR_PALE_YELLOW}svn git ${COLOR_PALE_GREEN}silent lucid ${COLOR_RESET}light-mode is-snippet blockf nocompletions run-atpull reset-prompt trackbinds aliases ${COLOR_PALE_BLUE}sh bash ksh csh${COLOR_RESET} @@ -296,10 +297,13 @@ For more information see: - πŸ”– https://github.com/zdharma-continuum - ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers: - 🧊 https://github.com/${ZINIT_REPO}#ice-modifiers -- ${COLOR_BOLD_WHITE_ON_BLACK}An introduction${COLOR_RESET} to Zinit on the wiki: +- An ${COLOR_BOLD_WHITE_ON_BLACK}introduction${COLOR_RESET} to Zinit on the wiki: - πŸ“š https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ -- ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki; it is less directly related to the ices but it explains how to use them conveniently: +- The ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki, which hilights some best practises: - πŸ“– https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ + +πŸ’ Need help? +- You can get in touch with us on Gitter: https://gitter.im/zdharma-continuum EOF } From 3d8ac200a94ff3ebe61d8f03e53580af3ff96a05 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:41:12 +0100 Subject: [PATCH 11/27] XDG-ify ZINIT_HOME --- README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 012bfe2b9..c4c8a044b 100644 --- a/README.md +++ b/README.md @@ -161,14 +161,16 @@ After installing and reloading the shell compile Zinit with `zinit self-update`. To manually install Zinit clone the repo to e.g. `~/.local/share/zinit/zinit.git`: ```sh -mkdir -p ~/.local/share/zinit -git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/zinit.git +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +mkdir -p "$(dirname $ZINIT_HOME)" +git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" ``` -and source it from `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)): +and source `zinit.zsh` from your `.zshrc` (above [compinit](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization)): ```sh -source ~/.local/share/zinit/zinit.git/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" ``` If you place the `source` below `compinit`, then add those two lines after the `source`: @@ -920,7 +922,8 @@ after `compinit` will be called (and the original `compdef` function will become available), to execute all detected `compdef` calls. To summarize: ```zsh -source ~/.local/share/zinit/zinit.git/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" zinit load "some/plugin" ... @@ -963,7 +966,8 @@ helper functions (`zicompinit`,`zicdreplay` & `zicdclear` – see below for expl of the last one). To summarize: ```zsh -source ~/.local/share/zinit/zinit.git/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share/zinit}" +source "${ZINIT_HOME}/zinit.zsh" # Load using the for-syntax zinit wait lucid for \ @@ -982,7 +986,9 @@ before commands loading other plugins or snippets, and issue `zinit cdclear` (or `zicdclear`, designed to be used in hooks like `atload''`): ```zsh -source ~/.local/share/zinit/zinit.git/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" + zinit snippet OMZP::git zinit cdclear -q # <- forget completions provided by Git plugin From 52ab2fc220e7e66a4c7ef265239d710ca881a70a Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:42:58 +0100 Subject: [PATCH 12/27] XDG-ify ZINIT_HOME in manpage --- doc/zinit.1 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/zinit.1 b/doc/zinit.1 index d5dd21aac..7db8fbebd 100644 --- a/doc/zinit.1 +++ b/doc/zinit.1 @@ -328,8 +328,9 @@ To manually install zinit clone the repo to e.g. \fB~/.local/share/zinit/bin\fR: .P .RS 2 .nf -mkdir ~/.local/share/zinit -git clone https://github.com/zdharma-continuum/zinit.git ~/.local/share/zinit/bin +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +mkdir -p "$(dirname $ZINIT_HOME)" +git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" .fi .RE .P @@ -337,7 +338,8 @@ and source it from \fB.zshrc\fR (above compinit): .P .RS 2 .nf -source ~/.local/share/zinit/bin/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" .fi .RE .P @@ -751,7 +753,9 @@ If you want to ignore compdefs provided by some plugins or snippets, place their .P .RS 2 .nf -source ~/.local/share/zinit/bin/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" + zinit snippet OMZ::plugins/git/git.plugin.zsh zinit cdclear -q # <- forget completions provided by Git plugin From 0c425c656dfa859eb559264e1c771ad342c731d2 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:53:08 +0100 Subject: [PATCH 13/27] =?UTF-8?q?=F0=9F=94=AA=20Shorten=20the=20tutorial?= =?UTF-8?q?=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/install.sh | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index d6008b7f8..55b19bdc0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -10,14 +10,7 @@ COLOR_BOLD_CYAN='' # The over-the-top fancy ones - COLOR_PALE_MAGENTA='' - COLOR_PALE_BLUE='' - COLOR_ORANGE='' - COLOR_CYAN_ISH='' - COLOR_PALE_YELLOW='' COLOR_PALE_MAGENTA='' - COLOR_PALE_GREEN='' - COLOR_PALE_BROWN='' COLOR_BOLD_WHITE_ON_BLACK='' } @@ -276,34 +269,20 @@ EOF display_tutorial() { command cat <<-EOF -🌻 Welcome! Here's a quick intro to Zinit. - -Below are all the available Zinit ice-modifiers, grouped by role (color): - -id-as'' as'' from'' ${COLOR_PALE_BLUE}wait'' trigger-load'' load'' unload'' -${COLOR_CYAN_ISH}pick'' src'' multisrc'' ${COLOR_ORANGE}pack'' param'' ${COLOR_RESET}extract'' ${COLOR_PALE_YELLOW}atclone'' -atpull'' atload'' atinit'' make'' mv'' cp'' reset'' -countdown'' ${COLOR_PALE_RED}compile'' nocompile'' ${COLOR_RESET}nocd'' ${COLOR_PALE_MAGENTA}if'' has'' -${COLOR_PALE_BROWN}cloneopts'' depth'' proto'' ${COLOR_PALE_GREEN}on-update-of'' subscribe'' -bpick'' cloneonly'' service'' notify'' wrap-track'' -bindmap'' atdelete'' ver'' - -🏁 Value-less (flag-only) ices: -${COLOR_PALE_YELLOW}svn git ${COLOR_PALE_GREEN}silent lucid ${COLOR_RESET}light-mode is-snippet blockf nocompletions -run-atpull reset-prompt trackbinds aliases ${COLOR_PALE_BLUE}sh bash ksh csh${COLOR_RESET} - -For more information see: -- The ${COLOR_BOLD_WHITE_ON_BLACK}zdharma-continuum${COLOR_RESET} GitHub organization, which hosts zinit and all related components - - πŸ”– https://github.com/zdharma-continuum -- ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers: - - 🧊 https://github.com/${ZINIT_REPO}#ice-modifiers -- An ${COLOR_BOLD_WHITE_ON_BLACK}introduction${COLOR_RESET} to Zinit on the wiki: - - πŸ“š https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ +🌻 ${COLOR_BOLD_WHITE_ON_BLACK}Welcome!${COLOR_RESET} + +Now to get started you can check out the following: + +- The ${COLOR_BOLD_WHITE_ON_BLACK}README${COLOR_RESET} section on the ice-modifiers: + 🧊 https://github.com/${ZINIT_REPO}#ice-modifiers +- There's also an ${COLOR_BOLD_WHITE_ON_BLACK}introduction${COLOR_RESET} to Zinit on the wiki: + πŸ“š https://zdharma-continuum.github.io/zinit/wiki/INTRODUCTION/ - The ${COLOR_BOLD_WHITE_ON_BLACK}For-Syntax${COLOR_RESET} article on the wiki, which hilights some best practises: - - πŸ“– https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ + πŸ“– https://zdharma-continuum.github.io/zinit/wiki/For-Syntax/ πŸ’ Need help? -- You can get in touch with us on Gitter: https://gitter.im/zdharma-continuum +- πŸ’¬ Get in touch with us on Gitter: https://gitter.im/zdharma-continuum +- πŸ”– Or on GitHub: https://github.com/zdharma-continuum EOF } From 428d71822986fcca0575ef637387aee01f53842f Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 21:58:17 +0100 Subject: [PATCH 14/27] ZPLG -> ZINIT --- doc/zinit.1 | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/doc/zinit.1 b/doc/zinit.1 index 7db8fbebd..deed19a49 100644 --- a/doc/zinit.1 +++ b/doc/zinit.1 @@ -120,7 +120,7 @@ New ice-mods \fBsh\fR,\fBbash\fR,\fBksh\fR,\fBcsh\fR that load plugins (and snip .RS 2 .nf zinit ice bash pick"bash_it.sh" \[rs] - atinit"BASH_IT=${ZPLGM\[lB]PLUGINS_DIR\[rB]}/Bash-it---bash-it" \[rs] + atinit"BASH_IT=${ZINIT\[lB]PLUGINS_DIR\[rB]}/Bash-it---bash-it" \[rs] atclone"yes n | ./install.sh" zinit load Bash-it/bash-it .fi @@ -172,7 +172,7 @@ The unloading of Zle widgets is now more smart \[en] it takes into account the c .RS 4 .IP \(bu 4 \fB--all\fR \[en] deletes all plugins and snippets (a purge, similar to \fBrm -rf -${ZPLGM\[lB]PLUGINS_DIR\[rB]} ${ZPLGM\[lB]SNIPPETS_DIR\[rB]}\fR) +${ZINIT\[lB]PLUGINS_DIR\[rB]} ${ZINIT\[lB]SNIPPETS_DIR\[rB]}\fR) .IP \(bu 4 \fB--clean\fR \[en] deletes only plugins and snippets that are \fBcurrently not loaded\fR in the current session. .RE 0 @@ -321,10 +321,10 @@ sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/ma .fi .RE .P -This will install zinit in \fB~/.local/share/zinit/bin\fR. \fB.zshrc\fR will be updated with a few lines of code that will be added to the bottom. The lines will be sourcing \fBzinit.zsh\fR and setting up completion for command \fBzinit\fR. After installing and reloading the shell compile zinit with \fBzinit self-update\fR. +This will install zinit in \fB~/.local/share/zinit/zinit.git\fR. \fB.zshrc\fR will be updated with a few lines of code that will be added to the bottom. The lines will be sourcing \fBzinit.zsh\fR and setting up completion for command \fBzinit\fR. After installing and reloading the shell compile zinit with \fBzinit self-update\fR. .SS "Option 2 - Manual Installation" .P -To manually install zinit clone the repo to e.g. \fB~/.local/share/zinit/bin\fR: +To manually install zinit clone the repo to e.g. \fB~/.local/share/zinit/zinit.git\fR: .P .RS 2 .nf @@ -376,7 +376,7 @@ zinit load zdharma/history-search-multi-word zinit ice pick"async.zsh" src"pure.zsh" zinit light sindresorhus/pure -# Binary release in archive, from GitHub-releases page. +# Binary release in archive, from GitHub-releases page. # After automatic unpacking it provides program "fzf". zinit ice from"gh-r" as"program" zinit load junegunn/fzf-bin @@ -446,12 +446,12 @@ tab(@); cb cb c l . Modifier@Description -\fBproto\fR@ Change protocol to \fBgit\fR,\fBftp\fR,\fBftps\fR,\fBssh\fR, \fBrsync\fR, etc. Default is \fBhttps\fR. \fBDoes not work with snippets.\fR +\fBproto\fR@ Change protocol to \fBgit\fR,\fBftp\fR,\fBftps\fR,\fBssh\fR, \fBrsync\fR, etc. Default is \fBhttps\fR. \fBDoes not work with snippets.\fR \fBfrom\fR@ Clone plugin from given site. Supported are \fBfrom"github"\fR (default), \fB..."github-rel"\fR, \fB..."gitlab"\fR, \fB..."bitbucket"\fR, \fB..."notabug"\fR (short names: \fBgh\fR, \fBgh-r\fR, \fBgl\fR, \fBbb\fR, \fBnb\fR). Can also be a full domain name (e.g. for GitHub enterprise). \fBDoes not work with snippets.\fR \fBver\fR@ Used with \fBfrom"gh-r"\fR (i.e. downloading a binary release, e.g. for use with \fBas"program"\fR) \[en] selects which version to download. Default is latest, can also be explicitly \fBver"latest"\fR. Works also with regular plugins, checkouts e.g. \fBver"abranch"\fR, i.e. a specific version. \fBDoes not work with snippets.\fR -\fBbpick\fR@ Used to select which release from GitHub Releases to download, e.g. \fBzplg ice from"gh-r" as"program" bpick"*Darwin*"; zplg load docker/compose\fR. \fBDoes not work with snippets.\fR +\fBbpick\fR@ Used to select which release from GitHub Releases to download, e.g. \fBzplg ice from"gh-r" as"program" bpick"*Darwin*"; zplg load docker/compose\fR. \fBDoes not work with snippets.\fR \fBdepth\fR@ Pass \fB--depth\fR to \fBgit\fR, i.e. limit how much of history to download. \fBDoes not work with snippets.\fR -\fBcloneopts\fR@ Pass the contents of \fBcloneopts\fR to \fBgit clone\fR. Defaults to \fB--recursive\fR i.e. Change cloning options. \fBDoes not work with snippets.\fR +\fBcloneopts\fR@ Pass the contents of \fBcloneopts\fR to \fBgit clone\fR. Defaults to \fB--recursive\fR i.e. Change cloning options. \fBDoes not work with snippets.\fR \fBsvn\fR@ Use Subversion for downloading snippet. GitHub supports \fBSVN\fR protocol, this allows to clone subdirectories as snippets, e.g. \fBzinit ice svn; zinit snippet OMZ::plugins/git\fR. Other ice \fBpick\fR can be used to select file to source (default are: \fB*.plugin.zsh\fR, \fBinit.zsh\fR, \fB*.zsh-theme\fR). \fBDoes not work with plugins.\fR .TE .SS "Selection of Files (To Source, …)" @@ -473,10 +473,10 @@ Modifier@Description \fB\fB\fBwait\fB\fR\fR \fI\(lahttps://zdharma-continuum.github.io/zinit/wiki/Example-wait-conditions\(ra\fR@ Postpone loading a plugin or snippet. For \fBwait'1'\fR, loading is done \fB1\fR second after prompt. For \fBwait'\[lB]\[lB] ... \[rB]\[rB]'\fR, \fBwait'(( ... ))'\fR, loading is done when given condition is meet. For \fBwait'!...'\fR, prompt is reset after load. Zsh can start 73% faster thanks to postponed loading. \fBFact:\fR when \fBwait\fR is used without value, it works as \fBwait'0'\fR. \fB\fB\fBload\fB\fR\fR \fI\(lahttps://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts\(ra\fR@ A condition to check which should cause plugin to load. It will load once, the condition can be still true, but will not trigger second load (unless plugin is unloaded earlier, see \fBunload\fR below). E.g.: \fBload'\[lB]\[lB] $PWD = */github* \[rB]\[rB]'\fR. \fB\fB\fBunload\fB\fR\fR \fI\(lahttps://zdharma-continuum.github.io/zinit/wiki/Multiple-prompts\(ra\fR@ A condition to check causing plugin to unload. It will unload once, then only if loaded again. E.g.: \fBunload'\[lB]\[lB] $PWD != */github* \[rB]\[rB]'\fR. -\fBcloneonly\fR@ Don't load the plugin / snippet, only download it +\fBcloneonly\fR@ Don't load the plugin / snippet, only download it \fBif\fR@ Load plugin or snippet only when given condition is fulfilled, for example: \fBzinit ice if'\[lB]\[lB] -n "$commands\[lB]otool\[rB]" \[rB]\[rB]'; zinit load ...\fR. \fBhas\fR@ Load plugin or snippet only when given command is available (in $PATH), e.g. \fBzinit ice has'git' ...\fR -\fBsubscribe\fR / \fBon-update-of\fR@ Postpone loading of a plugin or snippet until the given file(s) get updated, e.g. \fBsubscribe'{~/files-*,/tmp/files-*}'\fR +\fBsubscribe\fR / \fBon-update-of\fR@ Postpone loading of a plugin or snippet until the given file(s) get updated, e.g. \fBsubscribe'{~/files-*,/tmp/files-*}'\fR .TE .SS "Plugin Output" .TS @@ -717,7 +717,8 @@ compinit\fR. This should be done after loading of all plugins and before possibl .P .RS 2 .nf -source ~/.local/share/zinit/bin/zinit.zsh +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" +source "${ZINIT_HOME}/zinit.zsh" zinit load "some/plugin" ... @@ -824,11 +825,11 @@ typeset -g ZPLG_MOD_DEBUG=1 .SH "HINTS AND TIPS" .SS "Customizing Paths" .P -Following variables can be set to custom values, before sourcing zinit. The previous global variables like \fB$ZPLG_HOME\fR have been removed to not pollute the namespace \[en]Β there's single \fB$ZPLGM\fR ("\fIzinit MAP\fR") hash instead of \fB8\fR string variables. Please update your dotfiles. +Following variables can be set to custom values, before sourcing zinit. The previous global variables like \fB$ZPLG_HOME\fR have been removed to not pollute the namespace \[en]Β there's single \fB$ZINIT\fR ("\fIzinit MAP\fR") hash instead of \fB8\fR string variables. Please update your dotfiles. .P .RS 2 .nf -declare -A ZPLGM # initial zinit's hash definition, if configuring before loading zinit, and then: +declare -A ZINIT # initial zinit's hash definition, if configuring before loading zinit, and then: .fi .RE .TS @@ -836,20 +837,20 @@ tab(@); cb cb l l . Hash Field@Description -ZPLGM\fBBIN_DIR\fR@Β Where zinit code resides, e.g.: "~/.local/share/zinit/bin" -ZPLGM\fBHOME_DIR\fR@Β Where zinit should create all working directories, e.g.: "~/.local/share/zinit" -ZPLGM\fBPLUGINS_DIR\fR@Override single working directory \[en] for plugins, e.g. "/opt/zsh/zinit/plugins" -ZPLGM\fBCOMPLETIONS_DIR\fR@As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" -ZPLGM\fBSNIPPETS_DIR\fR@Β As above, but for snippets -ZPLGM\fBZCOMPDUMP_PATH\fR@Path to \fB.zcompdump\fR file, with the file included (i.e. its name can be different) -ZPLGM\fBCOMPINIT_OPTS\fR@Options for \fBcompinit\fR call (i.e. done by \fBzpcompinit\fR), use to pass -C to speed up loading -ZPLGM\fBMUTE_WARNINGS\fR@If set to \fB1\fR, then mutes some of the zinit warnings, specifically the \fBplugin already registered\fR warning +ZINIT\fBBIN_DIR\fR@Β Where zinit code resides, e.g.: "~/.local/share/zinit/zinit.git" +ZINIT\fBHOME_DIR\fR@Β Where zinit should create all working directories, e.g.: "~/.local/share/zinit" +ZINIT\fBPLUGINS_DIR\fR@Override single working directory \[en] for plugins, e.g. "/opt/zsh/zinit/plugins" +ZINIT\fBCOMPLETIONS_DIR\fR@As above, but for completion files, e.g. "/opt/zsh/zinit/root_completions" +ZINIT\fBSNIPPETS_DIR\fR@Β As above, but for snippets +ZINIT\fBZCOMPDUMP_PATH\fR@Path to \fB.zcompdump\fR file, with the file included (i.e. its name can be different) +ZINIT\fBCOMPINIT_OPTS\fR@Options for \fBcompinit\fR call (i.e. done by \fBzpcompinit\fR), use to pass -C to speed up loading +ZINIT\fBMUTE_WARNINGS\fR@If set to \fB1\fR, then mutes some of the zinit warnings, specifically the \fBplugin already registered\fR warning .TE .P There is also \fB$ZPFX\fR, set by default to \fB~/.local/share/zinit/polaris\fR \[en] a directory where software with \fBMakefile\fR, etc. can be pointed to, by e.g. \fBatclone'./configure --prefix=$ZPFX'\fR. .SS "Non-GitHub (Local) Plugins" .P -Use \fBcreate\fR subcommand with user name \fB_local\fR (the default) to create plugin's skeleton in \fB$ZPLGM\[lB]PLUGINS_DIR\[rB]\fR. It will be not connected with GitHub repository (because of user name being \fB_local\fR). To enter the plugin's directory use \fBcd\fR command with just plugin's name (without \fB_local\fR, it's optional). +Use \fBcreate\fR subcommand with user name \fB_local\fR (the default) to create plugin's skeleton in \fB$ZINIT\[lB]PLUGINS_DIR\[rB]\fR. It will be not connected with GitHub repository (because of user name being \fB_local\fR). To enter the plugin's directory use \fBcd\fR command with just plugin's name (without \fB_local\fR, it's optional). .P If user name will not be \fB_local\fR, then zinit will create repository also on GitHub and setup correct repository origin. .SS "Extending Git" From b9674e2995b558c3891afd77a9af2c258d978896 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 22:24:32 +0100 Subject: [PATCH 15/27] Add warning about zsh version if < 5.5 --- scripts/install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 55b19bdc0..5f6587187 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -59,6 +59,12 @@ echo_error() { } check_dependencies() { + zsh_min_version=5.5 + if ! zsh -fc 'autoload is-at-least; + is-at-least '"$zsh_min_version"' $ZSH_VERSION'; then + echo_warning "ZSH version 5.5+ is recommended for zinit." \ + "It'll still work, but be warned." + fi if ! command -v git >/dev/null 2>&1; then echo_error "${COLOR_BOLD_GREEN}git${COLOR_RESET} is not installed" exit 1 From 6436189cda3725a312bf3078f9b6fb8deca4974b Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Mon, 15 Nov 2021 22:52:05 +0100 Subject: [PATCH 16/27] Update zsh version check --- scripts/install.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 5f6587187..0db98b21f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -60,15 +60,19 @@ echo_error() { check_dependencies() { zsh_min_version=5.5 - if ! zsh -fc 'autoload is-at-least; - is-at-least '"$zsh_min_version"' $ZSH_VERSION'; then - echo_warning "ZSH version 5.5+ is recommended for zinit." \ + if ! zsh -sfc \ + 'autoload is-at-least; + is-at-least $1 $ZSH_VERSION' "$zsh_min_version"; then + echo_warning "ZSH version 5.5+ is recommended for zinit." \ "It'll still work, but be warned." fi + if ! command -v git >/dev/null 2>&1; then echo_error "${COLOR_BOLD_GREEN}git${COLOR_RESET} is not installed" exit 1 fi + + unset zsh_min_version } show_environment() { From fce79125d150224db147b461c1262ddc1c134812 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 07:15:16 +0100 Subject: [PATCH 17/27] Add shellcheck --- .github/workflows/installer.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 01013f879..6e22ae45e 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -2,6 +2,16 @@ name: zinit installer on: [push, workflow_dispatch] jobs: + shellcheck: + name: Shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + scandir: './scripts' + zinit-installer: strategy: fail-fast: false From 587b5407f3011a34a8875d18c8d13728a7f62ced Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 07:19:48 +0100 Subject: [PATCH 18/27] Fix shellcheck issues --- scripts/mod-install.sh | 55 +++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/scripts/mod-install.sh b/scripts/mod-install.sh index 0fdb4337d..e15a2032c 100755 --- a/scripts/mod-install.sh +++ b/scripts/mod-install.sh @@ -15,17 +15,17 @@ echo "${col_info}Re-run this script to update (from Github) and rebuild the modu ZINIT_HOME="${ZDOTDIR:-$HOME}/.zinit" if ! test -d "$ZINIT_HOME"; then - mkdir "$ZINIT_HOME" - chmod g-rwX "$ZINIT_HOME" + mkdir "$ZINIT_HOME" + chmod g-rwX "$ZINIT_HOME" fi echo ">>> Downloading zdharma-continuum/zinit module to $ZINIT_HOME/mod-bin" if test -d "$ZINIT_HOME/mod-bin/.git"; then - cd "$ZINIT_HOME/mod-bin" - git pull origin master + cd "$ZINIT_HOME/mod-bin" || exit 9 + git pull origin master else - cd "$ZINIT_HOME" - git clone --depth 10 https://github.com/zdharma-continuum/zinit.git mod-bin + cd "$ZINIT_HOME" || exit 9 + git clone --depth 10 https://github.com/zdharma-continuum/zinit.git mod-bin fi echo ">>> Done" @@ -33,34 +33,39 @@ echo ">>> Done" # Build the module # -cd "$ZINIT_HOME/mod-bin/zmodules" +cd "$ZINIT_HOME/mod-bin/zmodules" || exit 9 echo "$col_pname== Building module zdharma-continuum/zinit, running: a make clean, then ./configure and then make ==$col_rst" echo "$col_pname== The module sources are located at: $ZINIT_HOME/mod-bin/zmodules ==$col_rst" -test -f Makefile && { [ "$1" = "--clean" ] && { - echo "$col_info2-- make distclean --$col_rst" - make distclean - true - } || { - echo "$col_info2-- make clean (pass --clean to invoke \`make distclean') --$col_rst" - make clean - } -} +if test -f Makefile; then + if [ "$1" = "--clean" ]; then + echo "$col_info2-- make distclean --$col_rst" + make distclean + true + else + echo "$col_info2-- make clean (pass --clean to invoke \`make distclean') --$col_rst" + make clean + fi +fi + echo "$col_info2-- ./configure --$col_rst" -CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib ./configure --disable-gdbm --without-tcsetpgrp && { +if CPPFLAGS=-I/usr/local/include CFLAGS="-g -Wall -O3" LDFLAGS=-L/usr/local/lib \ + ./configure --disable-gdbm --without-tcsetpgrp; then echo "$col_info2-- make --$col_rst" - make && { + if make; then echo "${col_info}Module has been built correctly.$col_rst" echo "To load the module, add following 2 lines to .zshrc, at top:" - echo " module_path+=( \"$ZINIT_HOME/mod-bin/zmodules/Src\" )" - echo " zmodload zdharma-continuum/zinit" + echo " module_path+=( \"$ZINIT_HOME/mod-bin/zmodules/Src\" )" + echo " zmodload zdharma-continuum/zinit" echo "" echo "After loading, use command \`zpmod' to communicate with the module." echo "See \`zpmod -h' for more information. There are two main features," echo "invocation of \`zpmod source-study' which shows \`source' profile" echo "data, and guaranteed, automatic compilation of any sourced script" echo "while the module is loaded (check with Zsh command \`zmodload')." - } || { - echo "${col_error}Module didn't build.$col_rst. You can copy the error messages and submit" - echo "error-report at: https://github.com/zdharma-continuum/zinit/issues" - } -} + else + echo "${col_error}Module didn't build.$col_rst. You can copy the error messages and submit" + echo "error-report at: https://github.com/zdharma-continuum/zinit/issues" + fi +fi + +# vim: set ft=sh et ts=2 sw=2 : From e6c48ac214a034c36eadc4006b5a09ff75e64738 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 08:24:55 +0100 Subject: [PATCH 19/27] Fix install.sh URL (don't hardcode the branch name) --- README.md | 4 ++-- doc/zinit.1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c4c8a044b..239e4d74b 100644 --- a/README.md +++ b/README.md @@ -147,7 +147,7 @@ read it to get the most out of Zinit. The easiest way to install Zinit is to execute: ```zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" ``` This will install Zinit in `~/.local/share/zinit/zinit.git`. @@ -1041,7 +1041,7 @@ To install just the binary Zinit module **standalone** (Zinit is not needed, the other plugin manager), execute: ```zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/scripts/mod-install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/mod-install.sh)" ``` This script will display what to add to `~/.zshrc` (2 lines) and show usage instructions. diff --git a/doc/zinit.1 b/doc/zinit.1 index deed19a49..dd40718b2 100644 --- a/doc/zinit.1 +++ b/doc/zinit.1 @@ -317,7 +317,7 @@ The easiest way to install zinit is to execute: .P .RS 2 .nf -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/master/doc/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" .fi .RE .P From 6eb36d00147f6782f9ecd921e6b46aeef76be2a3 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 08:38:45 +0100 Subject: [PATCH 20/27] Add new installer section to the CHANGELOG --- doc/CHANGELOG.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 0721ef12f..4681f875b 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -9,6 +9,23 @@ # Changelog All notable changes to this project will be documented in this file. +* 16-11-2021 + - A brand-new installer has been developped. A few new features have been +added. There are a bunch of new env vars you can set: + + - `NO_INPUT=1`: non-interactive mode (`NO_INPUT=1`) + - `NO_EDIT=1`: do not modify `.zshrc` + - `ZSHRC=/home/user01/.config/zsh/zshrc`: custom path to your `.zshrc` + - `ZINIT_REPO=zdharma-continuum/zinit`: Install zinit from a custom GitHub repo + - `ZINIT_BRANCH=master`: zinit branch to install + - `ZINIT_COMMIT=master`: zinit commit to install (takes precedence over `ZINIT_BRANCH`) + - `ZINIT_INSTALL_DIR=~/.local/share/zinit/zinit.git`: Where to install the zinit repo + +⚠️ Please note that the download URL for the installer has changed. It is now: +https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh + +For more details check out [PR #61](https://github.com/zdharma-continuum/zinit/pull/61) + * 11-11-2021 - The annexes repos have been renamed to improve discoverability. They used to be called `z-a-${name}` and have been renamed to `zinit-annex-${name}`. You @@ -358,7 +375,7 @@ startup. Please note that these directories will not necessarily be part of your In other words, instead of `wait'1'` you can enter `wait'1a'`, `wait'1b'` and `wait'1c'` – to this way **impose order** on the loadings - **regardless of the order of `zplugin` commands**. + **regardless of the order of `zplugin` commands**. * 26-05-2019 - Turbo-Mode now divides the scheduled events (i.e. loadings of plugins or snippets) into packs of 5. In other words, after loading each series of 5 plugins or snippets From 5f6a2549ecd60dc69ced792410d83fcce89abb20 Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Tue, 16 Nov 2021 02:48:53 -0600 Subject: [PATCH 21/27] Fix typo --- doc/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 4681f875b..9452251a7 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file. * 16-11-2021 - - A brand-new installer has been developped. A few new features have been + - A brand-new installer has been developed. A few new features have been added. There are a bunch of new env vars you can set: - `NO_INPUT=1`: non-interactive mode (`NO_INPUT=1`) From f4588c87c415714b7f9330242b1d19c3770d5ad4 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 08:51:12 +0100 Subject: [PATCH 22/27] zinit installs on windows (cygwin) --- .github/workflows/installer.yaml | 116 +++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 14 deletions(-) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 6e22ae45e..ae0e58c9e 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -16,20 +16,28 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] - # TODO: macOS (jobs hang...) - # TODO: Windows... - # os: [ubuntu-latest, macos-11] # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] annexes: ["with-annexes", "without-annexes"] runs-on: ${{ matrix.os }} steps: + - name: Fix crlf (windows only) + if: startsWith(matrix.os, 'windows') + run: git config --global core.autocrlf input + - name: Check out repository code uses: actions/checkout@v2 - name: Grab git slugs (short commit id, branch etc.) uses: rlespinasse/github-slug-action@v3.x + - name: Install dependencies (windows) + if: startsWith(matrix.os, 'windows') + uses: egor-tensin/setup-cygwin@v3 + with: + platform: x64 + packages: curl git zsh + - name: Install dependencies (ubuntu) if: startsWith(matrix.os, 'ubuntu-latest') run: | @@ -41,8 +49,8 @@ jobs: run: | brew install curl git zsh - - name: Install zinit (with annexes) - if: matrix.annexes == 'with-annexes' + - name: Install zinit (linux/macOS, with annexes) + if: matrix.annexes == 'with-annexes' && !startsWith(matrix.os, 'windows') run: | export ZINIT_COMMIT="$GITHUB_SHA" export ZINIT_REPO="$GITHUB_REPOSITORY" @@ -51,8 +59,8 @@ jobs: sh -x ./scripts/install.sh - - name: Install zinit (w/o annexes) - if: matrix.annexes == 'without-annexes' + - name: Install zinit (linux/macOS, w/o annexes) + if: matrix.annexes == 'without-annexes' && !startsWith(matrix.os, 'windows') run: | export ZINIT_COMMIT="$GITHUB_SHA" export ZINIT_REPO="$GITHUB_REPOSITORY" @@ -62,7 +70,33 @@ jobs: sh -x ./scripts/install.sh - - name: Upload zshrc and zinit files + - name: Install zinit (windows, with annexes) + if: matrix.annexes == 'with-annexes' && startsWith(matrix.os, 'windows') + shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + cd ${GITHUB_WORKSPACE} + sh -x ./scripts/install.sh + + - name: Install zinit (windows, w/o annexes) + if: matrix.annexes == 'without-annexes' && startsWith(matrix.os, 'windows') + shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + export NO_ANNEXES=true + + cd ${GITHUB_WORKSPACE} + sh -x ./scripts/install.sh + + - name: Upload zshrc and zinit files (linux/macOS) + if: "!startsWith(matrix.os, 'windows')" uses: actions/upload-artifact@v2 with: name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }} @@ -70,7 +104,25 @@ jobs: /home/runner/.zshrc /home/runner/.local/share/zinit - - name: Test zinit install + - name: Test zinit install (linux/macOS) + if: "!startsWith(matrix.os, 'windows')" + run: | + export TERM=xterm + zsh -silc 'zinit --help; exit $?' + + - name: Upload zshrc and zinit files (windows) + if: startsWith(matrix.os, 'windows') + uses: actions/upload-artifact@v2 + with: + name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }} + # cygpath -w ~ returns "C:\tools\cygwin\home\runneradmin" + path: | + C:\tools\cygwin\home\runneradmin\.zshrc + C:\tools\cygwin\home\runneradmin\.local\.share\zinit\zinit.git + + - name: Test zinit install (windows) + shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + if: startsWith(matrix.os, 'windows') run: | export TERM=xterm zsh -silc 'zinit --help; exit $?' @@ -81,13 +133,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] - # TODO: macOS (jobs hang...) - # TODO: Windows... - # os: [ubuntu-latest, macos-11] # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: + - name: Fix crlf (windows only) + if: startsWith(matrix.os, 'windows') + run: git config --global core.autocrlf input + - name: Check out repository code uses: actions/checkout@v2 @@ -105,7 +158,15 @@ jobs: run: | brew install curl git zsh + - name: Install dependencies (windows) + if: startsWith(matrix.os, 'windows') + uses: egor-tensin/setup-cygwin@v3 + with: + platform: x64 + packages: curl git zsh + - name: Install previous zinit version (${{ github.event.before }}) + if: "!startsWith(matrix.os, 'windows')" env: PREVIOUS_COMMIT: ${{ github.event.before }} run: | @@ -117,10 +178,37 @@ jobs: ./scripts/install.sh - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} + if: "!startsWith(matrix.os, 'windows')" + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + ./scripts/install.sh + + - name: Install previous zinit version (windows, ${{ github.event.before }}) + if: startsWith(matrix.os, 'windows') + env: + PREVIOUS_COMMIT: ${{ github.event.before }} + shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' + run: | + export ZINIT_COMMIT="$PREVIOUS_COMMIT" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + cd ${GITHUB_WORKSPACE} + ./scripts/install.sh + + - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} (windows) + if: startsWith(matrix.os, 'windows') + shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' run: | export ZINIT_COMMIT="$GITHUB_SHA" export ZINIT_REPO="$GITHUB_REPOSITORY" export ZINIT_BRANCH="$GITHUB_REF_SLUG" export NO_INPUT=true + cd ${GITHUB_WORKSPACE} ./scripts/install.sh From efb25ce137534c199badb0bc2619f4625071d16a Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 10:01:34 +0100 Subject: [PATCH 23/27] Add FIXME notice in regards to windows artifacts --- .github/workflows/installer.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index ae0e58c9e..9a77e50ee 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -116,6 +116,7 @@ jobs: with: name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }} # cygpath -w ~ returns "C:\tools\cygwin\home\runneradmin" + # FIXME Why isn't the zinit.git/ dir not getting uploaded? path: | C:\tools\cygwin\home\runneradmin\.zshrc C:\tools\cygwin\home\runneradmin\.local\.share\zinit\zinit.git From 74ee9397e999750da06ff849eb6c4b23fbf480dd Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 11:09:59 +0100 Subject: [PATCH 24/27] Update git-process-output.zsh url --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 0db98b21f..d3bedc354 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -102,7 +102,7 @@ create_zinit_tmpdir() { # Get the download-progress bar tool download_git_output_processor() { - url="https://raw.githubusercontent.com/${ZINIT_REPO}/${ZINIT_COMMIT:-${ZINIT_BRANCH}}/git-process-output.zsh" + url="https://raw.githubusercontent.com/${ZINIT_REPO}/${ZINIT_COMMIT:-${ZINIT_BRANCH}}/share/git-process-output.zsh" script_path="${ZINIT_TMPDIR}/git-process-output.zsh" echo_info "Fetching git-process-output.zsh from $url" From 7bbeb17c9437e7c0b6090f7b55827f2bfedfa0a1 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 11:21:02 +0100 Subject: [PATCH 25/27] Enable macOS checks --- .github/workflows/installer.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 9a77e50ee..08a66cf56 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: false matrix: - # os: [ubuntu-latest, macos-latest, windows-latest] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] + # os: [ubuntu-latest, windows-latest] annexes: ["with-annexes", "without-annexes"] runs-on: ${{ matrix.os }} steps: @@ -134,8 +134,8 @@ jobs: strategy: fail-fast: false matrix: - # os: [ubuntu-latest, macos-latest, windows-latest] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-latest] + # os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Fix crlf (windows only) From e099e2373bf153447d80efad936cc0aba079659f Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 11:58:36 +0100 Subject: [PATCH 26/27] Leverage tilde expansion for artifact files --- .github/workflows/installer.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 08a66cf56..2c191591e 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -17,7 +17,6 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - # os: [ubuntu-latest, windows-latest] annexes: ["with-annexes", "without-annexes"] runs-on: ${{ matrix.os }} steps: @@ -101,8 +100,8 @@ jobs: with: name: zinit-config-${{ matrix.os }}-${{ matrix.annexes }} path: | - /home/runner/.zshrc - /home/runner/.local/share/zinit + ~/.zshrc + ~/.local/share/zinit - name: Test zinit install (linux/macOS) if: "!startsWith(matrix.os, 'windows')" @@ -135,7 +134,6 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - # os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Fix crlf (windows only) From 437b071a6b561aeb70d5b63960ffde3c492b72dd Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 16 Nov 2021 12:03:40 +0100 Subject: [PATCH 27/27] Sort steps --- .github/workflows/installer.yaml | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/installer.yaml b/.github/workflows/installer.yaml index 2c191591e..8768a327d 100644 --- a/.github/workflows/installer.yaml +++ b/.github/workflows/installer.yaml @@ -30,13 +30,6 @@ jobs: - name: Grab git slugs (short commit id, branch etc.) uses: rlespinasse/github-slug-action@v3.x - - name: Install dependencies (windows) - if: startsWith(matrix.os, 'windows') - uses: egor-tensin/setup-cygwin@v3 - with: - platform: x64 - packages: curl git zsh - - name: Install dependencies (ubuntu) if: startsWith(matrix.os, 'ubuntu-latest') run: | @@ -48,6 +41,13 @@ jobs: run: | brew install curl git zsh + - name: Install dependencies (windows) + if: startsWith(matrix.os, 'windows') + uses: egor-tensin/setup-cygwin@v3 + with: + platform: x64 + packages: curl git zsh + - name: Install zinit (linux/macOS, with annexes) if: matrix.annexes == 'with-annexes' && !startsWith(matrix.os, 'windows') run: | @@ -103,12 +103,6 @@ jobs: ~/.zshrc ~/.local/share/zinit - - name: Test zinit install (linux/macOS) - if: "!startsWith(matrix.os, 'windows')" - run: | - export TERM=xterm - zsh -silc 'zinit --help; exit $?' - - name: Upload zshrc and zinit files (windows) if: startsWith(matrix.os, 'windows') uses: actions/upload-artifact@v2 @@ -120,6 +114,12 @@ jobs: C:\tools\cygwin\home\runneradmin\.zshrc C:\tools\cygwin\home\runneradmin\.local\.share\zinit\zinit.git + - name: Test zinit install (linux/macOS) + if: "!startsWith(matrix.os, 'windows')" + run: | + export TERM=xterm + zsh -silc 'zinit --help; exit $?' + - name: Test zinit install (windows) shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' if: startsWith(matrix.os, 'windows') @@ -164,7 +164,7 @@ jobs: platform: x64 packages: curl git zsh - - name: Install previous zinit version (${{ github.event.before }}) + - name: Install previous zinit version (linux/macOS, ${{ github.event.before }}) if: "!startsWith(matrix.os, 'windows')" env: PREVIOUS_COMMIT: ${{ github.event.before }} @@ -176,16 +176,6 @@ jobs: ./scripts/install.sh - - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} - if: "!startsWith(matrix.os, 'windows')" - run: | - export ZINIT_COMMIT="$GITHUB_SHA" - export ZINIT_REPO="$GITHUB_REPOSITORY" - export ZINIT_BRANCH="$GITHUB_REF_SLUG" - export NO_INPUT=true - - ./scripts/install.sh - - name: Install previous zinit version (windows, ${{ github.event.before }}) if: startsWith(matrix.os, 'windows') env: @@ -200,6 +190,16 @@ jobs: cd ${GITHUB_WORKSPACE} ./scripts/install.sh + - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} (linux/macOS) + if: "!startsWith(matrix.os, 'windows')" + run: | + export ZINIT_COMMIT="$GITHUB_SHA" + export ZINIT_REPO="$GITHUB_REPOSITORY" + export ZINIT_BRANCH="$GITHUB_REF_SLUG" + export NO_INPUT=true + + ./scripts/install.sh + - name: Update zinit from ${{ github.event.before }} to ${{ github.sha }} (windows) if: startsWith(matrix.os, 'windows') shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'