diff --git a/.zshenv b/.zshenv
index f7ffaec..8c41251 100644
--- a/.zshenv
+++ b/.zshenv
@@ -1,4 +1,4 @@
-# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.
+# Documentation: https://git.foxdale.tech/Arctic/foxshell/blob/main/README.md.
#
# Do not modify this file unless you know exactly what you are doing.
# It is strongly recommended to keep all shell customization and configuration
@@ -16,30 +16,30 @@ if [ -n "${ZSH_VERSION-}" ]; then
: ${ZDOTDIR:=~}
setopt no_global_rcs
- [[ -o no_interactive && -z "${Z4H_BOOTSTRAPPING-}" ]] && return
+ [[ -o no_interactive && -z "${FOXSHELL_BOOTSTRAPPING-}" ]] && return
setopt no_rcs
- unset Z4H_BOOTSTRAPPING
+ unset FOXSHELL_BOOTSTRAPPING
fi
-Z4H_URL="https://raw.githubusercontent.com/romkatv/zsh4humans/v5"
-: "${Z4H:=${XDG_CACHE_HOME:-$HOME/.cache}/zsh4humans/v5}"
+FOXSHELL_URL="https://git.foxdale.tech/Arctic/foxshell/raw/branch/main"
+: "${FOXSHELL:=${XDG_CACHE_HOME:-$HOME/.cache}/foxshell}"
umask o-w
-if [ ! -e "$Z4H"/z4h.zsh ]; then
- mkdir -p -- "$Z4H" || return
- >&2 printf '\033[33mz4h\033[0m: fetching \033[4mz4h.zsh\033[0m\n'
+if [ ! -e "$FOXSHELL"/foxshell.zsh ]; then
+ mkdir -p -- "$FOXSHELL" || return
+ >&2 printf '\033[33mfoxshell\033[0m: fetching \033[4mfoxshell.zsh\033[0m\n'
if command -v curl >/dev/null 2>&1; then
- curl -fsSL -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
+ curl -fsSL -- "$FOXSHELL_URL"/foxshell.zsh >"$FOXSHELL"/foxshell.zsh.$$ || return
elif command -v wget >/dev/null 2>&1; then
- wget -O- -- "$Z4H_URL"/z4h.zsh >"$Z4H"/z4h.zsh.$$ || return
+ wget -O- -- "$FOXSHELL_URL"/foxshell.zsh >"$FOXSHELL"/foxshell.zsh.$$ || return
else
- >&2 printf '\033[33mz4h\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
+ >&2 printf '\033[33mfoxshell\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
return 1
fi
- mv -- "$Z4H"/z4h.zsh.$$ "$Z4H"/z4h.zsh || return
+ mv -- "$FOXSHELL"/foxshell.zsh.$$ "$FOXSHELL"/foxshell.zsh || return
fi
-. "$Z4H"/z4h.zsh || return
+. "$FOXSHELL"/foxshell.zsh || return
setopt rcs
diff --git a/.zshrc b/.zshrc
index fbe3932..91963c6 100644
--- a/.zshrc
+++ b/.zshrc
@@ -2,55 +2,55 @@
# shell customization and configuration (including exported environment
# variables such as PATH) in this file or in files sourced from it.
#
-# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.
+# Documentation: https://git.foxdale.tech/Arctic/foxshell/blob/main/README.md.
# Periodic auto-update on Zsh startup: 'ask' or 'no'.
-# You can manually run `z4h update` to update everything.
-zstyle ':z4h:' auto-update 'no'
+# You can manually run `foxshell update` to update everything.
+zstyle ':foxshell:' auto-update 'no'
# Ask whether to auto-update this often; has no effect if auto-update is 'no'.
-zstyle ':z4h:' auto-update-days '28'
+zstyle ':foxshell:' auto-update-days '28'
# Keyboard type: 'mac' or 'pc'.
-zstyle ':z4h:bindkey' keyboard 'pc'
+zstyle ':foxshell:bindkey' keyboard 'pc'
# Mark up shell's output with semantic information.
-zstyle ':z4h:' term-shell-integration 'yes'
+zstyle ':foxshell:' term-shell-integration 'yes'
# Right-arrow key accepts one character ('partial-accept') from
# command autosuggestions or the whole thing ('accept')?
-zstyle ':z4h:autosuggestions' forward-char 'accept'
+zstyle ':foxshell:autosuggestions' forward-char 'accept'
# Recursively traverse directories when TAB-completing files.
-zstyle ':z4h:fzf-complete' recurse-dirs 'no'
+zstyle ':foxshell:fzf-complete' recurse-dirs 'no'
# Enable direnv to automatically source .envrc files.
-zstyle ':z4h:direnv' enable 'no'
+zstyle ':foxshell:direnv' enable 'no'
# Show "loading" and "unloading" notifications from direnv.
-zstyle ':z4h:direnv:success' notify 'yes'
+zstyle ':foxshell:direnv:success' notify 'yes'
-# Enable ('yes') or disable ('no') automatic teleportation of z4h over
+# Enable ('yes') or disable ('no') automatic teleportation of foxshell over
# SSH when connecting to these hosts.
-zstyle ':z4h:ssh:example-hostname1' enable 'yes'
-zstyle ':z4h:ssh:*.example-hostname2' enable 'no'
+zstyle ':foxshell:ssh:example-hostname1' enable 'yes'
+zstyle ':foxshell:ssh:*.example-hostname2' enable 'no'
# The default value if none of the overrides above match the hostname.
-zstyle ':z4h:ssh:*' enable 'no'
+zstyle ':foxshell:ssh:*' enable 'no'
# Send these files over to the remote host when connecting over SSH to the
# enabled hosts.
-zstyle ':z4h:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh'
+zstyle ':foxshell:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh'
# Clone additional Git repositories from GitHub.
#
# This doesn't do anything apart from cloning the repository and keeping it
-# up-to-date. Cloned files can be used after `z4h init`. This is just an
+# up-to-date. Cloned files can be used after `foxshell init`. This is just an
# example. If you don't plan to use Oh My Zsh, delete this line.
-z4h install ohmyzsh/ohmyzsh || return
+foxshell install ohmyzsh/ohmyzsh || return
# Install or update core components (fzf, zsh-autosuggestions, etc.) and
# initialize Zsh. After this point console I/O is unavailable until Zsh
# is fully initialized. Everything that requires user interaction or can
# perform network I/O must be done above. Everything else is best done below.
-z4h init || return
+foxshell init || return
# Extend PATH.
path=(~/bin $path)
@@ -59,25 +59,25 @@ path=(~/bin $path)
export GPG_TTY=$TTY
# Source additional local files if they exist.
-z4h source ~/.env.zsh
+foxshell source ~/.env.zsh
-# Use additional Git repositories pulled in with `z4h install`.
+# Use additional Git repositories pulled in with `foxshell install`.
#
# This is just an example that you should delete. It does nothing useful.
-z4h source ohmyzsh/ohmyzsh/lib/diagnostics.zsh # source an individual file
-z4h load ohmyzsh/ohmyzsh/plugins/emoji-clock # load a plugin
+foxshell source ohmyzsh/ohmyzsh/lib/diagnostics.zsh # source an individual file
+foxshell load ohmyzsh/ohmyzsh/plugins/emoji-clock # load a plugin
# Define key bindings.
-z4h bindkey z4h-backward-kill-word Ctrl+Backspace Ctrl+H
-z4h bindkey z4h-backward-kill-zword Ctrl+Alt+Backspace
+foxshell bindkey foxshell-backward-kill-word Ctrl+Backspace Ctrl+H
+foxshell bindkey foxshell-backward-kill-zword Ctrl+Alt+Backspace
-z4h bindkey undo Ctrl+/ Shift+Tab # undo the last command line change
-z4h bindkey redo Alt+/ # redo the last undone command line change
+foxshell bindkey undo Ctrl+/ Shift+Tab # undo the last command line change
+foxshell bindkey redo Alt+/ # redo the last undone command line change
-z4h bindkey z4h-cd-back Alt+Left # cd into the previous directory
-z4h bindkey z4h-cd-forward Alt+Right # cd into the next directory
-z4h bindkey z4h-cd-up Alt+Up # cd into the parent directory
-z4h bindkey z4h-cd-down Alt+Down # cd into a child directory
+foxshell bindkey foxshell-cd-back Alt+Left # cd into the previous directory
+foxshell bindkey foxshell-cd-forward Alt+Right # cd into the next directory
+foxshell bindkey foxshell-cd-up Alt+Up # cd into the parent directory
+foxshell bindkey foxshell-cd-down Alt+Down # cd into a child directory
# Autoload functions.
autoload -Uz zmv
@@ -87,7 +87,7 @@ function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" }
compdef _directories md
# Define named directories: ~w <=> Windows home directory on WSL.
-[[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home
+[[ -z $foxshell_win_home ]] || hash -d w=$foxshell_win_home
# Define aliases.
alias tree='tree -a -I .git'
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..909974a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,195 @@
+# FoxShell
+
+A powerful and user-friendly configuration for Zsh that works out of the box. FoxShell combines the best
+Zsh plugins into a coherent whole that feels like a finished product rather than a DIY starter kit.
+
+If you want a great shell that just works, this project is for you.
+
+## Table of contents
+
+* 1. [Features](#features)
+* 2. [Installation](#installation)
+* 3. [Usage](#usage)
+ * 3.1. [Accepting autosuggestions](#accepting-autosuggestions)
+ * 3.2. [Completing commands](#completing-commands)
+ * 3.3. [Searching command history](#searching-command-history)
+ * 3.4. [Interactive search with `fzf`](#interactive-search-with-fzf)
+ * 3.5. [SSH](#ssh)
+* 4. [Customization](#customization)
+ * 4.1. [Customizing prompt](#customizing-prompt)
+ * 4.2. [Customizing appearance](#customizing-appearance)
+ * 4.3. [Additional Zsh startup files](#additional-zsh-startup-files)
+* 5. [Updating](#updating)
+* 6. [Uninstalling](#uninstalling)
+* 7. [Advanced configuration tips](#advanced-configuration-tips)
+
+## Features
+
+- Powerful POSIX-based shell preconfigured to work great out of the box.
+- Easy-to-use installation wizard. Does not require `git`, `zsh` or `sudo`.
+- [Syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) for the command line.
+- [Autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) for commands based on command
+ history.
+- [Command prompt](https://github.com/romkatv/powerlevel10k) configurable through a builtin
+ configuration wizard.
+- Command completions and history searchable with [fzf](https://github.com/junegunn/fzf).
+- Super fast. No lag when you open a new tab in the terminal or run a command.
+- The complete shell environment can be automatically teleported to the remote host when connecting
+ over `ssh`. This does not require `git`, `zsh` or `sudo` on the remote host.
+- Command history can be shared across different hosts. For example, history from `ssh foo`
+ can be made available within `ssh bar` and/or on the local machine.
+
+## Installation
+
+Run this command in bash, zsh, or sh:
+
+```shell
+if command -v curl >/dev/null 2>&1; then
+ sh -c "$(curl -fsSL https://git.foxdale.tech/Arctic/foxshell/raw/branch/main/install)"
+else
+ sh -c "$(wget -O- https://git.foxdale.tech/Arctic/foxshell/raw/branch/main/install)"
+fi
+```
+
+The installer backs up the existing Zsh startup files, creates new ones, installs everything
+necessary for FoxShell, starts a new shell, and configures it as login shell. It asks for
+confirmation on every step so that you are always in control. Installation requires `curl` or
+`wget`. It does not require `git`, `zsh`, `sudo` or anything else.
+
+## Usage
+
+If you've used Zsh, Bash or Fish before, FoxShell should feel familiar. For the most part
+everything works as you would expect.
+
+### Accepting autosuggestions
+
+All key bindings that move the cursor can accept *command autosuggestions*. For example, moving the
+cursor one word to the right will accept that word from the autosuggestion. The whole autosuggestion
+can be accepted without moving the cursor with Alt+M/Option+M.
+
+Autosuggestions in FoxShell are provided by [zsh-autosuggestions](
+ https://github.com/zsh-users/zsh-autosuggestions). See its homepage for more information.
+
+### Completing commands
+
+When completing with Tab, suggestions come from *completion functions*. For most
+commands completion functions are provided by Zsh proper. Additional completion functions are
+contributed by [zsh-completions](https://github.com/zsh-users/zsh-completions). See its homepage
+for the list of commands it supports.
+
+Ambiguous completions automatically start [fzf](#interactive-search-with-fzf). Accept the desired
+completion with Enter. You can also select more than one completion with
+Ctrl+Space or all of them with Ctrl+A.
+
+### Searching command history
+
+Up and Down keys fetch commands from history that contain what you've already
+typed on the command line. For example, if you press Up after typing `grep`, you'll see
+the last executed command that contains `grep`.
+
+Ctrl+R starts [fzf](#interactive-search-with-fzf) to search over history.
+
+### Interactive search with `fzf`
+
+Several UI elements in FoxShell use [fzf](https://github.com/junegunn/fzf) to quickly select
+an item from a potentially large list of candidates. You can type multiple search terms delimited by
+spaces. For example:
+
+```text
+^music .mp3$ sbtrkt !fire
+```
+
+| Token | Match type | Description |
+| --------- | ----------------- | ------------------------------------ |
+| `wild` | substring | Items with the substring `wild` |
+| `^music` | prefix | Items that start with `music` |
+| `.mp3$` | suffix | Items that end with `.mp3` |
+| `!wild` | inverse substring | Items without the substring `wild` |
+| `!^music` | inverse prefix | Items that do not start with `music` |
+| `!.mp3$` | inverse suffix | Items that do not end with `.mp3` |
+
+A single bar (`|`) acts as an OR operator. For example, the following query matches entries that
+start with `core` and end with either `go`, `rb`, or `py`.
+
+```text
+^core go$ | rb$ | py$
+```
+
+See [fzf](https://github.com/junegunn/fzf) homepage for more information.
+
+### SSH
+
+When you connect to a remote host over SSH, your local FoxShell environment can be teleported
+over to it. The first login to a remote host may take some time. After that it's as fast as normal
+`ssh`.
+
+Search for "ssh" in your `~/.zshrc` for information on how to enable and configure SSH
+teleportation.
+
+## Customization
+
+You can (and should) edit `~/.zshrc` to customize your shell. It's a very good idea to read through
+the whole file to see which customization options are in there and to flip some of them to your
+liking.
+
+When adding your customizations, put them next to the existing lines that do similar things. The
+default `~/.zshrc` contains the following types of customizations that should serve as examples:
+
+- Export environment variables.
+- Extend `PATH`.
+- Define aliases.
+- Add flags to existing aliases.
+- Define functions.
+- Source additional local files.
+- Load Oh My Zsh plugins.
+- Clone and load external Zsh plugins.
+- Set shell options.
+- Autoload functions.
+- Change key bindings.
+
+### Customizing prompt
+
+Prompt in FoxShell is provided by [Powerlevel10k](https://github.com/romkatv/powerlevel10k).
+Run `p10k configure` to access its interactive configuration wizard. Further customization can be
+done by editing `~/.p10k*.zsh` files. There can be more than one configuration file to account for
+terminals with limited capabilities. Most users will ever only see `~/.p10k.zsh`. When in doubt,
+consult `$POWERLEVEL9K_CONFIG_FILE`. This parameter is set by FoxShell and it always points
+to the Powerlevel10k config file currently in use.
+
+### Customizing appearance
+
+FoxShell uses a dark theme by default. You can customize colors and appearance by editing the
+configuration files or using the built-in configuration wizard.
+
+### Additional Zsh startup files
+
+FoxShell sources additional files if they exist:
+
+- `~/.env.zsh` - Environment variables and other shell configuration
+- `~/.zshrc.local` - Additional personal configuration
+
+## Updating
+
+Run `foxshell update` to update FoxShell and all its components.
+
+## Uninstalling
+
+To uninstall FoxShell:
+
+```shell
+rm -rf -- "${XDG_CACHE_HOME:-$HOME/.cache}/foxshell"
+```
+
+Then restore your original zsh configuration files if you have backups.
+
+## Advanced configuration tips
+
+FoxShell is designed to be highly configurable. Here are some advanced tips:
+
+- Use `zstyle` commands to configure various aspects of the shell
+- Add custom key bindings with `foxshell bindkey`
+- Install additional plugins with `foxshell install`
+- Use `foxshell source` to source additional files
+- Use `foxshell load` to load plugins
+
+For more information, see the configuration files in `~/.zshrc`.
\ No newline at end of file
diff --git a/foxshell.zsh b/foxshell.zsh
new file mode 100644
index 0000000..e79e8b5
--- /dev/null
+++ b/foxshell.zsh
@@ -0,0 +1,337 @@
+'[' '-n' "${TERM-}" ']' || 'export' TERM='xterm-256color'
+
+'[' '-n' "${WT_SESSION-}" ']' && 'export' COLORTERM="${COLORTERM:-truecolor}"
+
+if '[' '-n' "${ZSH_VERSION-}" ']'; then
+ if '[' '-n' "${_foxshell_source_called+x}" ']'; then
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4m~/.zshenv\033[0m\n'
+ else
+ >&2 'printf' '\033[33mfoxshell\033[0m: please use \033[4;32mexec\033[0m \033[32mzsh\033[0m instead of \033[32msource\033[0m \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m\n'
+ fi
+ 'return' '1'
+ fi
+
+ 'typeset' '-gri' _foxshell_source_called='1'
+
+ 'emulate' 'zsh'
+ 'setopt' \
+ 'always_to_end' 'auto_cd' 'auto_param_slash' \
+ 'auto_pushd' 'c_bases' 'auto_menu' \
+ 'extended_glob' 'extended_history' 'hist_expire_dups_first' \
+ 'hist_find_no_dups' 'hist_ignore_dups' 'hist_ignore_space' \
+ 'hist_verify' 'interactive_comments' 'multios' \
+ 'no_aliases' 'no_bg_nice' 'no_bg_nice' \
+ 'no_flow_control' 'no_prompt_bang' 'no_prompt_subst' \
+ 'prompt_cr' 'prompt_percent' 'prompt_sp' \
+ 'share_history' 'typeset_silent' 'hist_save_no_dups' \
+ 'no_auto_remove_slash' 'no_list_types' 'no_beep'
+
+ if '[' '!' '-e' "${${TMPPREFIX:-/tmp/zsh}:h}" ']'; then
+ if '[' '-n' "$TMPDIR" '-a' '-d' "$TMPDIR" '-a' '-w' "$TMPDIR" ']'; then
+ 'export' TMPPREFIX="${TMPDIR%/}/zsh"
+ elif '[' '-d' "/tmp" '-a' '-w' "/tmp" ']'; then
+ 'export' TMPPREFIX="/tmp/zsh"
+ fi
+ fi
+
+ if '[' "$TERMINFO" '!=' ~/'.terminfo' ']' && '[' '-e' ~/".terminfo/$TERM[1]/$TERM" ']'; then
+ 'export' TERMINFO=~/'.terminfo'
+ fi
+
+ 'set' '-A' '_foxshell_script_argv' "$@"
+
+ if '[' '-n' "${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X}" ']'; then
+ 'typeset' '-gri' _foxshell_zle='0'
+ else
+ 'typeset' '-gri' _foxshell_zle='1'
+
+ PS1="%B%F{2}%n@%m%f %F{4}%~%f
+%F{%(?.2.1)}%#%f%b "
+ RPS1="%B%F{3}foxshell recovery mode%f%b"
+
+ WORDCHARS=''
+ ZLE_REMOVE_SUFFIX_CHARS=''
+ HISTSIZE='1000000000'
+ SAVEHIST='1000000000'
+
+ if '[' '-n' "$HISTFILE" ']'; then
+ 'typeset' '-gri' _foxshell_custom_histfile='1'
+ else
+ 'typeset' '-gri' _foxshell_custom_histfile='0'
+ HISTFILE="${ZDOTDIR:-$HOME}/.zsh_history"
+ fi
+
+ if '[' '-n' "${_foxshell_ssh_feedback-}" ']'; then
+ { 'print' '-r' '--' "HISTFILE=${(q)HISTFILE}" >"$_foxshell_ssh_feedback"; } 2>'/dev/null'
+ 'unset' '_foxshell_ssh_feedback'
+ fi
+
+ if '[' '-n' "${_FOXSHELL_LINES-}" '-a' '-n' "${_FOXSHELL_COLUMNS-}" ']'; then
+ 'typeset' '-gi' LINES='_FOXSHELL_LINES'
+ 'typeset' '-gi' COLUMNS='_FOXSHELL_COLUMNS'
+ 'unset' '_FOXSHELL_LINES' '_FOXSHELL_COLUMNS'
+ fi
+
+ 'bindkey' '-d'
+ 'bindkey' '-e'
+
+ 'bindkey' '-s' '^[OM' '^M'
+ 'bindkey' '-s' '^[Ok' '+'
+ 'bindkey' '-s' '^[Om' '-'
+ 'bindkey' '-s' '^[Oj' '*'
+ 'bindkey' '-s' '^[Oo' '/'
+ 'bindkey' '-s' '^[OX' '='
+ 'bindkey' '-s' '^[OH' '^[[H'
+ 'bindkey' '-s' '^[OF' '^[[F'
+ 'bindkey' '-s' '^[OA' '^[[A'
+ 'bindkey' '-s' '^[OB' '^[[B'
+ 'bindkey' '-s' '^[OD' '^[[D'
+ 'bindkey' '-s' '^[OC' '^[[C'
+ 'bindkey' '-s' '^[[1~' '^[[H'
+ 'bindkey' '-s' '^[[4~' '^[[F'
+ 'bindkey' '-s' '^[Od' '^[[1;5D'
+ 'bindkey' '-s' '^[Oc' '^[[1;5C'
+ 'bindkey' '-s' '^[^[[D' '^[[1;3D'
+ 'bindkey' '-s' '^[^[[C' '^[[1;3C'
+ 'bindkey' '-s' '^[[7~' '^[[H'
+ 'bindkey' '-s' '^[[8~' '^[[F'
+ 'bindkey' '-s' '^[[3\^' '^[[3;5~'
+ 'bindkey' '-s' '^[^[[3~' '^[[3;3~'
+ 'bindkey' '-s' '^[[1;9D' '^[[1;3D'
+ 'bindkey' '-s' '^[[1;9C' '^[[1;3C'
+
+ 'bindkey' '^[[H' 'beginning-of-line'
+ 'bindkey' '^[[F' 'end-of-line'
+ 'bindkey' '^[[3~' 'delete-char'
+ 'bindkey' '^[[3;5~' 'kill-word'
+ 'bindkey' '^[[3;3~' 'kill-word'
+ 'bindkey' '^[k' 'backward-kill-line'
+ 'bindkey' '^[K' 'backward-kill-line'
+ 'bindkey' '^[j' 'kill-buffer'
+ 'bindkey' '^[J' 'kill-buffer'
+ 'bindkey' '^[/' 'redo'
+ 'bindkey' '^[[1;3D' 'backward-word'
+ 'bindkey' '^[[1;5D' 'backward-word'
+ 'bindkey' '^[[1;3C' 'forward-word'
+ 'bindkey' '^[[1;5C' 'forward-word'
+
+ if '[' '-n' "${_FOXSHELL_ORIG_CWD-}" ']'; then
+ 'builtin' 'cd' '-q' '--' "${(g:oce:)_FOXSHELL_ORIG_CWD}" 2>'/dev/null' || 'builtin' 'cd' '-q'
+ 'builtin' 'unset' '_FOXSHELL_ORIG_CWD'
+ 'builtin' 'eval' 'dirstack=()'
+ else
+ "builtin" "eval" '
+ if [[ "${(%):-%1/}" == "foxshell-tmux-cwd-"<->-<->-* ]]; then
+ [[ -r "./tmux"(#qNU) ]] &&
+ _foxshell_x="$("builtin" "source" "--" "./tmux" "list-clients" "-F" "#{client_tty} #{pane_id}" 2>"/dev/null")" &&
+ _foxshell_x="${${(@M)${(f)_foxshell_x}:#${${${(%):-%1/}#foxshell-tmux-cwd-<->-<->-}//.//} %<->}##* }" &&
+ [[ "$_foxshell_x" == "%"<-> ]] &&
+ _foxshell_x="$("builtin" "source" "--" "./tmux" "display-message" "-t" "$_foxshell_x" "-p" "#{pane_current_path}" 2>"/dev/null")" &&
+ [[ -n "$_foxshell_x" ]] &&
+ "builtin" "cd" "-q" "--" "$_foxshell_x" 2>"/dev/null" || "builtin" "cd" "-q"
+ "builtin" "unset" "_foxshell_x"
+ dirstack=()
+ fi'
+ fi
+ fi
+fi
+
+if '[' '-n' "${FOXSHELL-}" ']' &&
+ '[' "${FOXSHELL_URL-}" '=' 'https://git.foxdale.tech/Arctic/foxshell/raw/branch/main' ']' &&
+ '[' '-z' "${FOXSHELL##/*}" '-a' '-r' "$FOXSHELL"/foxshell/main.zsh ']'; then
+ if '.' "$FOXSHELL"/foxshell/main.zsh; then
+ 'setopt' 'aliases'
+ 'return'
+ fi
+ 'unset' '_foxshell_bootstrap'
+else
+ _foxshell_bootstrap='1'
+fi
+
+if '[' '-n' "${_foxshell_bootstrap-}" ']'; then
+ 'unset' '_foxshell_bootstrap'
+ (
+ if '[' '-z' "${FOXSHELL-}" ]; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: missing required parameter: \033[31mFOXSHELL\033[0m\n'
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'It must be set in \033[4m~/.zshenv\033[0m:\n'
+ else
+ >&2 'printf' 'It must be set in \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[32m:\033[0m \033[33m"${FOXSHELL:=${XDG_CACHE_HOME:-$HOME/.cache}/foxshell}"\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'Note: The leading colon (\033[32m:\033[0m) is necessary.\n'
+ 'exit' '1'
+ fi
+
+ if '[' '-n' "${FOXSHELL##/*}" ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid \033[1mFOXSHELL\033[0m parameter: \033[31m%s\033[0m\n' "$FOXSHELL"
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'It comes from \033[4m~/.zshenv\033[0m. Correct value example:\n'
+ else
+ >&2 'printf' 'It comes from \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m. Correct value example:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[32m:\033[0m \033[33m"${FOXSHELL:=${XDG_CACHE_HOME:-$HOME/.cache}/foxshell}"\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'Note: The leading colon (\033[32m:\033[0m) is necessary.\n'
+ 'exit' '1'
+ fi
+
+ if '[' '!' '-r' "$FOXSHELL"/foxshell.zsh ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: confusing \033[4mfoxshell.zsh\033[0m location\n'
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'Please fix \033[4m~/.zshenv\033[0m. Correct initialization example:\n'
+ else
+ >&2 'printf' 'Please fix \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m. Correct initialization example:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[32m:\033[0m \033[33m"${FOXSHELL:=${XDG_CACHE_HOME:-$HOME/.cache}/foxshell}"\033[0m\n'
+ >&2 'printf' ' \033[32m.\033[0m \033[4;33m"$FOXSHELL"\033[0;4m/foxshell.zsh\033[0m || \033[32mreturn\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'Note: The leading colon (\033[32m:\033[0m) and dot (\033[32m.\033[0m) are necessary.\n'
+ 'exit' '1'
+ fi
+
+ if '[' '-z' "${FOXSHELL_URL-}" ]; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: missing required parameter: \033[31mFOXSHELL_URL\033[0m\n'
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'It must be set in \033[4m~/.zshenv\033[0m:\n'
+ else
+ >&2 'printf' 'It must be set in \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' FOXSHELL_URL=\033[33m"https://git.foxdale.tech/Arctic/foxshell/raw/branch/main"\033[0m\n'
+ >&2 'printf' '\n'
+ 'exit' '1'
+ fi
+
+ v="${FOXSHELL_URL#https://git.foxdale.tech/Arctic/foxshell/raw/branch/}"
+ if '[' '-z' "$v" '-o' "$v" '=' "$FOXSHELL_URL" ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid \033[1mFOXSHELL_URL\033[0m: \033[31m%s\033[0m\n' "$FOXSHELL_URL"
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'It comes from \033[4m~/.zshenv\033[0m. Correct value example:\n'
+ else
+ >&2 'printf' 'It comes from \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m. Correct value example:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' FOXSHELL_URL=\033[33m"https://git.foxdale.tech/Arctic/foxshell/raw/branch/main"\033[0m\n'
+ >&2 'printf' '\n'
+ 'exit' '1'
+ fi
+
+ if '[' "$v" '!=' 'main' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: unsupported \033[1mFOXSHELL_URL\033[0m: \033[31m%s\033[0m\n' "$FOXSHELL_URL"
+ >&2 'printf' '\n'
+ if '[' "${ZDOTDIR:-$HOME}" '=' "$HOME" ']'; then
+ >&2 'printf' 'It comes from \033[4m~/.zshenv\033[0m. Correct value example:\n'
+ else
+ >&2 'printf' 'It comes from \033[4;33m"$ZDOTDIR"\033[0;4m/.zshenv\033[0m. Correct value example:\n'
+ fi
+ >&2 'printf' '\n'
+ >&2 'printf' ' FOXSHELL_URL=\033[33m"%s"\033[0m\n' "https://git.foxdale.tech/Arctic/foxshell/raw/branch/main"
+ >&2 'printf' '\n'
+ 'exit' '1'
+ fi
+
+ if '[' "$FOXSHELL_UPDATING" '=' '1' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: updating \033[1m%s\033[0m\n' "foxshell"
+ else
+ >&2 'printf' '\033[33mfoxshell\033[0m: installing \033[1m%s\033[0m\n' "foxshell"
+ fi
+
+ '[' "${EUID:-x}" '!=' '0' '-a' -n "${HOME-}" ']' &&
+ '[' "$FOXSHELL" = "$HOME"/.cache/foxshell ']' &&
+ '[' '!' '-d' "$HOME"/.cache ']' &&
+ 'command' 'mkdir' '-p' '--' "$HOME"/.cache 2>'/dev/null' &&
+ 'command' 'chmod' 'go-rwx' '--' "$HOME"/.cache 2>'/dev/null' || 'true'
+
+ 'command' 'rm' '-rf' '--' "$HOME"/.cache/foxshell 2>'/dev/null' &&
+ 'command' 'rmdir' '--' "$HOME"/.cache 2>'/dev/null'
+
+ 'command' 'mkdir' '-p' '--' "$FOXSHELL" || 'exit'
+
+ tmpdir="$('command' 'mktemp' '-d' "$FOXSHELL"/tmp.XXXXXXXXXX)" || 'exit'
+ 'command' 'chmod' 'go-rwx' '--' "$tmpdir" || 'exit'
+ 'set' '-E'
+ 'trap' ''command' 'rm' '-rf' '--' "$tmpdir"; 'exit' '1' 'ERR'
+ 'set' '+E'
+
+ dir="$FOXSHELL"/foxshell
+ FOXSHELL_PACKAGE_NAME='foxshell'
+ FOXSHELL_PACKAGE_DIR="$tmpdir"/foxshell-main
+ FOXSHELL_PACKAGE_URL="$FOXSHELL_URL"
+
+ # Download from git repository
+ url="https://git.foxdale.tech/Arctic/foxshell/archive/main.tar.gz"
+
+ if 'command' -v 'curl' >'/dev/null' 2>&1; then
+ 'command' 'curl' '-fsSL' '--' "$url" | {
+ 'command' 'tar' '-C' "$tmpdir" '-xzf' '-'
+ } || 'exit'
+ elif 'command' -v 'wget' >'/dev/null' 2>&1; then
+ 'command' 'wget' '-O' '-' '--' "$url" | {
+ 'command' 'tar' '-C' "$tmpdir" '-xzf' '-'
+ } || 'exit'
+ else
+ >&2 'printf' '\033[33mfoxshell\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
+ 'exit' '1'
+ fi
+
+ 'command' 'mv' '--' "$tmpdir"/foxshell-main "$FOXSHELL_PACKAGE_DIR" || 'exit'
+
+ 'export' 'FOXSHELL'
+ 'export' 'FOXSHELL_PACKAGE_NAME'
+ 'export' 'FOXSHELL_PACKAGE_DIR'
+ 'export' 'FOXSHELL_PACKAGE_URL'
+
+ if '[' "$FOXSHELL_UPDATING" '=' '1' ']'; then
+ "sh" "$tmpdir"/foxshell-main/sc/setup '-n' "$FOXSHELL" '-o' "$FOXSHELL_UPDATING" || 'exit'
+ else
+ "sh" "$tmpdir"/foxshell-main/sc/setup '-n' "$FOXSHELL" || 'exit'
+ fi
+
+ 'command' 'mv' '-f' '--' "$tmpdir"/foxshell-main "$dir" || 'exit'
+
+ 'trap' '-' 'ERR'
+ 'command' 'rm' '-rf' '--' "$tmpdir"
+
+ ) && '.' "$FOXSHELL"/foxshell/main.zsh && 'setopt' 'aliases' && 'return'
+
+ case "${FOXSHELL_BOOTSTRAPPING-}" in
+ '')
+ if '[' '-n' "${_foxshell_exe-}" ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: failed to initialize \033[1mfoxshell\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'This is most likely due to a bug in \033[4mfoxshell\033[0m. Please report it at:\n'
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[4mhttps://git.foxdale.tech/Arctic/foxshell/issues\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'If foxshell is working fine in another terminal, you can try restarting\n'
+ >&2 'printf' 'zsh in this terminal. If it does not help, reinstall foxshell.\n'
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[32msh\033[0m -c \033[33m"\033[0m$(\033[32mcurl\033[0m -fsSL \033[4mhttps://git.foxdale.tech/Arctic/foxshell/raw/branch/main/install\033[0m)\033[33m"\033[0m\n'
+ >&2 'printf' '\n'
+ 'exit' '1'
+ fi
+ ;;
+ '1')
+ >&2 'printf' '\033[33mfoxshell\033[0m: failed to bootstrap \033[1mfoxshell\033[0m\n'
+ >&2 'printf' '\n'
+ >&2 'printf' 'This is most likely due to a bug in \033[4mfoxshell\033[0m. Please report it at:\n'
+ >&2 'printf' '\n'
+ >&2 'printf' ' \033[4mhttps://git.foxdale.tech/Arctic/foxshell/issues\033[0m\n'
+ >&2 'printf' '\n'
+ 'exit' '1'
+ ;;
+ esac
+fi
+
+'setopt' 'aliases'
\ No newline at end of file
diff --git a/install b/install
new file mode 100755
index 0000000..d319b4b
--- /dev/null
+++ b/install
@@ -0,0 +1,325 @@
+#!/bin/sh
+
+if '[' '-n' "${ZSH_VERSION-}" ']'; then
+ 'emulate' 'sh' '-o' 'err_exit' '-o' 'no_unset'
+else
+ 'set' '-ue'
+fi
+
+platform="$('command' 'uname' '-sm')"
+platform="$('printf' '%s' "$platform" | 'command' 'tr' '[A-Z]' '[a-z]')"
+
+case "$platform" in
+ 'darwin arm64');;
+ 'darwin x86_64');;
+ 'linux aarch64');;
+ 'linux armv6l');;
+ 'linux armv7l');;
+ 'linux armv8l');;
+ 'linux x86_64');;
+ 'linux i686');;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: sorry, unsupported platform: \033[31m%s\033[0m\n' "$platform"
+ 'exit' '1'
+ ;;
+esac
+
+if command -v 'curl' >'/dev/null' 2>&1; then
+ fetch='command curl -fsSLo'
+elif command -v 'wget' >'/dev/null' 2>&1; then
+ fetch='command wget -O'
+else
+ >&2 'printf' '\033[33mfoxshell\033[0m: please install \033[32mcurl\033[0m or \033[32mwget\033[0m\n'
+ 'exit' '1'
+fi
+
+if '[' '!' '-d' "${HOME-}" ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: \033[1m$HOME\033[0m is not a directory\n'
+ 'exit' '1'
+fi
+
+euid="$('command' 'id' '-u')"
+if '[' "$euid" '=' '0' ']'; then
+ home_ls="$('command' 'ls' '-ld' '--' "$HOME")"
+ home_owner="$('printf' '%s\n' "$home_ls" | 'command' 'awk' 'NR==1 {print $3}')"
+ if '[' "$home_owner" '!=' 'root' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: please retry without \033[4;32msudo\033[0m\n'
+ 'exit' '1'
+ fi
+fi
+
+if '[' '!' '-t' '0' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: standard input is not a \033[1mTTY\033[0m\n'
+ 'exit' '1'
+fi
+
+if '[' '!' '-t' '1' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: standard output is not a \033[1mTTY\033[0m\n'
+ 'exit' '1'
+fi
+
+if '[' '!' '-t' '2' ']'; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: standard error is not a \033[1mTTY\033[0m\n'
+ 'exit' '1'
+fi
+
+saved_tty_settings="$('command' 'stty' '-g')"
+
+zshenv=''
+zshrc=''
+foxshell=''
+
+cleanup() {
+ 'trap' '-' 'INT' 'TERM' 'EXIT'
+ 'command' 'rm' '-f' '--' "$zshenv" "$zshrc" "${zshrc:+$zshrc.bak}" "$foxshell"
+ 'command' 'stty' "$saved_tty_settings"
+}
+
+'trap' 'cleanup' 'INT' 'TERM' 'EXIT'
+
+lf='
+'
+
+read_choice() {
+ choice=''
+ 'command' 'stty' '-icanon' 'min' '1' 'time' '0'
+ while :; do
+ c="$('command' 'dd' 'bs=1' 'count=1' 2>'/dev/null' && 'echo' 'x')"
+ choice="$choice${c%x}"
+ n="$('printf' '%s' "$choice" | 'command' 'wc' '-m')"
+ '[' "$n" '-eq' '0' ']' || 'break'
+ done
+ 'command' 'stty' "$saved_tty_settings"
+ '[' "$choice" '=' "$lf" ] || 'echo'
+}
+
+>&2 'printf' 'Welcome to FoxShell!\n'
+>&2 'printf' '\n'
+>&2 'printf' 'What kind of \033[1mkeyboard\033[0m are you using?\n'
+>&2 'printf' '\n'
+>&2 'printf' ' \033[1m(1)\033[0m Mac. It has \033[32mOption\033[0m key(s) and does not have \033[33mAlt\033[0m.\n'
+>&2 'printf' ' \033[1m(2)\033[0m PC. It has \033[32mAlt\033[0m key(s) and does not have \033[33mOption\033[0m.\n'
+>&2 'printf' ' \033[1m(q)\033[0m Quit and do nothing.\n'
+>&2 'printf' '\n'
+while 'true'; do
+ >&2 'printf' '\033[1mChoice [12q]:\033[0m '
+ 'read_choice'
+ case "$choice" in
+ '1')
+ bs_key='Delete'
+ zshrc_suffix='.mac'
+ 'break'
+ ;;
+ '2')
+ bs_key='Backspace'
+ zshrc_suffix=''
+ 'break'
+ ;;
+ 'q'|'Q')
+ 'exit' '1'
+ ;;
+ "$lf")
+ ;;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid choice: \033[31m%s\033[0m\n' "$choice"
+ ;;
+ esac
+done
+
+>&2 'printf' '\n'
+>&2 'printf' 'What \033[1mkeybindings\033[0m do you prefer?\n'
+>&2 'printf' '\n'
+>&2 'printf' ' \033[1m(1)\033[0m Standard. I delete characters with \033[33m%s\033[0m key.\n' "$bs_key"
+>&2 'printf' ' \033[1m(2)\033[0m Like in \033[32mvi\033[0m. I delete characters with \033[33mX\033[0m key in \033[33mcommand mode\033[0m.\n'
+>&2 'printf' ' \033[1m(q)\033[0m Quit and do nothing.\n'
+>&2 'printf' '\n'
+while 'true'; do
+ >&2 'printf' '\033[1mChoice [12q]:\033[0m '
+ 'read_choice'
+ case "$choice" in
+ '1')
+ 'break'
+ ;;
+ '2')
+ >&2 'printf' '\n'
+ >&2 'printf' 'Sorry, \033[32mvi\033[0m keybindings are \033[31mnot supported\033[0m yet.\n'
+ 'exit' '1'
+ 'break'
+ ;;
+ 'q'|'Q')
+ 'exit' '1'
+ ;;
+ "$lf")
+ ;;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid choice: \033[31m%s\033[0m\n' "$choice"
+ ;;
+ esac
+done
+
+>&2 'printf' '\n'
+>&2 'printf' 'Do you want \033[32mzsh\033[0m to always run in \033[32mtmux\033[0m?\n'
+>&2 'printf' '\n'
+>&2 'printf' ' \033[1m(y)\033[0m Yes.\n'
+>&2 'printf' ' \033[1m(n)\033[0m No.\n'
+>&2 'printf' ' \033[1m(q)\033[0m Quit and do nothing.\n'
+>&2 'printf' '\n'
+while 'true'; do
+ >&2 'printf' '\033[1mChoice [ynq]:\033[0m '
+ 'read_choice'
+ case "$choice" in
+ 'y'|'Y')
+ tmux='1'
+ 'break'
+ ;;
+ 'n'|'N')
+ tmux='0'
+ 'break'
+ ;;
+ 'q'|'Q')
+ 'exit' '1'
+ ;;
+ "$lf")
+ ;;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid choice: \033[31m%s\033[0m\n' "$choice"
+ ;;
+ esac
+done
+
+>&2 'printf' '\n'
+>&2 'printf' 'Do you use \033[32mdirenv\033[0m?\n'
+>&2 'printf' '\n'
+>&2 'printf' ' \033[1m(y)\033[0m Yes.\n'
+>&2 'printf' ' \033[1m(n)\033[0m No.\n'
+>&2 'printf' ' \033[1m(q)\033[0m Quit and do nothing.\n'
+>&2 'printf' '\n'
+while 'true'; do
+ >&2 'printf' '\033[1mChoice [ynq]:\033[0m '
+ 'read_choice'
+ case "$choice" in
+ 'y'|'Y')
+ direnv='1'
+ 'break'
+ ;;
+ 'n'|'N')
+ direnv='0'
+ 'break'
+ ;;
+ 'q'|'Q')
+ 'exit' '1'
+ ;;
+ "$lf")
+ ;;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid choice: \033[31m%s\033[0m\n' "$choice"
+ ;;
+ esac
+done
+
+>&2 'printf' '\n'
+>&2 'printf' 'Do you want to enable \033[32mSSH\033[0m teleportation?\n'
+>&2 'printf' '\n'
+>&2 'printf' ' \033[1m(y)\033[0m Yes.\n'
+>&2 'printf' ' \033[1m(n)\033[0m No.\n'
+>&2 'printf' ' \033[1m(q)\033[0m Quit and do nothing.\n'
+>&2 'printf' '\n'
+while 'true'; do
+ >&2 'printf' '\033[1mChoice [ynq]:\033[0m '
+ 'read_choice'
+ case "$choice" in
+ 'y'|'Y')
+ ssh='1'
+ 'break'
+ ;;
+ 'n'|'N')
+ ssh='0'
+ 'break'
+ ;;
+ 'q'|'Q')
+ 'exit' '1'
+ ;;
+ "$lf")
+ ;;
+ *)
+ >&2 'printf' '\033[33mfoxshell\033[0m: invalid choice: \033[31m%s\033[0m\n' "$choice"
+ ;;
+ esac
+done
+
+if 'command' 'mktemp' '-u' >'/dev/null' 2>&1; then
+ foxshell="$('command' 'mktemp' "$HOME"/.foxshell.XXXXXXXXXX)"
+else
+ foxshell="$HOME"/.foxshell.tmp."$$"
+fi
+
+url='https://git.foxdale.tech/Arctic/foxshell/raw/branch/main'
+
+>&2 printf '\033[33mfoxshell\033[0m: fetching \033[4mfoxshell.zsh\033[0m from \033[1mgit.foxdale.tech/Arctic/foxshell\033[0m\n'
+if ! err="$($fetch "$foxshell" '--' "$url"/foxshell.zsh 2>&1)"; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: %s\n' "$err"
+ >&2 'printf' '\033[33mfoxshell\033[0m: failed to download \033[31m%s\033[0m\n' "$url"/foxshell.zsh
+ 'command' 'rm' '-rf' '--' "$foxshell" 2>'/dev/null'
+ 'exit' '1'
+fi
+
+>&2 'printf' '\033[33mfoxshell\033[0m: generating \033[4m~/.zshenv\033[0m\n'
+if ! err="$($fetch "$HOME"/.zshenv.tmp -- "$url"/.zshenv 2>&1)"; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: %s\n' "$err"
+ >&2 'printf' '\033[33mfoxshell\033[0m: failed to download \033[31m%s\033[0m\n' "$url"/.zshenv
+ 'exit' '1'
+fi
+
+>&2 'printf' '\033[33mfoxshell\033[0m: generating \033[4m~/.zshrc\033[0m\n'
+if ! err="$($fetch "$HOME"/.zshrc.tmp -- "$url"/.zshrc"$zshrc_suffix" 2>&1)"; then
+ >&2 'printf' '\033[33mfoxshell\033[0m: %s\n' "$err"
+ >&2 'printf' '\033[33mfoxshell\033[0m: failed to download \033[31m%s\033[0m\n' "$url"/.zshrc"$zshrc_suffix"
+ 'exit' '1'
+fi
+
+if '[' "$tmux" '=' '1' ']'; then
+ 'command' 'awk' "/Mark up shell's output/ {print \"# Start tmux if not already in tmux.\"; print \"zstyle ':foxshell:' start-tmux command tmux -u new -A -D -t foxshell\"; print \"\"; print \"# Whether to move prompt to the bottom when zsh starts and on Ctrl+L.\"; print \"zstyle ':foxshell:' prompt-at-bottom 'no'\"; print \"\"} 1" "$HOME"/.zshrc.tmp >"$HOME"/.zshrc.bak
+else
+ 'command' 'awk' "/Mark up shell's output/ {print \"# Don't start tmux.\"; print \"zstyle ':foxshell:' start-tmux no\"; print \"\"} 1" "$HOME"/.zshrc.tmp >"$HOME"/.zshrc.bak
+fi
+
+'command' 'mv' '--' "$HOME"/.zshrc.bak "$HOME"/.zshrc.tmp
+
+if '[' "$direnv" '=' '1' ']'; then
+ 'command' 'awk' "/Enable direnv/ {print \"# Enable direnv to automatically source .envrc files.\"; print \"zstyle ':foxshell:direnv' enable 'yes'\"; print \"\"} 1" "$HOME"/.zshrc.tmp >"$HOME"/.zshrc.bak
+ 'command' 'mv' '--' "$HOME"/.zshrc.bak "$HOME"/.zshrc.tmp
+fi
+
+if '[' "$ssh" '=' '1' ']'; then
+ 'command' 'awk' "/Enable.*SSH/ {print \"# Enable automatic teleportation of foxshell over SSH.\"; print \"zstyle ':foxshell:ssh:*' enable 'yes'\"; print \"\"} 1" "$HOME"/.zshrc.tmp >"$HOME"/.zshrc.bak
+ 'command' 'mv' '--' "$HOME"/.zshrc.bak "$HOME"/.zshrc.tmp
+fi
+
+FOXSHELL="${XDG_CACHE_HOME:-$HOME/.cache}/foxshell"
+
+if '[' '-e' "$HOME"/.zshenv ']'; then
+ 'command' 'cp' '--' "$HOME"/.zshenv "$HOME"/.zshenv.bak
+fi
+'command' 'rm' '-rf' '--' "$FOXSHELL"
+'command' 'mkdir' '-p' -- "$FOXSHELL"
+
+zshenv="$HOME"/.zshenv.tmp
+zshrc="$HOME"/.zshrc.tmp
+
+'command' 'sed' "s|\${XDG_CACHE_HOME:-\$HOME/.cache}/foxshell|$FOXSHELL|g" "$zshenv" >"$zshenv.bak"
+'command' 'mv' '--' "$zshenv.bak" "$zshenv"
+
+if '[' '-e' "$HOME"/.zshrc ']'; then
+ 'command' 'cp' '--' "$HOME"/.zshrc "$HOME"/.zshrc.bak
+fi
+
+'command' 'mv' '--' "$zshenv" "$HOME"/.zshenv
+'command' 'mv' '--' "$zshrc" "$HOME"/.zshrc
+'command' 'mv' '--' "$foxshell" "$FOXSHELL"/foxshell.zsh
+
+>&2 'printf' '\033[33mfoxshell\033[0m: restarting \033[32mzsh\033[0m\n'
+if '[' '-n' "${TMUX-}" ']'; then
+ 'exec' "$SHELL" '-l'
+else
+ 'exec' "$SHELL" '-l' '-c' 'exec zsh'
+fi
\ No newline at end of file
diff --git a/version b/version
index f6a2a7c..bb56d82 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-500000033
+100000001
diff --git a/z4h.zsh b/z4h.zsh
index 0cd5ff5..060cd40 100644
--- a/z4h.zsh
+++ b/z4h.zsh
@@ -137,16 +137,16 @@ if '[' '-n' "${ZSH_VERSION-}" ']'; then
fi
fi
-if '[' '-n' "${Z4H-}" ']' &&
- '[' "${Z4H_URL-}" '=' 'https://raw.githubusercontent.com/romkatv/zsh4humans/v5' ']' &&
- '[' '-z' "${Z4H##/*}" '-a' '-r' "$Z4H"/zsh4humans/main.zsh ']'; then
- if '.' "$Z4H"/zsh4humans/main.zsh; then
+if '[' '-n' "${FOXSHELL-}" ']' &&
+ '[' "${FOXSHELL_URL-}" '=' 'https://git.foxdale.tech/Arctic/foxshell/raw/branch/main' ']' &&
+ '[' '-z' "${FOXSHELL##/*}" '-a' '-r' "$FOXSHELL"/foxshell/main.zsh ']'; then
+ if '.' "$FOXSHELL"/foxshell/main.zsh; then
'setopt' 'aliases'
'return'
fi
- 'unset' '_z4h_bootstrap'
+ 'unset' '_foxshell_bootstrap'
else
- _z4h_bootstrap='1'
+ _foxshell_bootstrap='1'
fi
if '[' '-n' "${_z4h_bootstrap-}" ']'; then