├── .gitattributes ├── LICENSE ├── README.md ├── configs ├── agnoster │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── antidote │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zsh_plugins.txt │ │ ├── .zshenv │ │ └── .zshrc ├── compsys │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── direnv │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── diy++ │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── diy++fsyh │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── diy++unsafe │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── diy+ │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── diy │ ├── setup │ └── skel │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── git-branch │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── kitty0 │ ├── setup │ └── skel │ │ └── .zshenv ├── kitty1 │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── zsh │ │ └── .gitkeep ├── kitty2 │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── zsh │ │ └── .gitkeep ├── metaroundy │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── minimal │ ├── setup │ └── skel │ │ ├── .zsh │ │ ├── .zshrc │ │ ├── aliases.zsh │ │ ├── comp.zsh │ │ ├── env.zsh │ │ ├── keys.zsh │ │ └── prompt.zsh │ │ └── .zshrc ├── no-rcs │ ├── setup │ └── skel │ │ └── .zshenv ├── ohmyzsh+ │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── ohmyzsh │ └── setup ├── powerlevel10k-full │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .zshenv │ │ └── .zshrc ├── powerlevel10k │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .zshenv │ │ └── .zshrc ├── prezto+ │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zpreztorc │ │ ├── .zshenv │ │ └── .zshrc ├── prezto+notmux │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .zpreztorc │ │ ├── .zshenv │ │ └── .zshrc ├── prezto │ └── setup ├── pristine │ └── setup ├── starship │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── synthetic │ ├── setup │ └── skel │ │ └── .zshenv ├── tmux │ ├── setup │ └── skel │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zcomet │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zgenom │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zim+ │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zimrc │ │ ├── .zshenv │ │ └── .zshrc ├── zim │ └── setup ├── zinit-turbo │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zinit │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zplug │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zsh-autosuggestions │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc ├── zsh-defer │ ├── setup │ └── skel │ │ ├── .p10k.zsh │ │ ├── .tmux.conf │ │ ├── .zshenv │ │ └── .zshrc ├── zsh-launchpad │ ├── setup │ └── skel │ │ └── .zshrc ├── zsh-syntax-highlighting │ ├── setup │ └── skel │ │ ├── .zshenv │ │ └── .zshrc └── zsh4humans │ ├── setup │ └── skel │ └── .p10k.zsh ├── dbg ├── replay └── timeline ├── doc ├── linux-desktop.md ├── linux-desktop.txt ├── linux-raspberrypi.md ├── linux-raspberrypi.txt ├── macos-laptop.md ├── macos-laptop.txt └── print-table ├── human-bench ├── internal ├── -zb-benchmark-input ├── -zb-benchmark-prompt ├── benchmark-many ├── create-repo ├── install-config ├── install-deps ├── install-tmux └── zdotdir │ └── .zshenv ├── zsh-bench └── zsh-playground /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Roman Perepelitsa 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /configs/agnoster/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/agnoster/agnoster-zsh-theme.git 8 | -------------------------------------------------------------------------------- /configs/agnoster/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/agnoster/skel/.zshrc: -------------------------------------------------------------------------------- 1 | setopt prompt_subst 2 | source ~/agnoster-zsh-theme/agnoster.zsh-theme 3 | -------------------------------------------------------------------------------- /configs/antidote/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/antidote/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/antidote/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/antidote/skel/.zsh_plugins.txt: -------------------------------------------------------------------------------- 1 | zsh-users/zsh-syntax-highlighting 2 | zsh-users/zsh-autosuggestions 3 | romkatv/powerlevel10k 4 | -------------------------------------------------------------------------------- /configs/antidote/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/antidote/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | # Build ~/.zsh_plugins.zsh from ~/.zsh_plugins.txt unless the former is newer. 7 | if [[ ! ~/.zsh_plugins.zsh -nt ~/.zsh_plugins.txt ]]; then 8 | # Clone antidote if it's missing. 9 | if [[ ! -e ~/.antidote ]]; then 10 | git clone --depth=1 https://github.com/mattmc3/antidote.git ~/.antidote 11 | fi 12 | # Build ~/.zsh_plugins.txt in a subshell. 13 | ( 14 | source ~/.antidote/antidote.zsh 15 | antidote bundle <~/.zsh_plugins.txt >~/.zsh_plugins.zsh 16 | ) 17 | fi 18 | 19 | # Activate Powerlevel10k Instant Prompt. 20 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 21 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 22 | fi 23 | 24 | # Enable the "new" completion system (compsys). 25 | autoload -Uz compinit 26 | compinit 27 | if [[ ! ~/.zcompdump.zwc -nt ~/.zcompdump ]]; then 28 | zcompile -R -- ~/.zcompdump.zwc ~/.zcompdump 29 | fi 30 | 31 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 32 | 33 | # Load plugins. 34 | source ~/.zsh_plugins.zsh 35 | source ~/.p10k.zsh 36 | -------------------------------------------------------------------------------- /configs/compsys/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/compsys/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/compsys/skel/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -Uz compinit && compinit 2 | -------------------------------------------------------------------------------- /configs/direnv/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/direnv/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/direnv/skel/.zshrc: -------------------------------------------------------------------------------- 1 | eval "$(direnv hook zsh)" 2 | -------------------------------------------------------------------------------- /configs/diy++/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/diy++/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/diy++/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/diy++/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/diy++/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | function zcompile-many() { 7 | local f 8 | for f; do zcompile -R -- "$f".zwc "$f"; done 9 | } 10 | 11 | # Clone and compile to wordcode missing plugins. 12 | if [[ ! -e ~/zsh-syntax-highlighting ]]; then 13 | git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/zsh-syntax-highlighting 14 | zcompile-many ~/zsh-syntax-highlighting/{zsh-syntax-highlighting.zsh,highlighters/*/*.zsh} 15 | fi 16 | if [[ ! -e ~/zsh-autosuggestions ]]; then 17 | git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ~/zsh-autosuggestions 18 | zcompile-many ~/zsh-autosuggestions/{zsh-autosuggestions.zsh,src/**/*.zsh} 19 | fi 20 | if [[ ! -e ~/powerlevel10k ]]; then 21 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k 22 | make -C ~/powerlevel10k pkg 23 | fi 24 | 25 | # Activate Powerlevel10k Instant Prompt. 26 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 27 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 28 | fi 29 | 30 | # Enable the "new" completion system (compsys). 31 | autoload -Uz compinit && compinit 32 | [[ ~/.zcompdump.zwc -nt ~/.zcompdump ]] || zcompile-many ~/.zcompdump 33 | unfunction zcompile-many 34 | 35 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 36 | 37 | # Load plugins. 38 | source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 39 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 40 | source ~/powerlevel10k/powerlevel10k.zsh-theme 41 | source ~/.p10k.zsh 42 | -------------------------------------------------------------------------------- /configs/diy++fsyh/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/diy++fsyh/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/diy++fsyh/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/diy++fsyh/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/diy++fsyh/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | function zcompile-many() { 7 | local f 8 | for f; do zcompile -R -- "$f".zwc "$f"; done 9 | } 10 | 11 | # Clone and compile to wordcode missing plugins. 12 | if [[ ! -e ~/fast-syntax-highlighting ]]; then 13 | git clone --depth=1 https://github.com/zdharma-continuum/fast-syntax-highlighting.git ~/fast-syntax-highlighting 14 | mv -- ~/fast-syntax-highlighting/{'→chroma','tmp'} 15 | zcompile-many ~/fast-syntax-highlighting/{fast*,.fast*,**/*.ch,**/*.zsh} 16 | mv -- ~/fast-syntax-highlighting/{'tmp','→chroma'} 17 | fi 18 | if [[ ! -e ~/zsh-autosuggestions ]]; then 19 | git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ~/zsh-autosuggestions 20 | zcompile-many ~/zsh-autosuggestions/{zsh-autosuggestions.zsh,src/**/*.zsh} 21 | fi 22 | if [[ ! -e ~/powerlevel10k ]]; then 23 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k 24 | make -C ~/powerlevel10k pkg 25 | fi 26 | 27 | # Activate Powerlevel10k Instant Prompt. 28 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 29 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 30 | fi 31 | 32 | # Enable the "new" completion system (compsys). 33 | autoload -Uz compinit && compinit 34 | [[ ~/.zcompdump.zwc -nt ~/.zcompdump ]] || zcompile-many ~/.zcompdump 35 | unfunction zcompile-many 36 | 37 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 38 | 39 | # Load plugins. 40 | source ~/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 41 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 42 | source ~/powerlevel10k/powerlevel10k.zsh-theme 43 | source ~/.p10k.zsh 44 | -------------------------------------------------------------------------------- /configs/diy++unsafe/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/diy++unsafe/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/diy++unsafe/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/diy++unsafe/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/diy++unsafe/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 6 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 7 | fi 8 | 9 | function zcompile-many() { 10 | local f 11 | for f; do zcompile -R -- "$f".zwc "$f"; done 12 | } 13 | 14 | if [[ ! -e ~/zsh-syntax-highlighting ]]; then 15 | git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/zsh-syntax-highlighting 16 | zcompile-many ~/zsh-syntax-highlighting/{zsh-syntax-highlighting.zsh,highlighters/*/*.zsh} 17 | fi 18 | if [[ ! -e ~/zsh-autosuggestions ]]; then 19 | git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ~/zsh-autosuggestions 20 | zcompile-many ~/zsh-autosuggestions/{zsh-autosuggestions.zsh,src/**/*.zsh} 21 | fi 22 | if [[ ! -e ~/powerlevel10k ]]; then 23 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k 24 | make -C ~/powerlevel10k pkg 25 | fi 26 | 27 | autoload -Uz compinit 28 | compinit -C 29 | 30 | [[ ~/.zcompdump.zwc -nt ~/.zcompdump ]] || zcompile-many ~/.zcompdump 31 | [[ ~/.zshenv.zwc -nt ~/.zshenv ]] || zcompile-many ~/.zshenv 32 | [[ ~/.zshrc.zwc -nt ~/.zshrc ]] || zcompile-many ~/.zshrc 33 | [[ ~/.p10k.zsh.zwc -nt ~/.p10k.zsh ]] || zcompile-many ~/.p10k.zsh 34 | unfunction zcompile-many 35 | 36 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 37 | 38 | source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 39 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 40 | source ~/powerlevel10k/powerlevel10k.zsh-theme 41 | source ~/.p10k.zsh 42 | -------------------------------------------------------------------------------- /configs/diy+/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/diy+/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/diy+/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/diy+/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/diy+/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ ! -e ~/zsh-syntax-highlighting ]]; then 6 | git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/zsh-syntax-highlighting 7 | fi 8 | if [[ ! -e ~/zsh-autosuggestions ]]; then 9 | git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ~/zsh-autosuggestions 10 | fi 11 | if [[ ! -e ~/powerlevel10k ]]; then 12 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k 13 | fi 14 | 15 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 16 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 17 | fi 18 | 19 | autoload -Uz compinit 20 | compinit 21 | 22 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 23 | 24 | source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 25 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 26 | source ~/powerlevel10k/powerlevel10k.zsh-theme 27 | source ~/.p10k.zsh 28 | -------------------------------------------------------------------------------- /configs/diy/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git 8 | git clone -q --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git 9 | -------------------------------------------------------------------------------- /configs/diy/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/diy/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/diy/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | # Enable the "new" completion system (compsys). 7 | autoload -Uz compinit && compinit 8 | 9 | # Enable syntax highlighting. 10 | source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 11 | # Enable autosuggestions. 12 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 13 | 14 | # Configure prompt to show the current working directory and git branch. 15 | autoload -Uz vcs_info add-zsh-hook 16 | add-zsh-hook precmd vcs_info 17 | PS1='%~ $vcs_info_msg_0_' 18 | setopt prompt_subst 19 | -------------------------------------------------------------------------------- /configs/git-branch/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git 8 | git clone -q --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git 9 | -------------------------------------------------------------------------------- /configs/git-branch/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/git-branch/skel/.zshrc: -------------------------------------------------------------------------------- 1 | autoload -Uz vcs_info 2 | precmd() vcs_info 3 | PS1='%~$vcs_info_msg_0_ ' 4 | setopt prompt_subst 5 | -------------------------------------------------------------------------------- /configs/kitty0/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/kitty0/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/kitty1/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | git clone -q --depth=1 https://github.com/kovidgoyal/kitty.git 7 | -------------------------------------------------------------------------------- /configs/kitty1/skel/.zshenv: -------------------------------------------------------------------------------- 1 | export KITTY_SHELL_INTEGRATION=enabled 2 | export KITTY_ORIG_ZDOTDIR=~/zsh 3 | export KITTY_INSTALLATION_DIR=~/kitty 4 | export ZDOTDIR=~/kitty/shell-integration/zsh 5 | 6 | source ~/kitty/shell-integration/zsh/.zshenv 7 | 8 | typeset +x ZDOTDIR 9 | setopt no_global_rcs 10 | -------------------------------------------------------------------------------- /configs/kitty1/skel/zsh/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romkatv/zsh-bench/d7f9f821688bdff9365e630a8aaeba1fd90499b1/configs/kitty1/skel/zsh/.gitkeep -------------------------------------------------------------------------------- /configs/kitty2/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | git clone -q --depth=1 -b zsh-integration https://github.com/romkatv/kitty.git 7 | -------------------------------------------------------------------------------- /configs/kitty2/skel/.zshenv: -------------------------------------------------------------------------------- 1 | export KITTY_SHELL_INTEGRATION=enabled 2 | export KITTY_ORIG_ZDOTDIR=~/zsh 3 | export KITTY_INSTALLATION_DIR=~/kitty 4 | export ZDOTDIR=~/kitty/shell-integration/zsh 5 | 6 | source ~/kitty/shell-integration/zsh/.zshenv 7 | 8 | typeset +x ZDOTDIR 9 | setopt no_global_rcs 10 | -------------------------------------------------------------------------------- /configs/kitty2/skel/zsh/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romkatv/zsh-bench/d7f9f821688bdff9365e630a8aaeba1fd90499b1/configs/kitty2/skel/zsh/.gitkeep -------------------------------------------------------------------------------- /configs/metaroundy/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/metaory/zsh-roundy-prompt.git 8 | -------------------------------------------------------------------------------- /configs/metaroundy/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/metaroundy/skel/.zshrc: -------------------------------------------------------------------------------- 1 | setopt prompt_subst no_prompt_bang 2 | source ~/zsh-roundy-prompt/roundy.zsh 3 | -------------------------------------------------------------------------------- /configs/minimal/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/.zshrc: -------------------------------------------------------------------------------- 1 | emulate zsh 2 | setopt autocd autopushd cbases extendedglob extendedhistory globdots globstarshort \ 3 | histexpiredupsfirst histfindnodups histignoredups histignorespace histsavenodups \ 4 | histverify interactivecomments magicequalsubst noautoremoveslash nobeep nobgnice \ 5 | noflowcontrol nomultios nonotify rcquotes rmstarsilent sharehistory \ 6 | transientrprompt 7 | 8 | : ${ZDOTDIR:=${${(%):-%N}:A:h}} 9 | 10 | zmodload zsh/terminfo 11 | autoload -Uz compinit bashcompinit zmv run-help ${^fpath}/run-help-^*.zwc(N:t) 12 | [[ -v aliases[run-help] ]] && unalias run-help 13 | 14 | HISTSIZE=1000000000 15 | SAVEHIST=1000000000 16 | HISTFILE=$ZDOTDIR/.zsh_history 17 | [[ -e $HISTFILE || -n ${HISTFILE:h}(#qNU) ]] || HISTFILE+=.$EUID 18 | 19 | DIRSTACKSIZE=1000 20 | TIMEFMT='user=%U system=%S cpu=%P total=%*E' 21 | zle_highlight=(paste:none) 22 | 23 | source -- $ZDOTDIR/keys.zsh 24 | source -- $ZDOTDIR/env.zsh 25 | source -- $ZDOTDIR/comp.zsh 26 | source -- $ZDOTDIR/prompt.zsh 27 | source -- $ZDOTDIR/aliases.zsh 28 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/aliases.zsh: -------------------------------------------------------------------------------- 1 | set -- grep '--color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}' 2 | if [[ -v commands[dircolors] ]]; then 3 | set -- $@ diff '--color=auto' ls '--color=auto' 4 | else 5 | set -- $@ ls '-G' 6 | fi 7 | for 1 2; [[ ${1:c:A:t} == busybox* ]] || alias $1="$1 $2" 8 | 9 | alias ls="${aliases[ls]:-ls} -A" 10 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/comp.zsh: -------------------------------------------------------------------------------- 1 | zstyle ':completion:*' squeeze-slashes yes 2 | zstyle ':completion:*:paths' accept-exact-dirs yes 3 | zstyle ':completion:*' single-ignored show 4 | zstyle ':completion:*:rm:*' ignore-line other 5 | zstyle ':completion:*:kill:*' ignore-line other 6 | zstyle ':completion:*:diff:*' ignore-line other 7 | zstyle ':completion:*' menu yes select 8 | zstyle ':completion:*:-tilde-:*' tag-order directory-stack named-directories users 9 | zstyle ':completion:*:-subscript-:*' tag-order 'indexes parameters' 10 | zstyle ':completion:*' list-colors ${${(s.:.)LS_COLORS}:#no=*} 11 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 12 | zstyle ':completion:*:rm:*' file-patterns '*:all-files' 13 | zstyle ':completion:*:functions' ignored-patterns '-*|_*' 14 | zstyle ':completion:*:parameters' ignored-patterns '_*' 15 | 16 | set -- $ZDOTDIR/.zcompdump 17 | [[ (-r $1 || ! -e $1) && (-r $1.zwc || ! -e $1.zwc) ]] || command rm -f -- $1 $1.zwc 18 | compinit -u -d $1 19 | [[ $1.zwc -nt $1 ]] || zcompile -R -- $1.zwc $1 20 | bashcompinit 21 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/env.zsh: -------------------------------------------------------------------------------- 1 | typeset -gxUT INFOPATH infopath 2 | typeset -gxU PATH path FPATH fpath MANPATH manpath 3 | 4 | export LESS='-iRFXMx4' 5 | [[ -v commands[less] ]] && export PAGER=less 6 | 7 | export LS_COLORS='fi=00:mi=00:mh=00:ln=01;36:or=01;31:di=01;34:ow=04;01;34:st=34:tw=04;34:' 8 | LS_COLORS+='pi=01;33:so=01;33:do=01;33:bd=01;33:cd=01;33:su=01;35:sg=01;35:ca=01;35:ex=01;32' 9 | if (( terminfo[colors] >= 256 )); then 10 | LS_COLORS+=':no=38;5;248' 11 | else 12 | LS_COLORS+=':no=1;30' 13 | fi 14 | 15 | export TREE_COLORS=${LS_COLORS//04;} 16 | export LSCOLORS='ExGxDxDxCxDxDxFxFxexEx' 17 | 18 | set -- ${commands[lesspipe]:-${commands[lesspipe.sh]}} 19 | (( $# )) && export LESSOPEN="| /usr/bin/env ${(q)1} %s 2>/dev/null" 20 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/keys.zsh: -------------------------------------------------------------------------------- 1 | # Delete all existing keymaps and reset to the default state. 2 | bindkey -d 3 | bindkey -e 4 | 5 | zle-expand() zle _expand_alias || zle .expand-word || true 6 | zle -N zle-expand 7 | 8 | for 1 in emacs viins vicmd; do 9 | # If NumLock is off, translate keys to make them appear the same as with NumLock on. 10 | bindkey -M $1 -s '^[OM' '^M' # enter 11 | bindkey -M $1 -s '^[OX' '=' 12 | bindkey -M $1 -s '^[Oj' '*' 13 | bindkey -M $1 -s '^[Ok' '+' 14 | bindkey -M $1 -s '^[Ol' '+' 15 | bindkey -M $1 -s '^[Om' '-' 16 | bindkey -M $1 -s '^[On' '.' 17 | bindkey -M $1 -s '^[Oo' '/' 18 | bindkey -M $1 -s '^[Op' '0' 19 | bindkey -M $1 -s '^[Oq' '1' 20 | bindkey -M $1 -s '^[Or' '2' 21 | bindkey -M $1 -s '^[Os' '3' 22 | bindkey -M $1 -s '^[Ot' '4' 23 | bindkey -M $1 -s '^[Ou' '5' 24 | bindkey -M $1 -s '^[Ov' '6' 25 | bindkey -M $1 -s '^[Ow' '7' 26 | bindkey -M $1 -s '^[Ox' '8' 27 | bindkey -M $1 -s '^[Oy' '9' 28 | 29 | # If someone switches our terminal to application mode (smkx), translate keys to make 30 | # them appear the same as in raw mode (rmkx). 31 | bindkey -M $1 -s '^[OA' '^[[A' # up 32 | bindkey -M $1 -s '^[OB' '^[[B' # down 33 | bindkey -M $1 -s '^[OD' '^[[D' # left 34 | bindkey -M $1 -s '^[OC' '^[[C' # right 35 | bindkey -M $1 -s '^[OH' '^[[H' # home 36 | bindkey -M $1 -s '^[OF' '^[[F' # end 37 | 38 | # TTY sends different key codes. Translate them to xterm equivalents. 39 | bindkey -M $1 -s '^[[1~' '^[[H' # home 40 | bindkey -M $1 -s '^[[4~' '^[[F' # end 41 | 42 | # Urxvt sends different key codes. Translate them to xterm equivalents. 43 | bindkey -M $1 -s '^[[7~' '^[[H' # home 44 | bindkey -M $1 -s '^[[8~' '^[[F' # end 45 | bindkey -M $1 -s '^[Oa' '^[[1;5A' # ctrl+up 46 | bindkey -M $1 -s '^[Ob' '^[[1;5B' # ctrl+down 47 | bindkey -M $1 -s '^[Od' '^[[1;5D' # ctrl+left 48 | bindkey -M $1 -s '^[Oc' '^[[1;5C' # ctrl+right 49 | bindkey -M $1 -s '^[[7\^' '^[[1;5H' # ctrl+home 50 | bindkey -M $1 -s '^[[8\^' '^[[1;5F' # ctrl+end 51 | bindkey -M $1 -s '^[[3\^' '^[[3;5~' # ctrl+delete 52 | bindkey -M $1 -s '^[^[[A' '^[[1;3A' # alt+up 53 | bindkey -M $1 -s '^[^[[B' '^[[1;3B' # alt+down 54 | bindkey -M $1 -s '^[^[[D' '^[[1;3D' # alt+left 55 | bindkey -M $1 -s '^[^[[C' '^[[1;3C' # alt+right 56 | bindkey -M $1 -s '^[^[[7~' '^[[1;3H' # alt+home 57 | bindkey -M $1 -s '^[^[[8~' '^[[1;3F' # alt+end 58 | bindkey -M $1 -s '^[^[[3~' '^[[3;3~' # alt+delete 59 | bindkey -M $1 -s '^[[a' '^[[1;2A' # shift+up 60 | bindkey -M $1 -s '^[[b' '^[[1;2B' # shift+down 61 | bindkey -M $1 -s '^[[d' '^[[1;2D' # shift+left 62 | bindkey -M $1 -s '^[[c' '^[[1;2C' # shift+right 63 | bindkey -M $1 -s '^[[7$' '^[[1;2H' # shift+home 64 | bindkey -M $1 -s '^[[8$' '^[[1;2F' # shift+end 65 | 66 | # Tmux sends different key codes. Translate them to xterm equivalents. 67 | bindkey -M $1 -s '^[[1~' '^[[H' # home 68 | bindkey -M $1 -s '^[[4~' '^[[F' # end 69 | bindkey -M $1 -s '^[^[[A' '^[[1;3A' # alt+up 70 | bindkey -M $1 -s '^[^[[B' '^[[1;3B' # alt+down 71 | bindkey -M $1 -s '^[^[[D' '^[[1;3D' # alt+left 72 | bindkey -M $1 -s '^[^[[C' '^[[1;3C' # alt+right 73 | bindkey -M $1 -s '^[^[[1~' '^[[1;3H' # alt+home 74 | bindkey -M $1 -s '^[^[[4~' '^[[1;3F' # alt+end 75 | bindkey -M $1 -s '^[^[[3~' '^[[3;3~' # alt+delete 76 | 77 | # iTerm2 sends different key codes. Translate them to xterm equivalents. 78 | bindkey -M $1 -s '^[^[[A' '^[[1;3A' # alt+up 79 | bindkey -M $1 -s '^[^[[B' '^[[1;3B' # alt+down 80 | bindkey -M $1 -s '^[^[[D' '^[[1;3D' # alt+left 81 | bindkey -M $1 -s '^[^[[C' '^[[1;3C' # alt+right 82 | bindkey -M $1 -s '^[[1;9A' '^[[1;3A' # alt+up 83 | bindkey -M $1 -s '^[[1;9B' '^[[1;3B' # alt+down 84 | bindkey -M $1 -s '^[[1;9D' '^[[1;3D' # alt+left 85 | bindkey -M $1 -s '^[[1;9C' '^[[1;3C' # alt+right 86 | bindkey -M $1 -s '^[[1;9H' '^[[1;3H' # alt+home 87 | bindkey -M $1 -s '^[[1;9F' '^[[1;3F' # alt+end 88 | 89 | # Terminals on macOS don't treat Option as Alt by default. 90 | # Translate en_US Option+Key key codes to Alt+Key equivalents. 91 | bindkey -M $1 -s 'œ' '^[q' # alt+q 92 | bindkey -M $1 -s '∑' '^[w' # alt+w 93 | bindkey -M $1 -s '®' '^[r' # alt+r 94 | bindkey -M $1 -s '†' '^[t' # alt+t 95 | bindkey -M $1 -s 'ø' '^[o' # alt+o 96 | bindkey -M $1 -s 'π' '^[p' # alt+p 97 | bindkey -M $1 -s '“' '^[[' # alt+[ 98 | bindkey -M $1 -s '‘' '^[]' # alt+] 99 | bindkey -M $1 -s 'å' '^[a' # alt+a 100 | bindkey -M $1 -s 'ß' '^[s' # alt+s 101 | bindkey -M $1 -s '∂' '^[d' # alt+d 102 | bindkey -M $1 -s 'ƒ' '^[f' # alt+f 103 | bindkey -M $1 -s '©' '^[g' # alt+g 104 | bindkey -M $1 -s '˙' '^[h' # alt+h 105 | bindkey -M $1 -s '∆' '^[j' # alt+j 106 | bindkey -M $1 -s '˚' '^[k' # alt+k 107 | bindkey -M $1 -s '¬' '^[l' # alt+l 108 | bindkey -M $1 -s 'Ω' '^[z' # alt+z 109 | bindkey -M $1 -s '≈' '^[x' # alt+x 110 | bindkey -M $1 -s 'ç' '^[c' # alt+c 111 | bindkey -M $1 -s '√' '^[v' # alt+v 112 | bindkey -M $1 -s '∫' '^[b' # alt+b 113 | bindkey -M $1 -s 'µ' '^[m' # alt+m 114 | bindkey -M $1 -s '≤' '^[,' # alt+, 115 | bindkey -M $1 -s '≥' '^[.' # alt+. 116 | bindkey -M $1 -s '÷' '^[/' # alt+/ 117 | bindkey -M $1 -s '«' '^[\\' # alt+\ 118 | bindkey -M $1 -s 'Œ' '^[Q' # alt+Q 119 | bindkey -M $1 -s '„' '^[W' # alt+W 120 | bindkey -M $1 -s '´' '^[E' # alt+E 121 | bindkey -M $1 -s '‰' '^[R' # alt+R 122 | bindkey -M $1 -s 'ˇ' '^[T' # alt+T 123 | bindkey -M $1 -s 'Á' '^[Y' # alt+Y 124 | bindkey -M $1 -s '¨' '^[U' # alt+U 125 | bindkey -M $1 -s 'ˆ' '^[I' # alt+I 126 | bindkey -M $1 -s 'Ø' '^[O' # alt+O 127 | bindkey -M $1 -s '∏' '^[P' # alt+P 128 | bindkey -M $1 -s 'Å' '^[A' # alt+A 129 | bindkey -M $1 -s 'Í' '^[S' # alt+S 130 | bindkey -M $1 -s 'Î' '^[D' # alt+D 131 | bindkey -M $1 -s 'Ï' '^[F' # alt+F 132 | bindkey -M $1 -s '˝' '^[G' # alt+G 133 | bindkey -M $1 -s 'Ó' '^[H' # alt+H 134 | bindkey -M $1 -s 'Ô' '^[J' # alt+J 135 | bindkey -M $1 -s '\357\243\277' '^[K' # alt+K 136 | bindkey -M $1 -s 'Ò' '^[L' # alt+L 137 | bindkey -M $1 -s '¸' '^[Z' # alt+Z 138 | bindkey -M $1 -s '˛' '^[X' # alt+X 139 | bindkey -M $1 -s 'Ç' '^[C' # alt+C 140 | bindkey -M $1 -s '◊' '^[V' # alt+V 141 | bindkey -M $1 -s 'ı' '^[B' # alt+B 142 | bindkey -M $1 -s '˜' '^[N' # alt+N 143 | bindkey -M $1 -s 'Â' '^[M' # alt+M 144 | done 145 | 146 | for 1 in emacs viins; do 147 | bindkey -M $1 '^[[1;5H' beginning-of-buffer-or-history # ctrl+home 148 | bindkey -M $1 '^[[1;3H' beginning-of-buffer-or-history # alt+home 149 | bindkey -M $1 '^[[1;5F' end-of-buffer-or-history # ctrl+end 150 | bindkey -M $1 '^[[1;3F' end-of-buffer-or-history # alt+end 151 | bindkey -M $1 '^[[3;5~' kill-word # ctrl+del 152 | bindkey -M $1 '^[[3;3~' kill-word # alt+del 153 | bindkey -M $1 '^[k' backward-kill-line # alt+k 154 | bindkey -M $1 '^[K' backward-kill-line # alt+K 155 | bindkey -M $1 '^[j' kill-buffer # alt+j 156 | bindkey -M $1 '^[J' kill-buffer # alt+J 157 | bindkey -M $1 '^[/' redo # alt+/ 158 | bindkey -M $1 '^ ' zle-expand # ctrl+space 159 | done 160 | 161 | bindkey -M emacs '^[[3~' delete-char # delete 162 | bindkey -M viins '^[[3~' vi-delete-char # delete 163 | bindkey -M emacs '^[[H' beginning-of-line # home 164 | bindkey -M viins '^[[H' vi-beginning-of-line # home 165 | bindkey -M emacs '^[[F' end-of-line # end 166 | bindkey -M viins '^[[F' vi-end-of-line # end 167 | bindkey -M emacs '^[[1;3D' backward-word # alt+left 168 | bindkey -M viins '^[[1;3D' vi-backward-word # alt+left 169 | bindkey -M emacs '^[[1;5D' backward-word # ctrl+left 170 | bindkey -M viins '^[[1;5D' vi-backward-word # ctrl+left 171 | bindkey -M emacs '^[[1;3C' forward-word # alt+right 172 | bindkey -M viins '^[[1;3C' vi-forward-word # alt+right 173 | bindkey -M emacs '^[[1;5C' forward-word # ctrl+right 174 | bindkey -M viins '^[[1;5C' vi-forward-word # ctrl+right 175 | 176 | bindkey -M viins '^[d' kill-word # alt+d 177 | bindkey -M viins '^[D' kill-word # alt+D 178 | bindkey -M viins '^[^?' vi-backward-kill-word # alt+bs 179 | bindkey -M viins '^[^H' vi-backward-kill-word # ctrl+alt+bs 180 | bindkey -M viins '^_' undo # ctrl+/ 181 | bindkey -M viins '^Xu' undo # ctrl+x u 182 | bindkey -M viins '^X^U' undo # ctrl+x ctrl+u 183 | bindkey -M viins '^[h' run-help # alt+h 184 | bindkey -M viins '^[H' run-help # alt+H 185 | bindkey -M viins '^[b' vi-backward-word # alt+b 186 | bindkey -M viins '^[B' vi-backward-word # alt+B 187 | bindkey -M viins '^[f' vi-forward-word # alt+f 188 | bindkey -M viins '^[F' vi-forward-word # alt+F 189 | -------------------------------------------------------------------------------- /configs/minimal/skel/.zsh/prompt.zsh: -------------------------------------------------------------------------------- 1 | PS1='%(#.%F{1}.%F{5})%n%f' 2 | if [[ -r /proc/1/cpuset(#qN-.) && $(/dev/null /dev/null 9 | 10 | <~/.zprezto/runcoms/zprofile >>~/.zshrc 11 | <~/.zprezto/runcoms/zshrc >>~/.zshrc 12 | <~/.zprezto/runcoms/zlogin >>~/.zlogin 13 | 14 | () { 15 | local f 16 | for f in ~/.zprezto/**/{*.zsh,*.zsh-theme,functions/*}(.); do 17 | zcompile -R -- "$f".zwc "$f" 2>/dev/null || true 18 | done 19 | } 20 | 21 | make -s -C ~/.zprezto/modules/prompt/external/powerlevel10k pkg 22 | -------------------------------------------------------------------------------- /configs/prezto+/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/prezto+/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/prezto+/skel/.zpreztorc: -------------------------------------------------------------------------------- 1 | zstyle ':prezto:*:*' color 'yes' 2 | zstyle ':prezto:load' pmodule 'completion' 'autosuggestions' 'syntax-highlighting' 'prompt' 3 | zstyle ':prezto:module:prompt' theme 'powerlevel10k' 4 | -------------------------------------------------------------------------------- /configs/prezto+/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/prezto+/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 6 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 7 | fi 8 | 9 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 10 | source ~/.p10k.zsh 11 | -------------------------------------------------------------------------------- /configs/prezto+notmux/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | 7 | git clone -q --depth=1 --recursive --shallow-submodules \ 8 | https://github.com/sorin-ionescu/prezto.git ~/.zprezto &>/dev/null 9 | 10 | <~/.zprezto/runcoms/zprofile >>~/.zshrc 11 | <~/.zprezto/runcoms/zshrc >>~/.zshrc 12 | <~/.zprezto/runcoms/zlogin >>~/.zlogin 13 | 14 | () { 15 | local f 16 | for f in ~/.zprezto/**/{*.zsh,*.zsh-theme,functions/*}(.); do 17 | zcompile -R -- "$f".zwc "$f" 2>/dev/null || true 18 | done 19 | } 20 | 21 | make -s -C ~/.zprezto/modules/prompt/external/powerlevel10k pkg 22 | -------------------------------------------------------------------------------- /configs/prezto+notmux/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/prezto+notmux/skel/.zpreztorc: -------------------------------------------------------------------------------- 1 | zstyle ':prezto:*:*' color 'yes' 2 | zstyle ':prezto:load' pmodule 'completion' 'autosuggestions' 'syntax-highlighting' 'prompt' 3 | zstyle ':prezto:module:prompt' theme 'powerlevel10k' 4 | -------------------------------------------------------------------------------- /configs/prezto+notmux/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/prezto+notmux/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 2 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 3 | fi 4 | 5 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 6 | source ~/.p10k.zsh 7 | -------------------------------------------------------------------------------- /configs/prezto/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | git clone -q --depth=1 --recursive --shallow-submodules \ 6 | https://github.com/sorin-ionescu/prezto.git ~/.zprezto &>/dev/null 7 | 8 | () { 9 | local rc 10 | for rc in ~/.zprezto/runcoms/^README.md(.); do 11 | ln -s -- $rc ~/.${rc:t} 12 | done 13 | } 14 | -------------------------------------------------------------------------------- /configs/pristine/setup: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/romkatv/zsh-bench/d7f9f821688bdff9365e630a8aaeba1fd90499b1/configs/pristine/setup -------------------------------------------------------------------------------- /configs/starship/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/starship/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/starship/skel/.zshrc: -------------------------------------------------------------------------------- 1 | eval "$(starship init zsh)" 2 | -------------------------------------------------------------------------------- /configs/synthetic/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | zcompile -R -- ~/.zshenv.zwc ~/.zshenv 7 | -------------------------------------------------------------------------------- /configs/synthetic/skel/.zshenv: -------------------------------------------------------------------------------- 1 | zmodload zsh/datetime 2 | 3 | typeset -gF _zb_start_time_sec=EPOCHREALTIME 4 | typeset -gF ZB_FIRST_PROMPT_LAG_MS ZB_FIRST_COMMAND_LAG_MS ZB_COMMAND_LAG_MS ZB_INPUT_LAG_MS 5 | 6 | setopt no_rcs 7 | 8 | function -zb-sleep-until() { 9 | local -F deadline=$1 10 | while (( EPOCHREALTIME < deadline )) : 11 | } 12 | 13 | function -zb-precmd() { 14 | if [[ -v _zb_first_cmd_done ]]; then 15 | -zb-sleep-until 'EPOCHREALTIME + 1e-3 * ZB_COMMAND_LAG_MS' 16 | else 17 | -zb-sleep-until '_zb_start_time_sec + 1e-3 * ZB_FIRST_PROMPT_LAG_MS' 18 | typeset -gr _zb_first_cmd_done 19 | fi 20 | } 21 | 22 | function -zb-preexec() { 23 | -zb-sleep-until '_zb_start_time_sec + 1e-3 * ZB_FIRST_COMMAND_LAG_MS' 24 | typeset -g preexec_functions=(${(@)preexec_functions:#-zb-preexec}) 25 | } 26 | 27 | function -zb-pre-redraw() { 28 | (( PENDING || KEYS_QUEUED_COUNT )) || -zb-sleep-until 'EPOCHREALTIME + 1e-3 * ZB_INPUT_LAG_MS' 29 | } 30 | 31 | zle -N -- zle-line-pre-redraw -zb-pre-redraw 32 | typeset -g precmd_functions=(-zb-precmd) 33 | typeset -g preexec_functions=(-zb-preexec) 34 | -------------------------------------------------------------------------------- /configs/tmux/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/tmux/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/tmux/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/tmux/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | -------------------------------------------------------------------------------- /configs/zcomet/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zcomet/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zcomet/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zcomet/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zcomet/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ ! -e ~/.zcomet/bin ]]; then 6 | git clone --depth=1 https://github.com/agkozak/zcomet.git ~/.zcomet/bin 7 | fi 8 | 9 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 10 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 11 | fi 12 | 13 | source ~/.zcomet/bin/zcomet.zsh 14 | 15 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 16 | 17 | zcomet load zsh-users/zsh-syntax-highlighting 18 | zcomet load zsh-users/zsh-autosuggestions 19 | zcomet load romkatv/powerlevel10k 20 | 21 | zcomet compinit 22 | 23 | source ~/.p10k.zsh 24 | -------------------------------------------------------------------------------- /configs/zgenom/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zgenom/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zgenom/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zgenom/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zgenom/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ ! -e ~/.zgenom ]]; then 6 | git clone --depth=1 https://github.com/jandamm/zgenom.git ~/.zgenom 7 | fi 8 | 9 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 10 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 11 | fi 12 | 13 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 14 | 15 | source ~/.zgenom/zgenom.zsh 16 | 17 | if ! zgenom saved; then 18 | zgenom load zsh-users/zsh-syntax-highlighting 19 | zgenom load zsh-users/zsh-autosuggestions 20 | zgenom load romkatv/powerlevel10k powerlevel10k 21 | zgenom save 22 | fi 23 | 24 | source ~/.p10k.zsh 25 | -------------------------------------------------------------------------------- /configs/zim+/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zim+/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zim+/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zim+/skel/.zimrc: -------------------------------------------------------------------------------- 1 | zmodule completion 2 | zmodule zsh-users/zsh-syntax-highlighting 3 | zmodule zsh-users/zsh-autosuggestions 4 | zmodule romkatv/powerlevel10k 5 | -------------------------------------------------------------------------------- /configs/zim+/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zim+/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | ZIM_HOME=~/.zim 7 | zstyle ':zim:zmodule' use 'degit' 8 | if [[ ! -e $ZIM_HOME/zimfw.zsh ]]; then 9 | # Download zimfw script if missing. 10 | curl -fsSLo $ZIM_HOME/zimfw.zsh --create-dirs \ 11 | https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh 12 | fi 13 | if [[ ! $ZIM_HOME/init.zsh -nt ~/.zimrc ]]; then 14 | # Install missing modules and update $ZIM_HOME/init.zsh. 15 | source $ZIM_HOME/zimfw.zsh init 16 | fi 17 | 18 | # Activate Powerlevel10k Instant Prompt. 19 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 20 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 21 | fi 22 | 23 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 24 | 25 | # Load plugins. 26 | source $ZIM_HOME/init.zsh 27 | 28 | source ~/.p10k.zsh 29 | -------------------------------------------------------------------------------- /configs/zim/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o pipe_fail 4 | 5 | curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh &>/dev/null 6 | -------------------------------------------------------------------------------- /configs/zinit-turbo/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zinit-turbo/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zinit-turbo/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zinit-turbo/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zinit-turbo/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ ! -e ~/.zinit/bin ]]; then 6 | git clone --depth=1 https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin 7 | fi 8 | 9 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 10 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 11 | fi 12 | 13 | source ~/.zinit/bin/zinit.zsh 14 | 15 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 16 | 17 | zinit ice depth"1" wait lucid; zinit light zsh-users/zsh-syntax-highlighting 18 | zinit ice depth"1" wait lucid; zinit light zsh-users/zsh-autosuggestions 19 | zinit ice depth"1" ; zinit light romkatv/powerlevel10k 20 | 21 | source ~/.p10k.zsh 22 | 23 | autoload -Uz compinit 24 | compinit 25 | zinit cdreplay -q 26 | -------------------------------------------------------------------------------- /configs/zinit/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zinit/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zinit/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zinit/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zinit/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 6 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 7 | fi 8 | 9 | if [[ ! -e ~/.zinit/bin ]]; then 10 | git clone -q --depth=1 https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin 11 | fi 12 | 13 | source ~/.zinit/bin/zinit.zsh 14 | 15 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 16 | 17 | zinit ice depth"1"; zinit light zsh-users/zsh-syntax-highlighting 18 | zinit ice depth"1"; zinit light zsh-users/zsh-autosuggestions 19 | zinit ice depth"1"; zinit light romkatv/powerlevel10k 20 | 21 | source ~/.p10k.zsh 22 | 23 | autoload -Uz compinit 24 | compinit 25 | zinit cdreplay -q 26 | -------------------------------------------------------------------------------- /configs/zplug/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zplug/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zplug/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zplug/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zplug/skel/.zshrc: -------------------------------------------------------------------------------- 1 | # If not in tmux, start tmux. 2 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 3 | exec tmux 4 | fi 5 | 6 | # Install zplug. 7 | if [[ ! -e ~/.zplug ]]; then 8 | git clone --depth=1 https://github.com/zplug/zplug.git ~/.zplug 9 | () { 10 | emulate -L zsh -o extended_glob 11 | local f 12 | for f in ~/.zplug/**/*.zsh(.) ~/.zplug/autoload/**/^*.zsh(.); do 13 | zcompile -R -- $f.zwc $f 14 | done 15 | } 16 | fi 17 | 18 | # Install plugins. 19 | source ~/.zplug/init.zsh 20 | zplug zsh-users/zsh-syntax-highlighting, depth:1 21 | zplug zsh-users/zsh-autosuggestions, depth:1 22 | zplug romkatv/powerlevel10k, as:theme, depth:1 23 | zplug check || zplug install 24 | 25 | # Activate Powerlevel10k Instant Prompt. 26 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 27 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 28 | fi 29 | 30 | # Enable the "new" completion system (compsys). 31 | autoload -Uz compinit && compinit 32 | [[ ~/.zcompdump.zwc -nt ~/.zcompdump ]] || zcompile -R -- ~/.zcompdump{.zwc,} 33 | 34 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 35 | 36 | # Load plugins. 37 | zplug load 38 | source ~/.p10k.zsh 39 | -------------------------------------------------------------------------------- /configs/zsh-autosuggestions/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git 8 | -------------------------------------------------------------------------------- /configs/zsh-autosuggestions/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zsh-autosuggestions/skel/.zshrc: -------------------------------------------------------------------------------- 1 | source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 2 | -------------------------------------------------------------------------------- /configs/zsh-defer/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zsh-defer/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /configs/zsh-defer/skel/.tmux.conf: -------------------------------------------------------------------------------- 1 | unbind -a 2 | set -g prefix None 3 | set -g prefix2 None 4 | set -g escape-time 0 5 | set -g status off 6 | set -g set-titles on 7 | set -g set-titles-string "#T" 8 | set -g history-limit 0 9 | set -g focus-events on 10 | set -g message-limit 0 11 | set -g assume-paste-time 0 12 | set -g default-terminal "screen-256color" 13 | set -s set-clipboard on 14 | set -as terminal-overrides ',*:Ms=\E]52;%p1%s;%p2%s\007' 15 | -------------------------------------------------------------------------------- /configs/zsh-defer/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zsh-defer/skel/.zshrc: -------------------------------------------------------------------------------- 1 | if [[ -z ${TMUX+X}${ZSH_SCRIPT+X}${ZSH_EXECUTION_STRING+X} ]]; then 2 | exec tmux 3 | fi 4 | 5 | function zcompile-many() { 6 | local f 7 | for f; do zcompile -R -- "$f".zwc "$f"; done 8 | } 9 | 10 | if [[ ! -e ~/zsh-defer ]]; then 11 | git clone --depth=1 https://github.com/romkatv/zsh-defer.git ~/zsh-defer 12 | zcompile-many ~/zsh-defer/zsh-defer.plugin.zsh 13 | fi 14 | if [[ ! -e ~/zsh-syntax-highlighting ]]; then 15 | git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/zsh-syntax-highlighting 16 | zcompile-many ~/zsh-syntax-highlighting/{zsh-syntax-highlighting.zsh,highlighters/*/*.zsh} 17 | fi 18 | if [[ ! -e ~/zsh-autosuggestions ]]; then 19 | git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ~/zsh-autosuggestions 20 | zcompile-many ~/zsh-autosuggestions/{zsh-autosuggestions.zsh,src/**/*.zsh} 21 | fi 22 | if [[ ! -e ~/powerlevel10k ]]; then 23 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k 24 | make -C ~/powerlevel10k pkg 25 | fi 26 | 27 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then 28 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" 29 | fi 30 | 31 | autoload -Uz compinit 32 | compinit 33 | 34 | [[ ~/.zcompdump.zwc -nt ~/.zcompdump ]] || zcompile-many ~/.zcompdump 35 | unfunction zcompile-many 36 | 37 | ZSH_AUTOSUGGEST_MANUAL_REBIND=1 38 | 39 | source ~/zsh-defer/zsh-defer.plugin.zsh 40 | source ~/powerlevel10k/powerlevel10k.zsh-theme 41 | source ~/.p10k.zsh 42 | 43 | zsh-defer -a +pr source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 44 | zsh-defer -a +ms source ~/zsh-autosuggestions/zsh-autosuggestions.zsh 45 | -------------------------------------------------------------------------------- /configs/zsh-launchpad/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o extended_glob 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | -------------------------------------------------------------------------------- /configs/zsh-launchpad/skel/.zshrc: -------------------------------------------------------------------------------- 1 | hash -d z=~/.config/zsh g=~/Git 2 | 3 | setopt HIST_FCNTL_LOCK HIST_IGNORE_ALL_DUPS SHARE_HISTORY TRANSIENT_RPROMPT \ 4 | NO_CLOBBER INTERACTIVE_COMMENTS HASH_EXECUTABLES_ONLY EXTENDED_GLOB \ 5 | GLOB_STAR_SHORT NUMERIC_GLOB_SORT FLOW_CONTROL 6 | 7 | if [[ ! -r ~g/zsh-snap/znap.zsh ]]; then 8 | git clone --depth 1 https://github.com/marlonrichert/zsh-snap.git ~g/zsh-snap 9 | fi 10 | source ~g/zsh-snap/znap.zsh 11 | 12 | PS2= 13 | RPS2='%F{11}%^%f' 14 | PS1='%F{%(?,10,9)}%#%f ' 15 | 16 | : ${PAGER:=less} 17 | READNULLCMD=$PAGER 18 | ZLE_RPROMPT_INDENT=0 19 | 20 | HISTFILE=~/.local/share/zsh/history 21 | SAVEHIST=100000 22 | HISTSIZE=120000 23 | 24 | [[ -d $HISTFILE:h ]] || mkdir -p $HISTFILE:h 25 | 26 | export -UT INFOPATH infopath 27 | export -U PATH path FPATH fpath MANPATH manpath 28 | path=(/home/linuxbrew/.linuxbrew/bin(N) $path) 29 | 30 | if (( $+commands[brew] )) && znap eval brew-shellenv 'brew shellenv'; then 31 | fpath+=($HOMEBREW_PREFIX/share/zsh/site-functions(-/UN)) 32 | fi 33 | 34 | autoload -Uz vcs_info zmv run-help ${^fpath}/run-help-^*.zwc(N:t) 35 | 36 | chpwd() RPS1= && zle -I && print -P '\n%F{12}%~%f' 37 | 38 | precmd() { 39 | local -i fd 40 | exec {fd}< <(vcs_info && print -r -- $vcs_info_msg_0_) 41 | zle -F $fd .vcs-info-handler 42 | } 43 | 44 | .vcs-info-handler() { 45 | IFS= read -ru $1 RPS1 && [[ $CONTEXT == start ]] && zle .reset-prompt 46 | zle -F $1 47 | exec {1}<&- 48 | } 49 | 50 | zstyle ':vcs_info:*' formats '%c%u%F{14}%b%f' 51 | zstyle ':vcs_info:*' actionformats '%F{9}%a %c%u%F{14}%b%f' 52 | zstyle ':vcs_info:*' stagedstr '%F{12}+' 53 | zstyle ':vcs_info:*' unstagedstr '%F{11}*' 54 | zstyle ':vcs_info:*' check-for-changes 'yes' 55 | 56 | () { 57 | znap clone $@ 58 | for 1; znap source $1 59 | } marlonrichert/{zsh-autocomplete,zsh-edit,zsh-hist,zcolors} \ 60 | zsh-users/{zsh-autosuggestions,zsh-syntax-highlighting} 61 | 62 | znap eval zcolors zcolors 63 | 64 | bindkey '^[q' push-line-or-edit 65 | bindkey '^[v' describe-key-briefly 66 | 67 | chpwd 68 | znap prompt 69 | 70 | (( $+aliases[run-help] )) && unalias run-help 71 | 72 | alias %= \$= 73 | alias zmv='zmv -Mv' 74 | alias zcp='zmv -Cv' 75 | alias zln='zmv -Lv' 76 | 77 | alias -s {css,gradle,html,js,json,md,patch,properties,txt,xml,yml}=$PAGER 78 | alias -s gz='gzip -l' 79 | alias -s {log,out}='tail -F' 80 | -------------------------------------------------------------------------------- /configs/zsh-syntax-highlighting/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | cd 7 | git clone -q --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git 8 | -------------------------------------------------------------------------------- /configs/zsh-syntax-highlighting/skel/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_global_rcs 2 | -------------------------------------------------------------------------------- /configs/zsh-syntax-highlighting/skel/.zshrc: -------------------------------------------------------------------------------- 1 | source ~/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2 | -------------------------------------------------------------------------------- /configs/zsh4humans/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | 5 | cp -r -- ${ZSH_SCRIPT:h}/skel/*(D) ~/ 6 | 7 | cd 8 | git clone -q -b v5 --depth=1 https://github.com/romkatv/zsh4humans.git 9 | cp -- ~/zsh4humans/{.zshenv,.zshrc} ~/ 10 | rm -rf -- ~/zsh4humans 11 | 12 | # In a real config, if you don't intend to use oh-my-zsh plugins, do this: 13 | # 14 | # sed -i.bak -E '/ohmyzsh/d' -- ~/.zshrc 15 | # rm -- ~/.zshrc.bak 16 | -------------------------------------------------------------------------------- /configs/zsh4humans/skel/.p10k.zsh: -------------------------------------------------------------------------------- 1 | POWERLEVEL9K_MODE=ascii 2 | POWERLEVEL9K_DISABLE_HOT_RELOAD=true 3 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs) 4 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() 5 | POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.003 6 | POWERLEVEL9K_INSTANT_PROMPT=quiet 7 | -------------------------------------------------------------------------------- /dbg/replay: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | setopt no_unset typeset_silent no_multi_byte warn_create_global pipe_fail 5 | 6 | () { 7 | 8 | zmodload zsh/zutil zsh/datetime 9 | 10 | local -x LC_ALL=C 11 | 12 | local -a help scratch_dir pause_at_ms max_delay_ms 13 | local -a delay_multiplier=(_ 1) 14 | zparseopts -D -K -F -- \ 15 | {h,-help}=help \ 16 | {d,-scratch-dir}:=scratch_dir \ 17 | {p,-pause-at-ms}:=pause_at_ms \ 18 | {M,-max-delay-ms}:=max_delay_ms \ 19 | {m,-delay-multiplier}:=delay_multiplier 20 | 21 | if (( $#help )); then 22 | print -r -- "usage: ${ZSH_SCRIPT:t} [OPTION].." 23 | print -r -- 24 | print -r -- 'OPTIONS' 25 | print -r -- ' -h,--help' 26 | print -r -- ' -d,--scratch-dir ' 27 | print -r -- ' -p,--pause-at-ms ' 28 | print -r -- ' -M,--max-delay-ms ' 29 | print -r -- ' -m,--delay-multiplier [default=1]' 30 | return 31 | fi 32 | 33 | if (( ARGC )); then 34 | print -ru2 -- "${ZSH_SCRIPT:t}: unexpected positional argument(s)" 35 | return 1 36 | fi 37 | 38 | if (( ! $#scratch_dir )); then 39 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required flag: --scratch-dir" 40 | return 1 41 | fi 42 | if [[ ! -e $scratch_dir[2] ]]; then 43 | print -ru2 -- "${ZSH_SCRIPT:t}: directory does not exist: ${(q-)scratch_dir[2]}" 44 | return 1 45 | fi 46 | if [[ $#pause_at_ms -ne 0 && $pause_at_ms[2] != <->(|.<->) ]]; then 47 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid --pause-at-ms format: ${(q-)pause_at_ms[2]}" 48 | return 1 49 | fi 50 | if [[ $#max_delay_ms -ne 0 && $max_delay_ms[2] != <->(|.<->) ]]; then 51 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid --max-delay-ms format: ${(q-)max_delay_ms[2]}" 52 | return 1 53 | fi 54 | if [[ $delay_multiplier[2] != <->(|.<->) ]]; then 55 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid --delay-multiplier format: ${(q-)delay_multiplier[2]}" 56 | return 1 57 | fi 58 | if [[ ! -t 0 || ! -t 1 || ! -t 2 ]]; then 59 | print -ru2 -- "${ZSH_SCRIPT:t}: all standard file descriptors must be TTY" 60 | return 1 61 | fi 62 | if [[ ! -v commands[stty] ]]; then 63 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: stty" 64 | return 1 65 | fi 66 | if [[ ! -v commands[reset] ]]; then 67 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: reset" 68 | return 1 69 | fi 70 | 71 | local -F t 72 | local -i n stage=$((2 - $#pause_at_ms)) 73 | local data timing dt dn REPLY 74 | data=${${"$(<$scratch_dir[2]/out; print -n x)"%x}#*$'\n'} 75 | timing=($(<$scratch_dir[2]/timing)) 76 | 77 | if (( $#timing % 2 != 0 )); then 78 | print -ru2 -- "${ZSH_SCRIPT:t}: malformed timing file" 79 | return 1 80 | fi 81 | if (( $#timing == 0 )); then 82 | print -ru2 -- "${ZSH_SCRIPT:t}: empty timing file" 83 | return 1 84 | fi 85 | 86 | unset _zb_stty _zb_error 87 | typeset -g _zb_stty 88 | _zb_stty=$(command stty -g) 89 | 90 | function cleanup() { 91 | local key 92 | while true; do 93 | read -t0 -k key || break 94 | done 95 | command reset 96 | command stty $_zb_stty 97 | if [[ -v _zb_error ]]; then 98 | print -ru2 -- "${ZSH_SCRIPT:t}: $_zb_error" 99 | fi 100 | [[ $1 == EXIT ]] || exit $((127 + ${signals[(Ie)$1]})) 101 | } 102 | 103 | local sig trapped=(${${(A)=:-INT TERM HUP EXIT}:*signals}) 104 | for sig in $trapped; do 105 | trap "trap - $trapped; cleanup $sig" $sig 106 | done 107 | unset sig trapped 108 | 109 | local -r clear=${(pl:$LINES::\n:):-}$'\e[H' 110 | 111 | print -rn -- $clear 112 | if (( $#pause_at_ms )); then 113 | print -r -- '1. Press ENTER to see the replay of the TTY content.' 114 | print -r -- '2. The replay will pause right before T='$pause_at_ms[2]'ms. Press ENTER to continue.' 115 | print -r -- '3. The replay will pause right after T='$pause_at_ms[2]'ms. Press ENTER to continue.' 116 | print -r -- '4. The replay will pause for the last time at the end. Press ENTER to exit.' 117 | else 118 | print -r -- '1. Press ENTER to see the replay of the TTY content.' 119 | print -r -- '2. Press ENTER again at the end to exit.' 120 | fi 121 | 122 | IFS= read -rs 123 | print -rn -- $clear 124 | command stty -echo 125 | 126 | function sleep-until-ms() { 127 | local -F now=EPOCHREALTIME end delay 128 | (( (end = start_time + 1e-3 * delay_multiplier[2] * $1), (delay = end - now), 1 )) 129 | if (( $#max_delay_ms && delay > 1e-3 * max_delay_ms[2] )); then 130 | (( end = now + 1e-3 * max_delay_ms[2], start_time += (1e-3 * max_delay_ms[2] - delay), 1 )) 131 | fi 132 | 133 | while (( EPOCHREALTIME < end )) : 134 | } 135 | 136 | function pause() { 137 | local -F t=EPOCHREALTIME 138 | IFS= read -rs 139 | (( start_time += EPOCHREALTIME - t )) 140 | } 141 | 142 | local -F start_time=EPOCHREALTIME 143 | 144 | for dt dn in $timing; do 145 | if [[ $dt != <->(|.<->) || $dn != <1-> ]]; then 146 | typeset -g _zb_error='malformed timing file' 147 | return 1 148 | fi 149 | if (( $#data < n + dn )); then 150 | typeset -g _zb_error='malformed timing or data file' 151 | return 1 152 | fi 153 | (( t += dt, 1 )) 154 | if (( stage == 0 && 1e3 * t >= pause_at_ms[2] - 0.002 )); then 155 | sleep-until-ms $((pause_at_ms[2] - 0.002)) 156 | pause 157 | stage=1 158 | fi 159 | if (( stage == 1 && 1e3 * t >= pause_at_ms[2] + 0.002 )); then 160 | sleep-until-ms $((pause_at_ms[2] + 0.002)) 161 | pause 162 | stage=2 163 | fi 164 | sleep-until-ms $((1e3 * t)) 165 | print -rn -- $data[n+1,n+dn] 166 | (( n += dn )) 167 | done 168 | 169 | if (( stage == 2 )); then 170 | IFS= read -rs 171 | else 172 | typeset -g _zb_error='--pause-at-ms out of range' 173 | return 1 174 | fi 175 | 176 | } "$@" 177 | -------------------------------------------------------------------------------- /dbg/timeline: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | setopt no_unset typeset_silent no_multi_byte warn_create_global pipe_fail 5 | 6 | () { 7 | 8 | zmodload zsh/zutil 9 | 10 | local -x LC_ALL=C 11 | 12 | local -a help scratch_dir no_header 13 | zparseopts -D -K -F -- \ 14 | {h,-help}=help \ 15 | {d,-scratch-dir}:=scratch_dir \ 16 | {1,-no-header}=no_header 17 | 18 | if (( $#help )); then 19 | print -r -- "usage: ${ZSH_SCRIPT:t} [OPTION].." 20 | print -r -- 21 | print -r -- 'OPTIONS' 22 | print -r -- ' -h,--help' 23 | print -r -- ' -d,--scratch-dir ' 24 | print -r -- ' -1,--no-header' 25 | return 26 | fi 27 | 28 | if (( ARGC )); then 29 | print -ru2 -- "${ZSH_SCRIPT:t}: unexpected positional argument(s)" 30 | return 1 31 | fi 32 | 33 | if (( ! $#scratch_dir )); then 34 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required flag: --scratch-dir" 35 | return 1 36 | fi 37 | if [[ ! -e $scratch_dir[2] ]]; then 38 | print -ru2 -- "${ZSH_SCRIPT:t}: directory does not exist: ${(q-)scratch_dir[2]}" 39 | return 1 40 | fi 41 | 42 | local -F t 43 | local -i n 44 | local data timing dt dn 45 | data=${${"$(<$scratch_dir[2]/out; print -n x)"%x}#*$'\n'} 46 | timing=($(<$scratch_dir[2]/timing)) 47 | 48 | if (( $#timing % 2 != 0 )); then 49 | print -ru2 -- "${ZSH_SCRIPT:t}: malformed timing file" 50 | return 1 51 | fi 52 | 53 | (( $#no_header )) || print -- 'TIME\tDELAY\tDATA' 54 | 55 | for dt dn in $timing; do 56 | if [[ $dt != <->(|.<->) || $dn != <1-> ]]; then 57 | print -ru2 -- "${ZSH_SCRIPT:t}: malformed timing file" 58 | return 1 59 | fi 60 | if (( $#data < n + dn )); then 61 | print -ru2 -- "${ZSH_SCRIPT:t}: malformed timing or data file" 62 | return 1 63 | fi 64 | printf -- '%.6f\t%s\t%s\n' $(( t += dt )) $dt ${${(qqqq)data[n+1,n+dn]}[3,-2]} 65 | (( n += dn )) 66 | done 67 | if [[ $data[n+1,-1] != $'\nScript done'* ]]; then 68 | print -ru2 -- "${ZSH_SCRIPT:t}: malformed timing or data file" 69 | return 1 70 | fi 71 | 72 | } "$@" 73 | -------------------------------------------------------------------------------- /doc/linux-desktop.md: -------------------------------------------------------------------------------- 1 | | config | tmux | compsys | syntax highlight | auto suggest | git prompt | first prompt lag | first cmd lag | cmd lag | input lag | 2 | |-|-:|-:|-:|-:|-:|-:|-:|-:|-:| 3 | | [no-rcs](https://github.com/romkatv/zsh-bench/tree/master/configs/no-rcs) | ❌ | ❌ | ❌ | ❌ | ❌ | 3%
🟢 | 1%
🟢 | 1%
🟢 | 1%
🟢 | 4 | | [tmux](https://github.com/romkatv/zsh-bench/tree/master/configs/tmux) | ✔️ | ❌ | ❌ | ❌ | ❌ | 8%
🟢 | 3%
🟢 | 1%
🟢 | 1%
🟢 | 5 | | [compsys](https://github.com/romkatv/zsh-bench/tree/master/configs/compsys) | ❌ | ✔️ | ❌ | ❌ | ❌ | 37%
🟢 | 12%
🟢 | 1%
🟢 | 1%
🟢 | 6 | | [zsh-syntax-highlighting](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-syntax-highlighting) | ❌ | ❌ | ✔️ | ❌ | ❌ | 23%
🟢 | 14%
🟢 | 6%
🟢 | 57%
🟡 | 7 | | [zsh-autosuggestions](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-autosuggestions) | ❌ | ❌ | ❌ | ✔️ | ❌ | 32%
🟢 | 13%
🟢 | 96%
🟡 | 3%
🟢 | 8 | | [git-branch](https://github.com/romkatv/zsh-bench/tree/master/configs/git-branch) | ❌ | ❌ | ❌ | ❌ | ✔️ | 32%
🟢 | 11%
🟢 | 50%
🟢 | 1%
🟢 | 9 | | [agnoster](https://github.com/romkatv/zsh-bench/tree/master/configs/agnoster) | ❌ | ❌ | ❌ | ❌ | ✔️ | 65%
🟡 | 22%
🟢 | 244%
🔴 | 1%
🟢 | 10 | | [starship](https://github.com/romkatv/zsh-bench/tree/master/configs/starship) | ❌ | ❌ | ❌ | ❌ | ✔️ | 82%
🟡 | 28%
🟢 | 354%
🔴 | 1%
🟢 | 11 | | [powerlevel10k](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k) | ❌ | ❌ | ❌ | ❌ | ✔️ | 4%
🟢 | 14%
🟢 | 19%
🟢 | 1%
🟢 | 12 | | [powerlevel10k-full](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k-full) | ❌ | ❌ | ❌ | ❌ | ✔️ | 8%
🟢 | 27%
🟢 | 64%
🟡 | 6%
🟢 | 13 | | [prezto](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto) | ❌ | ✔️ | ❌ | ❌ | ❌ | 97%
🟡 | 35%
🟢 | 13%
🟢 | 1%
🟢 | 14 | | [ohmyzsh](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh) | ❌ | ✔️ | ❌ | ❌ | ✔️ | 187%
🟠 | 64%
🟡 | 366%
🔴 | 2%
🟢 | 15 | | [zim](https://github.com/romkatv/zsh-bench/tree/master/configs/zim) | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | 122%
🟠 | 53%
🟡 | 191%
🟠 | 64%
🟡 | 16 | | [zsh4humans](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh4humans) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 19%
🟢 | 36%
🟢 | 27%
🟢 | 25%
🟢 | 17 | | [diy](https://github.com/romkatv/zsh-bench/tree/master/configs/diy) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 118%
🟠 | 47%
🟢 | 155%
🟠 | 61%
🟡 | 18 | | [diy+](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 51%
🟡 | 24%
🟢 | 63%
🟡 | 19 | | [diy++](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 42%
🟢 | 24%
🟢 | 64%
🟡 | 20 | | [diy++unsafe](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bunsafe) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 9%
🟢 | 37%
🟢 | 24%
🟢 | 63%
🟡 | 21 | | [diy++fsyh](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bfsyh) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 39%
🟢 | 21%
🟢 | 24%
🟢 | 22 | | [zcomet](https://github.com/romkatv/zsh-bench/tree/master/configs/zcomet) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 44%
🟢 | 25%
🟢 | 64%
🟡 | 23 | | [zinit](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 78%
🟡 | 24%
🟢 | 64%
🟡 | 24 | | [zplug](https://github.com/romkatv/zsh-bench/tree/master/configs/zplug) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 108%
🟠 | 100%
🟡 | 24%
🟢 | 64%
🟡 | 25 | | [ohmyzsh+](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 56%
🟡 | 29%
🟢 | 64%
🟡 | 26 | | [prezto+](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 47%
🟢 | 34%
🟢 | 68%
🟡 | 27 | | [zim+](https://github.com/romkatv/zsh-bench/tree/master/configs/zim%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 38%
🟢 | 24%
🟢 | 64%
🟡 | 28 | | [antidote](https://github.com/romkatv/zsh-bench/tree/master/configs/antidote) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 10%
🟢 | 46%
🟢 | 24%
🟢 | 63%
🟡 | 29 | | [zinit-turbo](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit-turbo) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 9%
🟢 | 39%
🟢 | 24%
🟢 | 62%
🟡 | 30 | | [zsh-defer](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-defer) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 10%
🟢 | 22%
🟢 | 28%
🟢 | 65%
🟡 | 31 | | [synthetic](https://github.com/romkatv/zsh-bench/tree/master/configs/synthetic) | ❌ | ❌ | ❌ | ❌ | ❌ | 3%
🟢 | 1%
🟢 | 1%
🟢 | 1%
🟢 | 32 | -------------------------------------------------------------------------------- /doc/linux-desktop.txt: -------------------------------------------------------------------------------- 1 | ==> starting ubuntu:22.04 in docker ... 2 | ==> docker container ID: 19bf5ba330a0 3 | ==> setting up the container ... 4 | ==> setting up user zsh-bench with no-rcs ... 5 | ==> benchmarking login shell of user zsh-bench ... 6 | creates_tty=0 7 | has_compsys=0 8 | has_syntax_highlighting=0 9 | has_autosuggestions=0 10 | has_git_prompt=0 11 | first_prompt_lag_ms=1.337 12 | first_command_lag_ms=1.533 13 | command_lag_ms=0.094 14 | input_lag_ms=0.112 15 | exit_time_ms=1.352 16 | ==> setting up user zsh-bench with tmux ... 17 | ==> benchmarking login shell of user zsh-bench ... 18 | creates_tty=1 19 | has_compsys=0 20 | has_syntax_highlighting=0 21 | has_autosuggestions=0 22 | has_git_prompt=0 23 | first_prompt_lag_ms=4.207 24 | first_command_lag_ms=4.414 25 | command_lag_ms=0.083 26 | input_lag_ms=0.116 27 | exit_time_ms=1.661 28 | ==> setting up user zsh-bench with compsys ... 29 | ==> benchmarking login shell of user zsh-bench ... 30 | creates_tty=0 31 | has_compsys=1 32 | has_syntax_highlighting=0 33 | has_autosuggestions=0 34 | has_git_prompt=0 35 | first_prompt_lag_ms=18.331 36 | first_command_lag_ms=18.499 37 | command_lag_ms=0.095 38 | input_lag_ms=0.124 39 | exit_time_ms=19.186 40 | ==> setting up user zsh-bench with zsh-syntax-highlighting ... 41 | ==> benchmarking login shell of user zsh-bench ... 42 | creates_tty=0 43 | has_compsys=0 44 | has_syntax_highlighting=1 45 | has_autosuggestions=0 46 | has_git_prompt=0 47 | first_prompt_lag_ms=11.705 48 | first_command_lag_ms=21.386 49 | command_lag_ms=0.561 50 | input_lag_ms=11.454 51 | exit_time_ms=11.971 52 | ==> setting up user zsh-bench with zsh-autosuggestions ... 53 | ==> benchmarking login shell of user zsh-bench ... 54 | creates_tty=0 55 | has_compsys=0 56 | has_syntax_highlighting=0 57 | has_autosuggestions=1 58 | has_git_prompt=0 59 | first_prompt_lag_ms=16.102 60 | first_command_lag_ms=19.642 61 | command_lag_ms=9.572 62 | input_lag_ms=0.604 63 | exit_time_ms=3.895 64 | ==> setting up user zsh-bench with git-branch ... 65 | ==> benchmarking login shell of user zsh-bench ... 66 | creates_tty=0 67 | has_compsys=0 68 | has_syntax_highlighting=0 69 | has_autosuggestions=0 70 | has_git_prompt=1 71 | first_prompt_lag_ms=15.853 72 | first_command_lag_ms=16.052 73 | command_lag_ms=4.972 74 | input_lag_ms=0.110 75 | exit_time_ms=1.296 76 | ==> setting up user zsh-bench with agnoster ... 77 | ==> benchmarking login shell of user zsh-bench ... 78 | creates_tty=0 79 | has_compsys=0 80 | has_syntax_highlighting=0 81 | has_autosuggestions=0 82 | has_git_prompt=1 83 | first_prompt_lag_ms=32.555 84 | first_command_lag_ms=32.743 85 | command_lag_ms=24.366 86 | input_lag_ms=0.109 87 | exit_time_ms=2.368 88 | ==> setting up user zsh-bench with starship ... 89 | ==> benchmarking login shell of user zsh-bench ... 90 | creates_tty=0 91 | has_compsys=0 92 | has_syntax_highlighting=0 93 | has_autosuggestions=0 94 | has_git_prompt=1 95 | first_prompt_lag_ms=41.146 96 | first_command_lag_ms=41.391 97 | command_lag_ms=35.402 98 | input_lag_ms=0.111 99 | exit_time_ms=6.469 100 | ==> setting up user zsh-bench with powerlevel10k ... 101 | ==> benchmarking login shell of user zsh-bench ... 102 | creates_tty=0 103 | has_compsys=0 104 | has_syntax_highlighting=0 105 | has_autosuggestions=0 106 | has_git_prompt=1 107 | first_prompt_lag_ms=1.888 108 | first_command_lag_ms=20.640 109 | command_lag_ms=1.854 110 | input_lag_ms=0.135 111 | exit_time_ms=6.289 112 | ==> setting up user zsh-bench with powerlevel10k-full ... 113 | ==> benchmarking login shell of user zsh-bench ... 114 | creates_tty=0 115 | has_compsys=0 116 | has_syntax_highlighting=0 117 | has_autosuggestions=0 118 | has_git_prompt=1 119 | first_prompt_lag_ms=3.781 120 | first_command_lag_ms=40.622 121 | command_lag_ms=6.387 122 | input_lag_ms=1.295 123 | exit_time_ms=10.714 124 | ==> setting up user zsh-bench with prezto ... 125 | ==> benchmarking login shell of user zsh-bench ... 126 | creates_tty=0 127 | has_compsys=1 128 | has_syntax_highlighting=0 129 | has_autosuggestions=0 130 | has_git_prompt=0 131 | first_prompt_lag_ms=48.567 132 | first_command_lag_ms=52.360 133 | command_lag_ms=1.343 134 | input_lag_ms=0.295 135 | exit_time_ms=47.025 136 | ==> setting up user zsh-bench with ohmyzsh ... 137 | ==> benchmarking login shell of user zsh-bench ... 138 | creates_tty=0 139 | has_compsys=1 140 | has_syntax_highlighting=0 141 | has_autosuggestions=0 142 | has_git_prompt=1 143 | first_prompt_lag_ms=93.286 144 | first_command_lag_ms=96.019 145 | command_lag_ms=36.588 146 | input_lag_ms=0.337 147 | exit_time_ms=53.885 148 | ==> setting up user zsh-bench with zim ... 149 | ==> benchmarking login shell of user zsh-bench ... 150 | creates_tty=0 151 | has_compsys=1 152 | has_syntax_highlighting=1 153 | has_autosuggestions=1 154 | has_git_prompt=1 155 | first_prompt_lag_ms=61.037 156 | first_command_lag_ms=78.936 157 | command_lag_ms=19.107 158 | input_lag_ms=12.829 159 | exit_time_ms=31.559 160 | ==> setting up user zsh-bench with zsh4humans ... 161 | ==> benchmarking login shell of user zsh-bench ... 162 | creates_tty=1 163 | has_compsys=1 164 | has_syntax_highlighting=1 165 | has_autosuggestions=1 166 | has_git_prompt=1 167 | first_prompt_lag_ms=9.499 168 | first_command_lag_ms=53.688 169 | command_lag_ms=2.743 170 | input_lag_ms=4.902 171 | exit_time_ms=6.195 172 | ==> setting up user zsh-bench with diy ... 173 | ==> benchmarking login shell of user zsh-bench ... 174 | creates_tty=1 175 | has_compsys=1 176 | has_syntax_highlighting=1 177 | has_autosuggestions=1 178 | has_git_prompt=1 179 | first_prompt_lag_ms=59.099 180 | first_command_lag_ms=70.266 181 | command_lag_ms=15.491 182 | input_lag_ms=12.116 183 | exit_time_ms=30.772 184 | ==> setting up user zsh-bench with diy+ ... 185 | ==> benchmarking login shell of user zsh-bench ... 186 | creates_tty=1 187 | has_compsys=1 188 | has_syntax_highlighting=1 189 | has_autosuggestions=1 190 | has_git_prompt=1 191 | first_prompt_lag_ms=4.804 192 | first_command_lag_ms=76.345 193 | command_lag_ms=2.416 194 | input_lag_ms=12.672 195 | exit_time_ms=34.398 196 | ==> setting up user zsh-bench with diy++ ... 197 | ==> benchmarking login shell of user zsh-bench ... 198 | creates_tty=1 199 | has_compsys=1 200 | has_syntax_highlighting=1 201 | has_autosuggestions=1 202 | has_git_prompt=1 203 | first_prompt_lag_ms=4.807 204 | first_command_lag_ms=62.741 205 | command_lag_ms=2.405 206 | input_lag_ms=12.717 207 | exit_time_ms=20.952 208 | ==> setting up user zsh-bench with diy++unsafe ... 209 | ==> benchmarking login shell of user zsh-bench ... 210 | creates_tty=1 211 | has_compsys=1 212 | has_syntax_highlighting=1 213 | has_autosuggestions=1 214 | has_git_prompt=1 215 | first_prompt_lag_ms=4.747 216 | first_command_lag_ms=55.706 217 | command_lag_ms=2.414 218 | input_lag_ms=12.589 219 | exit_time_ms=14.168 220 | ==> setting up user zsh-bench with diy++fsyh ... 221 | ==> benchmarking login shell of user zsh-bench ... 222 | creates_tty=1 223 | has_compsys=1 224 | has_syntax_highlighting=1 225 | has_autosuggestions=1 226 | has_git_prompt=1 227 | first_prompt_lag_ms=4.813 228 | first_command_lag_ms=58.778 229 | command_lag_ms=2.106 230 | input_lag_ms=4.760 231 | exit_time_ms=21.871 232 | ==> setting up user zsh-bench with zcomet ... 233 | ==> benchmarking login shell of user zsh-bench ... 234 | creates_tty=1 235 | has_compsys=1 236 | has_syntax_highlighting=1 237 | has_autosuggestions=1 238 | has_git_prompt=1 239 | first_prompt_lag_ms=4.796 240 | first_command_lag_ms=65.728 241 | command_lag_ms=2.457 242 | input_lag_ms=12.736 243 | exit_time_ms=23.913 244 | ==> setting up user zsh-bench with zinit ... 245 | ==> benchmarking login shell of user zsh-bench ... 246 | creates_tty=1 247 | has_compsys=1 248 | has_syntax_highlighting=1 249 | has_autosuggestions=1 250 | has_git_prompt=1 251 | first_prompt_lag_ms=4.775 252 | first_command_lag_ms=116.559 253 | command_lag_ms=2.434 254 | input_lag_ms=12.712 255 | exit_time_ms=73.446 256 | ==> setting up user zsh-bench with zplug ... 257 | ==> benchmarking login shell of user zsh-bench ... 258 | creates_tty=1 259 | has_compsys=1 260 | has_syntax_highlighting=1 261 | has_autosuggestions=1 262 | has_git_prompt=1 263 | first_prompt_lag_ms=53.984 264 | first_command_lag_ms=150.697 265 | command_lag_ms=2.430 266 | input_lag_ms=12.778 267 | exit_time_ms=105.136 268 | ==> setting up user zsh-bench with ohmyzsh+ ... 269 | ==> benchmarking login shell of user zsh-bench ... 270 | creates_tty=1 271 | has_compsys=1 272 | has_syntax_highlighting=1 273 | has_autosuggestions=1 274 | has_git_prompt=1 275 | first_prompt_lag_ms=4.794 276 | first_command_lag_ms=84.586 277 | command_lag_ms=2.878 278 | input_lag_ms=12.802 279 | exit_time_ms=39.158 280 | ==> setting up user zsh-bench with prezto+ ... 281 | ==> benchmarking login shell of user zsh-bench ... 282 | creates_tty=1 283 | has_compsys=1 284 | has_syntax_highlighting=1 285 | has_autosuggestions=1 286 | has_git_prompt=1 287 | first_prompt_lag_ms=4.774 288 | first_command_lag_ms=70.980 289 | command_lag_ms=3.438 290 | input_lag_ms=13.676 291 | exit_time_ms=25.673 292 | ==> setting up user zsh-bench with zim+ ... 293 | ==> benchmarking login shell of user zsh-bench ... 294 | creates_tty=1 295 | has_compsys=1 296 | has_syntax_highlighting=1 297 | has_autosuggestions=1 298 | has_git_prompt=1 299 | first_prompt_lag_ms=5.040 300 | first_command_lag_ms=56.538 301 | command_lag_ms=2.412 302 | input_lag_ms=12.729 303 | exit_time_ms=15.381 304 | ==> setting up user zsh-bench with antidote ... 305 | ==> benchmarking login shell of user zsh-bench ... 306 | creates_tty=1 307 | has_compsys=1 308 | has_syntax_highlighting=1 309 | has_autosuggestions=1 310 | has_git_prompt=1 311 | first_prompt_lag_ms=4.775 312 | first_command_lag_ms=68.943 313 | command_lag_ms=2.401 314 | input_lag_ms=12.524 315 | exit_time_ms=27.773 316 | ==> setting up user zsh-bench with zinit-turbo ... 317 | ==> benchmarking login shell of user zsh-bench ... 318 | creates_tty=1 319 | has_compsys=1 320 | has_syntax_highlighting=0 321 | has_autosuggestions=0 322 | has_git_prompt=1 323 | first_prompt_lag_ms=4.740 324 | first_command_lag_ms=58.660 325 | command_lag_ms=2.402 326 | input_lag_ms=12.329 327 | exit_time_ms=40.666 328 | ==> setting up user zsh-bench with zsh-defer ... 329 | ==> benchmarking login shell of user zsh-bench ... 330 | creates_tty=1 331 | has_compsys=1 332 | has_syntax_highlighting=0 333 | has_autosuggestions=0 334 | has_git_prompt=1 335 | first_prompt_lag_ms=4.781 336 | first_command_lag_ms=32.389 337 | command_lag_ms=2.806 338 | input_lag_ms=12.986 339 | exit_time_ms=15.375 340 | ==> setting up user zsh-bench with synthetic ... 341 | ==> benchmarking login shell of user zsh-bench ... 342 | creates_tty=0 343 | has_compsys=0 344 | has_syntax_highlighting=0 345 | has_autosuggestions=0 346 | has_git_prompt=0 347 | first_prompt_lag_ms=1.273 348 | first_command_lag_ms=2.105 349 | command_lag_ms=0.144 350 | input_lag_ms=0.129 351 | exit_time_ms=1.581 352 | -------------------------------------------------------------------------------- /doc/linux-raspberrypi.md: -------------------------------------------------------------------------------- 1 | | config | tmux | compsys | syntax highlight | auto suggest | git prompt | first prompt lag | first cmd lag | cmd lag | input lag | 2 | |-|-:|-:|-:|-:|-:|-:|-:|-:|-:| 3 | | [no-rcs](https://github.com/romkatv/zsh-bench/tree/master/configs/no-rcs) | ❌ | ❌ | ❌ | ❌ | ❌ | 5%
🟢 | 2%
🟢 | 2%
🟢 | 2%
🟢 | 4 | | [tmux](https://github.com/romkatv/zsh-bench/tree/master/configs/tmux) | ✔️ | ❌ | ❌ | ❌ | ❌ | 31%
🟢 | 11%
🟢 | 2%
🟢 | 2%
🟢 | 5 | | [compsys](https://github.com/romkatv/zsh-bench/tree/master/configs/compsys) | ❌ | ✔️ | ❌ | ❌ | ❌ | 136%
🟠 | 46%
🟢 | 2%
🟢 | 2%
🟢 | 6 | | [zsh-syntax-highlighting](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-syntax-highlighting) | ❌ | ❌ | ✔️ | ❌ | ❌ | 97%
🟡 | 61%
🟡 | 22%
🟢 | 295%
🔴 | 7 | | [zsh-autosuggestions](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-autosuggestions) | ❌ | ❌ | ❌ | ✔️ | ❌ | 162%
🟠 | 63%
🟡 | 508%
🔴 | 18%
🟢 | 8 | | [git-branch](https://github.com/romkatv/zsh-bench/tree/master/configs/git-branch) | ❌ | ❌ | ❌ | ❌ | ✔️ | 78%
🟡 | 26%
🟢 | 224%
🔴 | 2%
🟢 | 9 | | [agnoster](https://github.com/romkatv/zsh-bench/tree/master/configs/agnoster) | ❌ | ❌ | ❌ | ❌ | ✔️ | 307%
🔴 | 103%
🟠 | 1040%
🔴 | 2%
🟢 | 10 | | [starship](https://github.com/romkatv/zsh-bench/tree/master/configs/starship) | ❌ | ❌ | ❌ | ❌ | ✔️ | 214%
🔴 | 72%
🟡 | 1002%
🔴 | 2%
🟢 | 11 | | [powerlevel10k](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k) | ❌ | ❌ | ❌ | ❌ | ✔️ | 12%
🟢 | 54%
🟡 | 86%
🟡 | 3%
🟢 | 12 | | [powerlevel10k-full](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k-full) | ❌ | ❌ | ❌ | ❌ | ✔️ | 35%
🟢 | 144%
🟠 | 334%
🔴 | 33%
🟢 | 13 | | [prezto](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto) | ❌ | ✔️ | ❌ | ❌ | ❌ | 251%
🔴 | 93%
🟡 | 71%
🟡 | 7%
🟢 | 14 | | [ohmyzsh](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh) | ❌ | ✔️ | ❌ | ❌ | ✔️ | 528%
🔴 | 181%
🟠 | 1008%
🔴 | 7%
🟢 | 15 | | [zim](https://github.com/romkatv/zsh-bench/tree/master/configs/zim) | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | 419%
🔴 | 193%
🟠 | 1081%
🔴 | 350%
🔴 | 16 | | [zsh4humans](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh4humans) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 67%
🟡 | 122%
🟠 | 119%
🟠 | 137%
🟠 | 17 | | [diy](https://github.com/romkatv/zsh-bench/tree/master/configs/diy) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 476%
🔴 | 193%
🟠 | 803%
🔴 | 318%
🔴 | 18 | | [diy+](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 226%
🔴 | 115%
🟠 | 340%
🔴 | 19 | | [diy++](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 195%
🟠 | 115%
🟠 | 340%
🔴 | 20 | | [diy++unsafe](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bunsafe) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 171%
🟠 | 115%
🟠 | 340%
🔴 | 21 | | [diy++fsyh](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bfsyh) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 39%
🟢 | 194%
🟠 | 101%
🟠 | 121%
🟠 | 22 | | [zcomet](https://github.com/romkatv/zsh-bench/tree/master/configs/zcomet) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 202%
🔴 | 117%
🟠 | 342%
🔴 | 23 | | [zinit](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 358%
🔴 | 115%
🟠 | 342%
🔴 | 24 | | [zplug](https://github.com/romkatv/zsh-bench/tree/master/configs/zplug) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 569%
🔴 | 513%
🔴 | 116%
🟠 | 353%
🔴 | 25 | | [ohmyzsh+](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 38%
🟢 | 250%
🔴 | 135%
🟠 | 345%
🔴 | 26 | | [prezto+](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 58%
🟡 | 227%
🔴 | 166%
🟠 | 353%
🔴 | 27 | | [zim+](https://github.com/romkatv/zsh-bench/tree/master/configs/zim%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 41%
🟢 | 206%
🔴 | 115%
🟠 | 365%
🔴 | 28 | | [zinit-turbo](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit-turbo) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 38%
🟢 | 152%
🟠 | 119%
🟠 | 322%
🔴 | 29 | | [zsh-defer](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-defer) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 39%
🟢 | 94%
🟡 | 136%
🟠 | 348%
🔴 | 30 | | [synthetic](https://github.com/romkatv/zsh-bench/tree/master/configs/synthetic) | ❌ | ❌ | ❌ | ❌ | ❌ | 6%
🟢 | 4%
🟢 | 4%
🟢 | 3%
🟢 | 31 | -------------------------------------------------------------------------------- /doc/linux-raspberrypi.txt: -------------------------------------------------------------------------------- 1 | ==> benchmarking no-rcs ... 2 | creates_tty=0 3 | has_compsys=0 4 | has_syntax_highlighting=0 5 | has_autosuggestions=0 6 | has_git_prompt=0 7 | first_prompt_lag_ms=2.742 8 | first_command_lag_ms=3.409 9 | command_lag_ms=0.178 10 | input_lag_ms=0.417 11 | exit_time_ms=3.971 12 | ==> benchmarking tmux ... 13 | creates_tty=1 14 | has_compsys=0 15 | has_syntax_highlighting=0 16 | has_autosuggestions=0 17 | has_git_prompt=0 18 | first_prompt_lag_ms=15.549 19 | first_command_lag_ms=16.347 20 | command_lag_ms=0.178 21 | input_lag_ms=0.442 22 | exit_time_ms=4.365 23 | ==> benchmarking compsys ... 24 | creates_tty=0 25 | has_compsys=1 26 | has_syntax_highlighting=0 27 | has_autosuggestions=0 28 | has_git_prompt=0 29 | first_prompt_lag_ms=67.914 30 | first_command_lag_ms=68.575 31 | command_lag_ms=0.179 32 | input_lag_ms=0.417 33 | exit_time_ms=69.669 34 | ==> benchmarking zsh-syntax-highlighting ... 35 | creates_tty=0 36 | has_compsys=0 37 | has_syntax_highlighting=1 38 | has_autosuggestions=0 39 | has_git_prompt=0 40 | first_prompt_lag_ms=48.268 41 | first_command_lag_ms=91.072 42 | command_lag_ms=2.192 43 | input_lag_ms=58.971 44 | exit_time_ms=49.279 45 | ==> benchmarking zsh-autosuggestions ... 46 | creates_tty=0 47 | has_compsys=0 48 | has_syntax_highlighting=0 49 | has_autosuggestions=1 50 | has_git_prompt=0 51 | first_prompt_lag_ms=80.835 52 | first_command_lag_ms=95.184 53 | command_lag_ms=50.849 54 | input_lag_ms=3.650 55 | exit_time_ms=12.538 56 | ==> benchmarking git-branch ... 57 | creates_tty=0 58 | has_compsys=0 59 | has_syntax_highlighting=0 60 | has_autosuggestions=0 61 | has_git_prompt=1 62 | first_prompt_lag_ms=38.978 63 | first_command_lag_ms=39.603 64 | command_lag_ms=22.386 65 | input_lag_ms=0.419 66 | exit_time_ms=3.620 67 | ==> benchmarking agnoster ... 68 | creates_tty=0 69 | has_compsys=0 70 | has_syntax_highlighting=0 71 | has_autosuggestions=0 72 | has_git_prompt=1 73 | first_prompt_lag_ms=153.284 74 | first_command_lag_ms=154.309 75 | command_lag_ms=103.993 76 | input_lag_ms=0.423 77 | exit_time_ms=6.070 78 | ==> benchmarking starship ... 79 | creates_tty=0 80 | has_compsys=0 81 | has_syntax_highlighting=0 82 | has_autosuggestions=0 83 | has_git_prompt=1 84 | first_prompt_lag_ms=107.029 85 | first_command_lag_ms=107.910 86 | command_lag_ms=100.161 87 | input_lag_ms=0.420 88 | exit_time_ms=10.557 89 | ==> benchmarking powerlevel10k ... 90 | creates_tty=0 91 | has_compsys=0 92 | has_syntax_highlighting=0 93 | has_autosuggestions=0 94 | has_git_prompt=1 95 | first_prompt_lag_ms=6.035 96 | first_command_lag_ms=81.321 97 | command_lag_ms=8.628 98 | input_lag_ms=0.593 99 | exit_time_ms=28.510 100 | ==> benchmarking powerlevel10k-full ... 101 | creates_tty=0 102 | has_compsys=0 103 | has_syntax_highlighting=0 104 | has_autosuggestions=0 105 | has_git_prompt=1 106 | first_prompt_lag_ms=17.716 107 | first_command_lag_ms=216.576 108 | command_lag_ms=33.378 109 | input_lag_ms=6.651 110 | exit_time_ms=47.618 111 | ==> benchmarking prezto ... 112 | creates_tty=0 113 | has_compsys=1 114 | has_syntax_highlighting=0 115 | has_autosuggestions=0 116 | has_git_prompt=0 117 | first_prompt_lag_ms=125.540 118 | first_command_lag_ms=139.832 119 | command_lag_ms=7.058 120 | input_lag_ms=1.389 121 | exit_time_ms=120.842 122 | ==> benchmarking ohmyzsh ... 123 | creates_tty=0 124 | has_compsys=1 125 | has_syntax_highlighting=0 126 | has_autosuggestions=0 127 | has_git_prompt=1 128 | first_prompt_lag_ms=264.238 129 | first_command_lag_ms=271.820 130 | command_lag_ms=100.803 131 | input_lag_ms=1.479 132 | exit_time_ms=165.492 133 | ==> benchmarking zim ... 134 | creates_tty=0 135 | has_compsys=1 136 | has_syntax_highlighting=1 137 | has_autosuggestions=1 138 | has_git_prompt=1 139 | first_prompt_lag_ms=209.346 140 | first_command_lag_ms=289.028 141 | command_lag_ms=108.124 142 | input_lag_ms=69.966 143 | exit_time_ms=65.304 144 | ==> benchmarking zsh4humans ... 145 | creates_tty=1 146 | has_compsys=1 147 | has_syntax_highlighting=1 148 | has_autosuggestions=1 149 | has_git_prompt=1 150 | first_prompt_lag_ms=33.509 151 | first_command_lag_ms=182.830 152 | command_lag_ms=11.855 153 | input_lag_ms=27.498 154 | exit_time_ms=18.888 155 | ==> benchmarking diy ... 156 | creates_tty=1 157 | has_compsys=1 158 | has_syntax_highlighting=1 159 | has_autosuggestions=1 160 | has_git_prompt=1 161 | first_prompt_lag_ms=237.889 162 | first_command_lag_ms=290.235 163 | command_lag_ms=80.327 164 | input_lag_ms=63.554 165 | exit_time_ms=125.122 166 | ==> benchmarking diy+ ... 167 | creates_tty=1 168 | has_compsys=1 169 | has_syntax_highlighting=1 170 | has_autosuggestions=1 171 | has_git_prompt=1 172 | first_prompt_lag_ms=19.126 173 | first_command_lag_ms=338.510 174 | command_lag_ms=11.504 175 | input_lag_ms=68.007 176 | exit_time_ms=145.694 177 | ==> benchmarking diy++ ... 178 | creates_tty=1 179 | has_compsys=1 180 | has_syntax_highlighting=1 181 | has_autosuggestions=1 182 | has_git_prompt=1 183 | first_prompt_lag_ms=19.222 184 | first_command_lag_ms=292.696 185 | command_lag_ms=11.497 186 | input_lag_ms=68.094 187 | exit_time_ms=99.936 188 | ==> benchmarking diy++unsafe ... 189 | creates_tty=1 190 | has_compsys=1 191 | has_syntax_highlighting=1 192 | has_autosuggestions=1 193 | has_git_prompt=1 194 | first_prompt_lag_ms=18.824 195 | first_command_lag_ms=256.514 196 | command_lag_ms=11.482 197 | input_lag_ms=68.052 198 | exit_time_ms=64.527 199 | ==> benchmarking diy++fsyh ... 200 | creates_tty=1 201 | has_compsys=1 202 | has_syntax_highlighting=1 203 | has_autosuggestions=1 204 | has_git_prompt=1 205 | first_prompt_lag_ms=19.546 206 | first_command_lag_ms=290.432 207 | command_lag_ms=10.056 208 | input_lag_ms=24.162 209 | exit_time_ms=104.835 210 | ==> benchmarking zcomet ... 211 | creates_tty=1 212 | has_compsys=1 213 | has_syntax_highlighting=1 214 | has_autosuggestions=1 215 | has_git_prompt=1 216 | first_prompt_lag_ms=18.959 217 | first_command_lag_ms=302.660 218 | command_lag_ms=11.727 219 | input_lag_ms=68.357 220 | exit_time_ms=108.987 221 | ==> benchmarking zinit ... 222 | creates_tty=1 223 | has_compsys=1 224 | has_syntax_highlighting=1 225 | has_autosuggestions=1 226 | has_git_prompt=1 227 | first_prompt_lag_ms=18.908 228 | first_command_lag_ms=536.404 229 | command_lag_ms=11.549 230 | input_lag_ms=68.312 231 | exit_time_ms=334.113 232 | ==> benchmarking zplug ... 233 | creates_tty=1 234 | has_compsys=1 235 | has_syntax_highlighting=1 236 | has_autosuggestions=1 237 | has_git_prompt=1 238 | first_prompt_lag_ms=284.719 239 | first_command_lag_ms=769.701 240 | command_lag_ms=11.620 241 | input_lag_ms=70.552 242 | exit_time_ms=488.326 243 | ==> benchmarking ohmyzsh+ ... 244 | creates_tty=1 245 | has_compsys=1 246 | has_syntax_highlighting=1 247 | has_autosuggestions=1 248 | has_git_prompt=1 249 | first_prompt_lag_ms=18.925 250 | first_command_lag_ms=375.522 251 | command_lag_ms=13.530 252 | input_lag_ms=68.993 253 | exit_time_ms=164.608 254 | ==> benchmarking prezto+ ... 255 | creates_tty=1 256 | has_compsys=1 257 | has_syntax_highlighting=1 258 | has_autosuggestions=1 259 | has_git_prompt=1 260 | first_prompt_lag_ms=28.773 261 | first_command_lag_ms=339.842 262 | command_lag_ms=16.641 263 | input_lag_ms=70.598 264 | exit_time_ms=128.722 265 | ==> benchmarking zim+ ... 266 | creates_tty=1 267 | has_compsys=1 268 | has_syntax_highlighting=1 269 | has_autosuggestions=1 270 | has_git_prompt=1 271 | first_prompt_lag_ms=20.273 272 | first_command_lag_ms=308.415 273 | command_lag_ms=11.524 274 | input_lag_ms=72.936 275 | exit_time_ms=64.816 276 | ==> benchmarking zinit-turbo ... 277 | creates_tty=1 278 | has_compsys=1 279 | has_syntax_highlighting=0 280 | has_autosuggestions=0 281 | has_git_prompt=1 282 | first_prompt_lag_ms=18.888 283 | first_command_lag_ms=227.325 284 | command_lag_ms=11.881 285 | input_lag_ms=64.495 286 | exit_time_ms=154.763 287 | ==> benchmarking zsh-defer ... 288 | creates_tty=1 289 | has_compsys=1 290 | has_syntax_highlighting=0 291 | has_autosuggestions=0 292 | has_git_prompt=1 293 | first_prompt_lag_ms=19.265 294 | first_command_lag_ms=140.824 295 | command_lag_ms=13.558 296 | input_lag_ms=69.697 297 | exit_time_ms=75.270 298 | ==> benchmarking synthetic ... 299 | creates_tty=0 300 | has_compsys=0 301 | has_syntax_highlighting=0 302 | has_autosuggestions=0 303 | has_git_prompt=0 304 | first_prompt_lag_ms=3.047 305 | first_command_lag_ms=6.120 306 | command_lag_ms=0.398 307 | input_lag_ms=0.500 308 | exit_time_ms=4.232 309 | -------------------------------------------------------------------------------- /doc/macos-laptop.md: -------------------------------------------------------------------------------- 1 | | config | tmux | compsys | syntax highlight | auto suggest | git prompt | first prompt lag | first cmd lag | cmd lag | input lag | 2 | |-|-:|-:|-:|-:|-:|-:|-:|-:|-:| 3 | | [no-rcs](https://github.com/romkatv/zsh-bench/tree/master/configs/no-rcs) | ❌ | ❌ | ❌ | ❌ | ❌ | 14%
🟢 | 5%
🟢 | 1%
🟢 | 2%
🟢 | 4 | | [tmux](https://github.com/romkatv/zsh-bench/tree/master/configs/tmux) | ✔️ | ❌ | ❌ | ❌ | ❌ | 24%
🟢 | 8%
🟢 | 2%
🟢 | 2%
🟢 | 5 | | [compsys](https://github.com/romkatv/zsh-bench/tree/master/configs/compsys) | ❌ | ✔️ | ❌ | ❌ | ❌ | 46%
🟢 | 15%
🟢 | 1%
🟢 | 2%
🟢 | 6 | | [zsh-syntax-highlighting](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-syntax-highlighting) | ❌ | ❌ | ✔️ | ❌ | ❌ | 38%
🟢 | 19%
🟢 | 5%
🟢 | 39%
🟢 | 7 | | [zsh-autosuggestions](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-autosuggestions) | ❌ | ❌ | ❌ | ✔️ | ❌ | 36%
🟢 | 14%
🟢 | 98%
🟡 | 5%
🟢 | 8 | | [git-branch](https://github.com/romkatv/zsh-bench/tree/master/configs/git-branch) | ❌ | ❌ | ❌ | ❌ | ✔️ | 79%
🟡 | 27%
🟢 | 287%
🔴 | 1%
🟢 | 9 | | [agnoster](https://github.com/romkatv/zsh-bench/tree/master/configs/agnoster) | ❌ | ❌ | ❌ | ❌ | ✔️ | 145%
🟠 | 48%
🟢 | 706%
🔴 | 1%
🟢 | 10 | | [starship](https://github.com/romkatv/zsh-bench/tree/master/configs/starship) | ❌ | ❌ | ❌ | ❌ | ✔️ | 108%
🟠 | 36%
🟢 | 468%
🔴 | 1%
🟢 | 11 | | [powerlevel10k](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k) | ❌ | ❌ | ❌ | ❌ | ✔️ | 9%
🟢 | 20%
🟢 | 19%
🟢 | 2%
🟢 | 12 | | [powerlevel10k-full](https://github.com/romkatv/zsh-bench/tree/master/configs/powerlevel10k-full) | ❌ | ❌ | ❌ | ❌ | ✔️ | 14%
🟢 | 44%
🟢 | 202%
🔴 | 6%
🟢 | 13 | | [prezto](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto) | ❌ | ✔️ | ❌ | ❌ | ❌ | 146%
🟠 | 50%
🟢 | 27%
🟢 | 4%
🟢 | 14 | | [ohmyzsh](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh) | ❌ | ✔️ | ❌ | ❌ | ✔️ | 257%
🔴 | 87%
🟡 | 729%
🔴 | 2%
🟢 | 15 | | [zim](https://github.com/romkatv/zsh-bench/tree/master/configs/zim) | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | 115%
🟠 | 46%
🟢 | 372%
🔴 | 80%
🟡 | 16 | | [zsh4humans](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh4humans) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 43%
🟢 | 40%
🟢 | 23%
🟢 | 23%
🟢 | 17 | | [diy](https://github.com/romkatv/zsh-bench/tree/master/configs/diy) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 153%
🟠 | 57%
🟡 | 300%
🔴 | 46%
🟢 | 18 | | [diy+](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 34%
🟢 | 63%
🟡 | 21%
🟢 | 62%
🟡 | 19 | | [diy++](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 33%
🟢 | 52%
🟡 | 22%
🟢 | 86%
🟡 | 20 | | [diy++unsafe](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bunsafe) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 26%
🟢 | 49%
🟢 | 22%
🟢 | 49%
🟢 | 21 | | [diy++fsyh](https://github.com/romkatv/zsh-bench/tree/master/configs/diy%2B%2Bfsyh) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 34%
🟢 | 53%
🟡 | 20%
🟢 | 21%
🟢 | 22 | | [zcomet](https://github.com/romkatv/zsh-bench/tree/master/configs/zcomet) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 24%
🟢 | 55%
🟡 | 22%
🟢 | 66%
🟡 | 23 | | [zinit](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 34%
🟢 | 85%
🟡 | 20%
🟢 | 52%
🟡 | 24 | | [zplug](https://github.com/romkatv/zsh-bench/tree/master/configs/zplug) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 283%
🔴 | 198%
🟠 | 22%
🟢 | 87%
🟡 | 25 | | [ohmyzsh+](https://github.com/romkatv/zsh-bench/tree/master/configs/ohmyzsh%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 34%
🟢 | 75%
🟡 | 26%
🟢 | 50%
🟢 | 26 | | [prezto+](https://github.com/romkatv/zsh-bench/tree/master/configs/prezto%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 47%
🟢 | 68%
🟡 | 32%
🟢 | 53%
🟡 | 27 | | [zim+](https://github.com/romkatv/zsh-bench/tree/master/configs/zim%2B) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | 34%
🟢 | 51%
🟡 | 22%
🟢 | 80%
🟡 | 28 | | [zinit-turbo](https://github.com/romkatv/zsh-bench/tree/master/configs/zinit-turbo) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 34%
🟢 | 55%
🟡 | 25%
🟢 | 59%
🟡 | 29 | | [zsh-defer](https://github.com/romkatv/zsh-bench/tree/master/configs/zsh-defer) | ✔️ | ✔️ | ❌ | ❌ | ✔️ | 34%
🟢 | 40%
🟢 | 25%
🟢 | 52%
🟡 | 30 | | [synthetic](https://github.com/romkatv/zsh-bench/tree/master/configs/synthetic) | ❌ | ❌ | ❌ | ❌ | ❌ | 16%
🟢 | 6%
🟢 | 1%
🟢 | 2%
🟢 | 31 | -------------------------------------------------------------------------------- /doc/macos-laptop.txt: -------------------------------------------------------------------------------- 1 | ==> benchmarking no-rcs ... 2 | creates_tty=0 3 | has_compsys=0 4 | has_syntax_highlighting=0 5 | has_autosuggestions=0 6 | has_git_prompt=0 7 | first_prompt_lag_ms=6.763 8 | first_command_lag_ms=6.896 9 | command_lag_ms=0.057 10 | input_lag_ms=0.316 11 | exit_time_ms=3.727 12 | ==> benchmarking tmux ... 13 | creates_tty=1 14 | has_compsys=0 15 | has_syntax_highlighting=0 16 | has_autosuggestions=0 17 | has_git_prompt=0 18 | first_prompt_lag_ms=11.864 19 | first_command_lag_ms=11.911 20 | command_lag_ms=0.218 21 | input_lag_ms=0.313 22 | exit_time_ms=4.273 23 | ==> benchmarking compsys ... 24 | creates_tty=0 25 | has_compsys=1 26 | has_syntax_highlighting=0 27 | has_autosuggestions=0 28 | has_git_prompt=0 29 | first_prompt_lag_ms=22.869 30 | first_command_lag_ms=23.010 31 | command_lag_ms=0.062 32 | input_lag_ms=0.363 33 | exit_time_ms=21.022 34 | ==> benchmarking zsh-syntax-highlighting ... 35 | creates_tty=0 36 | has_compsys=0 37 | has_syntax_highlighting=1 38 | has_autosuggestions=0 39 | has_git_prompt=0 40 | first_prompt_lag_ms=18.836 41 | first_command_lag_ms=29.139 42 | command_lag_ms=0.458 43 | input_lag_ms=7.835 44 | exit_time_ms=14.066 45 | ==> benchmarking zsh-autosuggestions ... 46 | creates_tty=0 47 | has_compsys=0 48 | has_syntax_highlighting=0 49 | has_autosuggestions=1 50 | has_git_prompt=0 51 | first_prompt_lag_ms=17.927 52 | first_command_lag_ms=20.617 53 | command_lag_ms=9.780 54 | input_lag_ms=1.049 55 | exit_time_ms=6.179 56 | ==> benchmarking git-branch ... 57 | creates_tty=0 58 | has_compsys=0 59 | has_syntax_highlighting=0 60 | has_autosuggestions=0 61 | has_git_prompt=1 62 | first_prompt_lag_ms=39.747 63 | first_command_lag_ms=39.841 64 | command_lag_ms=28.721 65 | input_lag_ms=0.122 66 | exit_time_ms=2.631 67 | ==> benchmarking agnoster ... 68 | creates_tty=0 69 | has_compsys=0 70 | has_syntax_highlighting=0 71 | has_autosuggestions=0 72 | has_git_prompt=1 73 | first_prompt_lag_ms=72.500 74 | first_command_lag_ms=72.602 75 | command_lag_ms=70.642 76 | input_lag_ms=0.151 77 | exit_time_ms=5.677 78 | ==> benchmarking starship ... 79 | creates_tty=0 80 | has_compsys=0 81 | has_syntax_highlighting=0 82 | has_autosuggestions=0 83 | has_git_prompt=1 84 | first_prompt_lag_ms=53.978 85 | first_command_lag_ms=54.126 86 | command_lag_ms=46.776 87 | input_lag_ms=0.174 88 | exit_time_ms=11.424 89 | ==> benchmarking powerlevel10k ... 90 | creates_tty=0 91 | has_compsys=0 92 | has_syntax_highlighting=0 93 | has_autosuggestions=0 94 | has_git_prompt=1 95 | first_prompt_lag_ms=4.461 96 | first_command_lag_ms=30.180 97 | command_lag_ms=1.943 98 | input_lag_ms=0.381 99 | exit_time_ms=13.372 100 | ==> benchmarking powerlevel10k-full ... 101 | creates_tty=0 102 | has_compsys=0 103 | has_syntax_highlighting=0 104 | has_autosuggestions=0 105 | has_git_prompt=1 106 | first_prompt_lag_ms=6.791 107 | first_command_lag_ms=65.504 108 | command_lag_ms=20.209 109 | input_lag_ms=1.103 110 | exit_time_ms=17.380 111 | ==> benchmarking prezto ... 112 | creates_tty=0 113 | has_compsys=1 114 | has_syntax_highlighting=0 115 | has_autosuggestions=0 116 | has_git_prompt=0 117 | first_prompt_lag_ms=72.878 118 | first_command_lag_ms=75.330 119 | command_lag_ms=2.661 120 | input_lag_ms=0.803 121 | exit_time_ms=58.958 122 | ==> benchmarking ohmyzsh ... 123 | creates_tty=0 124 | has_compsys=1 125 | has_syntax_highlighting=0 126 | has_autosuggestions=0 127 | has_git_prompt=1 128 | first_prompt_lag_ms=128.399 129 | first_command_lag_ms=130.065 130 | command_lag_ms=72.916 131 | input_lag_ms=0.376 132 | exit_time_ms=61.669 133 | ==> benchmarking zim ... 134 | creates_tty=0 135 | has_compsys=1 136 | has_syntax_highlighting=1 137 | has_autosuggestions=1 138 | has_git_prompt=1 139 | first_prompt_lag_ms=57.712 140 | first_command_lag_ms=69.162 141 | command_lag_ms=37.247 142 | input_lag_ms=15.966 143 | exit_time_ms=20.980 144 | ==> benchmarking zsh4humans ... 145 | creates_tty=1 146 | has_compsys=1 147 | has_syntax_highlighting=1 148 | has_autosuggestions=1 149 | has_git_prompt=1 150 | first_prompt_lag_ms=21.670 151 | first_command_lag_ms=59.519 152 | command_lag_ms=2.305 153 | input_lag_ms=4.519 154 | exit_time_ms=11.679 155 | ==> benchmarking diy ... 156 | creates_tty=1 157 | has_compsys=1 158 | has_syntax_highlighting=1 159 | has_autosuggestions=1 160 | has_git_prompt=1 161 | first_prompt_lag_ms=76.353 162 | first_command_lag_ms=84.996 163 | command_lag_ms=30.017 164 | input_lag_ms=9.235 165 | exit_time_ms=31.670 166 | ==> benchmarking diy+ ... 167 | creates_tty=1 168 | has_compsys=1 169 | has_syntax_highlighting=1 170 | has_autosuggestions=1 171 | has_git_prompt=1 172 | first_prompt_lag_ms=17.031 173 | first_command_lag_ms=94.812 174 | command_lag_ms=2.139 175 | input_lag_ms=12.382 176 | exit_time_ms=38.541 177 | ==> benchmarking diy++ ... 178 | creates_tty=1 179 | has_compsys=1 180 | has_syntax_highlighting=1 181 | has_autosuggestions=1 182 | has_git_prompt=1 183 | first_prompt_lag_ms=16.525 184 | first_command_lag_ms=78.056 185 | command_lag_ms=2.204 186 | input_lag_ms=17.235 187 | exit_time_ms=25.808 188 | ==> benchmarking diy++unsafe ... 189 | creates_tty=1 190 | has_compsys=1 191 | has_syntax_highlighting=1 192 | has_autosuggestions=1 193 | has_git_prompt=1 194 | first_prompt_lag_ms=12.981 195 | first_command_lag_ms=73.517 196 | command_lag_ms=2.182 197 | input_lag_ms=9.735 198 | exit_time_ms=20.834 199 | ==> benchmarking diy++fsyh ... 200 | creates_tty=1 201 | has_compsys=1 202 | has_syntax_highlighting=1 203 | has_autosuggestions=1 204 | has_git_prompt=1 205 | first_prompt_lag_ms=16.774 206 | first_command_lag_ms=79.277 207 | command_lag_ms=1.985 208 | input_lag_ms=4.190 209 | exit_time_ms=27.577 210 | ==> benchmarking zcomet ... 211 | creates_tty=1 212 | has_compsys=1 213 | has_syntax_highlighting=1 214 | has_autosuggestions=1 215 | has_git_prompt=1 216 | first_prompt_lag_ms=11.860 217 | first_command_lag_ms=82.115 218 | command_lag_ms=2.239 219 | input_lag_ms=13.167 220 | exit_time_ms=27.747 221 | ==> benchmarking zinit ... 222 | creates_tty=1 223 | has_compsys=1 224 | has_syntax_highlighting=1 225 | has_autosuggestions=1 226 | has_git_prompt=1 227 | first_prompt_lag_ms=17.064 228 | first_command_lag_ms=127.597 229 | command_lag_ms=1.967 230 | input_lag_ms=10.303 231 | exit_time_ms=68.435 232 | ==> benchmarking zplug ... 233 | creates_tty=1 234 | has_compsys=1 235 | has_syntax_highlighting=1 236 | has_autosuggestions=1 237 | has_git_prompt=1 238 | first_prompt_lag_ms=141.354 239 | first_command_lag_ms=297.472 240 | command_lag_ms=2.194 241 | input_lag_ms=17.487 242 | exit_time_ms=170.709 243 | ==> benchmarking ohmyzsh+ ... 244 | creates_tty=1 245 | has_compsys=1 246 | has_syntax_highlighting=1 247 | has_autosuggestions=1 248 | has_git_prompt=1 249 | first_prompt_lag_ms=16.980 250 | first_command_lag_ms=112.643 251 | command_lag_ms=2.644 252 | input_lag_ms=9.978 253 | exit_time_ms=54.099 254 | ==> benchmarking prezto+ ... 255 | creates_tty=1 256 | has_compsys=1 257 | has_syntax_highlighting=1 258 | has_autosuggestions=1 259 | has_git_prompt=1 260 | first_prompt_lag_ms=23.724 261 | first_command_lag_ms=101.575 262 | command_lag_ms=3.152 263 | input_lag_ms=10.587 264 | exit_time_ms=41.936 265 | ==> benchmarking zim+ ... 266 | creates_tty=1 267 | has_compsys=1 268 | has_syntax_highlighting=1 269 | has_autosuggestions=1 270 | has_git_prompt=1 271 | first_prompt_lag_ms=16.892 272 | first_command_lag_ms=76.266 273 | command_lag_ms=2.183 274 | input_lag_ms=16.056 275 | exit_time_ms=21.882 276 | ==> benchmarking zinit-turbo ... 277 | creates_tty=1 278 | has_compsys=1 279 | has_syntax_highlighting=0 280 | has_autosuggestions=0 281 | has_git_prompt=1 282 | first_prompt_lag_ms=16.955 283 | first_command_lag_ms=82.622 284 | command_lag_ms=2.542 285 | input_lag_ms=11.878 286 | exit_time_ms=41.784 287 | ==> benchmarking zsh-defer ... 288 | creates_tty=1 289 | has_compsys=1 290 | has_syntax_highlighting=0 291 | has_autosuggestions=0 292 | has_git_prompt=1 293 | first_prompt_lag_ms=17.005 294 | first_command_lag_ms=59.724 295 | command_lag_ms=2.521 296 | input_lag_ms=10.439 297 | exit_time_ms=21.549 298 | ==> benchmarking synthetic ... 299 | creates_tty=0 300 | has_compsys=0 301 | has_syntax_highlighting=0 302 | has_autosuggestions=0 303 | has_git_prompt=0 304 | first_prompt_lag_ms=8.108 305 | first_command_lag_ms=9.094 306 | command_lag_ms=0.122 307 | input_lag_ms=0.469 308 | exit_time_ms=5.214 309 | -------------------------------------------------------------------------------- /doc/print-table: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | 'builtin' 'emulate' '-L' 'zsh' '-o' 'no_aliases' '-o' 'err_return' || 'builtin' 'exit' 4 | setopt no_unset extended_glob typeset_silent prompt_percent no_prompt_subst warn_create_global 5 | 6 | () { 7 | 8 | if [[ ${ZSH_VERSION-} != (5.<8->*|<6->.*) ]]; then 9 | print -ru2 -- "${ZSH_SCRIPT:t}: zsh >= 5.8 is required to execute this script" 10 | return 1 11 | fi 12 | 13 | function usage() { 14 | print -r -- "usage: ${ZSH_SCRIPT:t} [OPTION].." 15 | print -r -- 16 | print -r -- 'OPTIONS' 17 | print -r -- ' -h,--help' 18 | print -r -- ' -f,--first-prompt-lag-ms [default=50]' 19 | print -r -- ' -c,--first-command-lag-ms [default=150]' 20 | print -r -- ' -p,--command-lag-ms [default=10]' 21 | print -r -- ' -i,--input-lag-ms [default=20]' 22 | } 23 | 24 | zmodload zsh/zutil 25 | 26 | local -a help 27 | local -a first_prompt_lag_ms=(_ 50) 28 | local -a first_command_lag_ms=(_ 150) 29 | local -a command_lag_ms=(_ 10) 30 | local -a input_lag_ms=(_ 20) 31 | zparseopts -D -K -F -- \ 32 | {h,-help}=help \ 33 | {f,-first-prompt-lag-ms}:=first_prompt_lag_ms \ 34 | {c,-first-command-lag-ms}:=first_command_lag_ms \ 35 | {p,-command-lag-ms}:=command_lag_ms \ 36 | {i,-input-lag-ms}:=input_lag_ms \ 37 | 38 | if (( ARGC )); then 39 | print -ru2 -- "${ZSH_SCRIPT:t}: unexpected positional argument(s)" 40 | return 1 41 | fi 42 | 43 | if (( ! $#first_prompt_lag_ms )); then 44 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required argument: --first-prompt-lag-ms" 45 | return 1 46 | fi 47 | if (( ! $#first_command_lag_ms )); then 48 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required argument: --first-command-lag-ms" 49 | return 1 50 | fi 51 | if (( ! $#command_lag_ms )); then 52 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required argument: --command-lag-ms" 53 | return 1 54 | fi 55 | if (( ! $#input_lag_ms )); then 56 | print -ru2 -- "${ZSH_SCRIPT:t}: missing required argument: --input-lag-ms" 57 | return 1 58 | fi 59 | 60 | () { 61 | local _ x 62 | for _ x in "${(@)first_prompt_lag_ms}" \ 63 | "${(@)first_command_lag_ms}" \ 64 | "${(@)command_lag_ms}" \ 65 | "${(@)input_lag_ms}"; do 66 | if [[ $x != <->(|.<->) || x -le 0 ]] || ; then 67 | print -ru2 -- "${ZSH_SCRIPT:t}: not a positive real number: ${(q-)x}" 68 | return 1 69 | fi 70 | done 71 | } 72 | 73 | function error() { 74 | local -i ret=$? 75 | print -Pru2 -- '%F{2}'${${ZSH_SCRIPT:t}//\%/%%}'%f: %F{1}fatal error%f' 76 | print -Pru2 -- '%F{3}--- stack trace (most recent call first) ---%f' 77 | print -lru2 -- "${funcfiletrace[@]}" 78 | print -Pru2 -- '%F{3}--- end of stack trace ---%f' 79 | return $(( ret ? ret : 1 )) 80 | } 81 | functions -Ms error 82 | 83 | local -A columns=( 84 | creates_tty '2 bool "tmux"' 85 | has_compsys '3 bool "compsys"' 86 | has_syntax_highlighting '4 bool "syntax highlight"' 87 | has_autosuggestions '5 bool "auto suggest"' 88 | has_git_prompt '6 bool "git prompt"' 89 | first_prompt_lag_ms '7 time "first prompt lag"' 90 | first_command_lag_ms '8 time "first cmd lag"' 91 | command_lag_ms '9 time "cmd lag"' 92 | input_lag_ms '10 time "input lag"' 93 | ) 94 | 95 | () { 96 | local row=('config') 97 | local spec 98 | for spec in $columns; do 99 | local c=(${(z)spec}) 100 | row[c[1]]=${(Q)c[3]} 101 | done 102 | print -rn -- "| ${(j: | :)row} |" 103 | print 104 | 105 | print -rn -- '|-|' 106 | repeat $#columns print -rn -- '-:|' 107 | print 108 | } 109 | 110 | local line 111 | local -a row 112 | 113 | function flush() { 114 | if (( $#row == 0 )); then 115 | return 116 | elif (( $#row <= $#columns )); then 117 | row[$#columns+1]= 118 | elif (( $#row != $#columns + 1 )); then 119 | return 'error()' 120 | fi 121 | print -r -- "| ${(j: | :)row} |" 122 | row=() 123 | } 124 | 125 | function process-line() { 126 | line=${line%%[[:space:]]#\#*} 127 | [[ -z $line ]] && return 128 | local -a match mbegin mend 129 | if [[ $line == (#b)'==> setting up user '[^[:space:]]##' with '(?*)' ...' ]]; then 130 | flush 131 | row[1]="[$match](https://github.com/romkatv/zsh-bench/tree/master/configs/${match//+/%2B})" 132 | return 133 | fi 134 | [[ $line == '==> '* ]] && return 135 | [[ $line == (#b)(*)=(*) ]] || return 'error()' 136 | local name=$match[1] 137 | local val=$match[2] 138 | [[ $name == exit_time_ms ]] && return 139 | local c=(${(z)columns[$name]}) 140 | case $c[2] in 141 | bool) 142 | case $val in 143 | 0) val='❌';; 144 | 1) val='✔️';; 145 | *) return 'error()' 146 | esac 147 | ;; 148 | time) 149 | [[ $val == <->(|.<->) && val -ge 0 ]] || return 'error()' 150 | printf -v val -- '%d' $((100. * val / ${name}[2] + 0.5)) 151 | if (( val <= 50 )); then 152 | val="$val%
🟢" 153 | elif (( val <= 100 )); then 154 | val="$val%
🟡" 155 | elif (( val <= 200 )); then 156 | val="$val%
🟠" 157 | else 158 | val="$val%
🔴" 159 | fi 160 | ;; 161 | *) 162 | return 'error()' 163 | ;; 164 | esac 165 | [[ -z ${row[c[1]]-} ]] || return 'error()' 166 | row[c[1]]=$val 167 | } 168 | 169 | while IFS= read -r line; do 170 | process-line 171 | line= 172 | done 173 | 174 | process-line 175 | flush 176 | 177 | } "$@" 178 | -------------------------------------------------------------------------------- /human-bench: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | 'builtin' 'emulate' '-L' 'zsh' '-o' 'no_aliases' '-o' 'err_return' || 'builtin' 'exit' 4 | setopt no_unset typeset_silent prompt_percent no_prompt_subst warn_create_global 5 | 6 | () { 7 | 8 | if [[ ${ZSH_VERSION-} != (5.<8->*|<6->.*) ]]; then 9 | print -ru2 -- "${ZSH_SCRIPT:t}: zsh >= 5.8 is required to execute this script" 10 | return 1 11 | fi 12 | 13 | zmodload zsh/datetime 14 | 15 | function usage() { 16 | print -r -- "usage: ${ZSH_SCRIPT:t} [OPTION].." 17 | print -r -- 18 | print -r -- 'OPTIONS' 19 | print -r -- ' -h,--help' 20 | print -r -- ' -s,--shell-command [default="zsh"]' 21 | print -r -- ' -f,--first-prompt-lag-ms [default=0]' 22 | print -r -- ' -c,--first-command-lag-ms [default=0]' 23 | print -r -- ' -p,--command-lag-ms [default=0]' 24 | print -r -- ' -i,--input-lag-ms [default=0]' 25 | print -r -- 26 | print -r -- 'Latency options can be specified more than once.' 27 | } 28 | 29 | zmodload zsh/zutil 30 | 31 | local -a help shell_command=(_ zsh) 32 | local -a first_prompt_lag_ms first_command_lag_ms command_lag_ms input_lag_ms 33 | zparseopts -D -K -F -- \ 34 | {h,-help}=help {s,-shell-command}:=shell_command \ 35 | {f,-first-prompt-lag-ms}+:=first_prompt_lag_ms \ 36 | {c,-first-command-lag-ms}+:=first_command_lag_ms \ 37 | {p,-command-lag-ms}+:=command_lag_ms \ 38 | {i,-input-lag-ms}+:=input_lag_ms 39 | 40 | if (( ARGC )); then 41 | print -ru2 -- "${ZSH_SCRIPT:t}: unexpected positional argument" 42 | return 1 43 | fi 44 | 45 | if (( $#help )); then 46 | usage 47 | return 48 | fi 49 | 50 | local _ x 51 | for _ x in "${(@)first_prompt_lag_ms}" \ 52 | "${(@)first_command_lag_ms}" \ 53 | "${(@)command_lag_ms}" \ 54 | "${(@)input_lag_ms}"; do 55 | if [[ $x != <->(|.<->) ]]; then 56 | print -ru2 -- "${ZSH_SCRIPT:t}: not a non-negative real number: ${(q-)x}" 57 | return 1 58 | fi 59 | done 60 | 61 | if [[ -v ZDOTDIR ]]; then 62 | export _ZB_ORIG_ZDOTDIR=$ZDOTDIR 63 | fi 64 | 65 | export ZDOTDIR=${ZSH_SCRIPT:h}/internal/zdotdir 66 | 67 | while true; do 68 | print -Prn -- "%F{3}Start zsh? [Y/n]:%f " 69 | local choice 70 | IFS= read -r choice 71 | [[ $choice == (|y|Y|yes|Yes|YES) ]] || return 0 72 | export _ZB_START_TIME_SEC=$EPOCHREALTIME 73 | if (( $#first_prompt_lag_ms )); then 74 | export _ZB_FIRST_PROMPT_LAG_MS=${first_prompt_lag_ms[2 * (RANDOM % ($#first_prompt_lag_ms / 2) + 1)]} 75 | fi 76 | if (( $#first_command_lag_ms )); then 77 | export _ZB_FIRST_COMMAND_LAG_MS=${first_command_lag_ms[2 * (RANDOM % ($#first_command_lag_ms / 2) + 1)]} 78 | fi 79 | if (( $#command_lag_ms )); then 80 | export _ZB_COMMAND_LAG_MS=${command_lag_ms[2 * (RANDOM % ($#command_lag_ms / 2) + 1)]} 81 | fi 82 | if (( $#input_lag_ms )); then 83 | export _ZB_INPUT_LAG_MS=${input_lag_ms[2 * (RANDOM % ($#input_lag_ms / 2) + 1)]} 84 | fi 85 | { 86 | eval -- "() { $shell_command[2] } || true" 87 | } always { 88 | print 89 | if (( $#first_prompt_lag_ms > 2 )); then 90 | print -Pr -- "Chosen value: --first-prompt-lag-ms %F{2}$_ZB_FIRST_PROMPT_LAG_MS%f" 91 | fi 92 | if (( $#first_command_lag_ms > 2 )); then 93 | print -Pr -- "Chosen value: --first-command-lag-ms %F{2}$_ZB_FIRST_COMMAND_LAG_MS%f" 94 | fi 95 | if (( $#command_lag_ms > 2 )); then 96 | print -Pr -- "Chosen value: --command-lag-ms %F{2}$_ZB_COMMAND_LAG_MS%f" 97 | fi 98 | if (( $#input_lag_ms > 2 )); then 99 | print -Pr -- "Chosen value: --input-lag-ms %F{2}$_ZB_INPUT_LAG_MS%f" 100 | fi 101 | } 102 | print -r -- ---------- 103 | done 104 | 105 | } "$@" 106 | -------------------------------------------------------------------------------- /internal/-zb-benchmark-input: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | () { 4 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 5 | 6 | # There is a bug in zsh that sometimes causes `exec` to return 1 with no 7 | # diagnostics when the call actually succeeds. This only happens when running 8 | # `exec` from a zle widget with prompt_subst and command substitutions in 9 | # prompt. For example, it happens when using ohmyzsh with ZSH_THEME=af-magic. 10 | -zb-fd-open() { 11 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 12 | [[ ! -v _zb_benchmark_input_fd ]] 13 | builtin typeset -gi _zb_benchmark_input_fd=-1 14 | # This can spuriously return 1. 15 | builtin exec {_zb_benchmark_input_fd} <$1 || builtin true 16 | (( _zb_benchmark_input_fd >= 0 )) 17 | builtin zle -F $_zb_benchmark_input_fd $2 18 | } 19 | 20 | -zb-fd-close() { 21 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 22 | [[ $_zb_benchmark_input_fd == <0-> ]] 23 | builtin zle -F $_zb_benchmark_input_fd 24 | # This can spuriously return 1. 25 | builtin exec {_zb_benchmark_input_fd}>&- || builtin true 26 | builtin unset _zb_benchmark_input_fd 27 | } 28 | 29 | if [[ -v _zb_benchmark_input_fd ]]; then 30 | -zb-fd-close 31 | else 32 | (( $# == 4 )) || builtin exit 33 | builtin typeset -gr _zb_benchmark_input_output_file=$1 34 | builtin typeset -gr _zb_benchmark_input_fifo_file=$2 35 | builtin typeset -gr _zb_benchmark_input_buffer=$3 36 | builtin typeset -gi _zb_benchmark_input_num_runs=$4 37 | 38 | builtin zmodload zsh/datetime zsh/zselect 39 | builtin zselect -t 70 || builtin true 40 | -zb-fd-open /dev/null -zb-benchmark-input 41 | 42 | -zb-benchmark-input-ready() { 43 | builtin emulate -L zsh -o no_unset -o warn_create_global || builtin exit 44 | if [[ -v ZINIT_SICE && -v ZINIT_REGISTERED_PLUGINS && -v ZINIT_SNIPPETS ]]; then 45 | builtin local requested loaded missing 46 | requested=(${(kou)ZINIT_SICE}) 47 | loaded=(${(ou)ZINIT_REGISTERED_PLUGINS} ${(kou)ZINIT_SNIPPETS}) 48 | missing=(${requested:|loaded}) 49 | (( ! $#missing )) || builtin return 50 | fi 51 | [[ -z ${_zsh_defer_tasks-} ]] 52 | } 53 | fi 54 | } "$@" 55 | 56 | [[ -v _zb_benchmark_input_fd ]] && builtin return 57 | 58 | if ! -zb-benchmark-input-ready; then 59 | -zb-fd-open /dev/null <(builtin zselect -t 10) -zb-benchmark-input 60 | builtin return 61 | fi 62 | 63 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 64 | 65 | if [[ -v widgets[zle-line-pre-redraw] ]]; then 66 | builtin zle -A -- zle-line-pre-redraw -zb-benchmark-input-orig-zle-line-pre-redraw 67 | else 68 | -zb-benchmark-input-do-nothing() {} 69 | builtin zle -N -- -zb-benchmark-input-orig-zle-line-pre-redraw -zb-benchmark-input-do-nothing 70 | fi 71 | 72 | builtin zle -N -- zle-line-pre-redraw -zb-benchmark-input-zle-line-pre-redraw 73 | 74 | -zb-benchmark-input-init() { 75 | -zb-benchmark-input-zle-line-pre-redraw() { 76 | builtin zle -- -zb-benchmark-input-orig-zle-line-pre-redraw "$@" || builtin true 77 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 78 | [[ $_zb_benchmark_input_buffer == ${BUFFER}?* ]] 79 | if (( ! $+_zb_benchmark_input_fd && $#BUFFER + 1 == $#_zb_benchmark_input_buffer )); then 80 | -zb-fd-open /dev/null -zb-benchmark-input-start 81 | fi 82 | } 83 | } 84 | 85 | -zb-benchmark-input-start() { 86 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 87 | 88 | builtin zle -F $_zb_benchmark_input_fd 89 | 90 | -zb-benchmark-input-zle-line-pre-redraw() { 91 | builtin zle -- -zb-benchmark-input-orig-zle-line-pre-redraw "$@" 92 | if (( ${#BUFFER} == ${#_zb_benchmark_input_buffer} )); then 93 | -zb-benchmark-input-zle-line-pre-redraw() { 94 | builtin zle -- -zb-benchmark-input-orig-zle-line-pre-redraw "$@" 95 | } 96 | builtin zle -F $_zb_benchmark_input_fd -zb-benchmark-input-end 97 | fi 98 | } 99 | 100 | builtin : >>$_zb_benchmark_input_fifo_file 101 | builtin : <$_zb_benchmark_input_fifo_file 102 | builtin zselect -t 10 || builtin true 103 | builtin typeset -gF _zb_benchmark_input_start_time=EPOCHREALTIME 104 | } 105 | 106 | -zb-benchmark-input-end() { 107 | builtin local -F end_time=EPOCHREALTIME 108 | 109 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 110 | 111 | -zb-fd-close 112 | 113 | builtin local -F3 t='1e3 * (end_time - _zb_benchmark_input_start_time)' 114 | builtin print -rn -- " $t" >>| $_zb_benchmark_input_output_file 115 | 116 | builtin zle .kill-buffer -w 117 | builtin zle -R 118 | 119 | if (( --_zb_benchmark_input_num_runs )); then 120 | -zb-benchmark-input-init 121 | else 122 | builtin zle -D -- zle-line-pre-redraw 123 | if [[ ! -v functions[-zb-benchmark-input-do-nothing] ]]; then 124 | builtin zle -A -- -zb-benchmark-input-orig-zle-line-pre-redraw zle-line-pre-redraw 125 | fi 126 | -zb-benchmark-prompt 127 | fi 128 | 129 | builtin : >>$_zb_benchmark_input_fifo_file 130 | builtin : <$_zb_benchmark_input_fifo_file 131 | } 132 | 133 | -zb-benchmark-input-init 134 | builtin : >>$_zb_benchmark_input_fifo_file 135 | builtin : <$_zb_benchmark_input_fifo_file 136 | -------------------------------------------------------------------------------- /internal/-zb-benchmark-prompt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 4 | 5 | builtin typeset -gi _zb_benchmark_prompt_n=0 6 | builtin typeset -gF _zb_benchmark_prompt_start_time=0 7 | 8 | builtin zmodload zsh/datetime zsh/zselect 9 | builtin typeset -ga precmd_functions 10 | precmd_functions+=(-zb-benchmark-prompt-precmd) 11 | 12 | -zb-benchmark-prompt-precmd() { 13 | if (( ++_zb_benchmark_prompt_n > _zb_benchmark_prompt_max_iters || 14 | EPOCHREALTIME >= _zb_benchmark_prompt_start_time + 0.1 )); then 15 | if (( _zb_benchmark_prompt_start_time )); then 16 | builtin emulate -L zsh -o err_exit -o no_unset -o warn_create_global || builtin exit 17 | builtin local -F3 t='1e3 * (EPOCHREALTIME - _zb_benchmark_prompt_start_time) / (_zb_benchmark_prompt_n - 1)' 18 | builtin print -rn -- " $t" >>| $_zb_benchmark_prompt_output_file 19 | builtin exit 0 20 | else 21 | builtin zselect -t 10 || builtin true 22 | builtin typeset -gFr _zb_benchmark_prompt_start_time=EPOCHREALTIME 23 | fi 24 | fi 25 | } 26 | -------------------------------------------------------------------------------- /internal/benchmark-many: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return 4 | setopt no_unset extended_glob typeset_silent no_multi_byte \ 5 | prompt_percent no_prompt_subst warn_create_global pipe_fail 6 | 7 | () { 8 | 9 | local -r user=zsh-bench 10 | local -r root_dir=${ZSH_SCRIPT:A:h:h} 11 | 12 | zmodload zsh/zutil 13 | 14 | local -a flags config_dir=(_ $root_dir/configs) 15 | zparseopts -D -K -F -a flags -- \ 16 | {c,-config-dir}:=config_dir \ 17 | {s,-standalone} \ 18 | {l,-login}: \ 19 | {r,-raw}: \ 20 | {d,-scratch-dir}: \ 21 | {i,-iters}: \ 22 | {g,-git}: 23 | 24 | local cfg 25 | for cfg; do 26 | $root_dir/internal/install-config \ 27 | zsh-bench 0 $config_dir[2] $cfg '~/zsh-bench/zsh-bench '${(j: :)${(@qqq)flags}} 28 | done 29 | 30 | } "$@" 31 | -------------------------------------------------------------------------------- /internal/create-repo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o no_unset -o warn_create_global -o pipe_fail 4 | 5 | () { 6 | 7 | (( ARGC == 2 )) 8 | 9 | () { 10 | local cmd 11 | for cmd in rm mkdir xargs git; do 12 | if [[ ! -v commands[$cmd] ]]; then 13 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: ${(q-)cmd}" 14 | return 1 15 | fi 16 | done 17 | } 18 | 19 | local dir=$1 20 | local kind=$2 21 | 22 | command rm -rf -- $dir 23 | command mkdir -p -- $dir 24 | cd -q -- $dir 25 | 26 | local -x GIT_CONFIG_NOSYSTEM=1 27 | local err 28 | err=$( 29 | exec 2>&1 >/dev/null 30 | command git init 31 | if [[ $kind == yes ]]; then 32 | print -rC1 -- {1..10}/{1..10}/{1..10} | command xargs mkdir -p -- 33 | print -rC1 -- {1..10}/{1..10}/{1..10}/{1..10} | command xargs touch -- 34 | zmodload zsh/zselect 35 | zselect -t 100 || true 36 | command git add . 37 | command git commit --quiet --allow-empty --allow-empty-message --no-gpg-sign -m '' 38 | command git status 39 | fi 40 | ) || { 41 | print -ru2 -- $err 42 | return 1 43 | } 44 | 45 | } "$@" 46 | -------------------------------------------------------------------------------- /internal/install-config: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o no_unset -o warn_create_global -o extended_glob 4 | 5 | () { 6 | 7 | (( ARGC > 4 )) 8 | 9 | zmodload zsh/zselect 10 | 11 | unset user 12 | typeset -gr user=$1 13 | local -r root_dir=${ZSH_SCRIPT:A:h:h} 14 | local -r privileged=$2 15 | local -r config_dir=$3 16 | local -r cfg=$4 17 | shift 4 18 | 19 | print -r -- "==> setting up user $user ${cfg:+with $cfg }..." 20 | 21 | local cmds=(ps rm cp chown sudo zsh tee) 22 | (( privileged )) && cmds+=(cat visudo) 23 | 24 | case $OSTYPE in 25 | darwin*) 26 | function try-delete-user() { 27 | command dscl . -delete /Users/$user || true 28 | ! command dscl . -list /Users/$user || return 29 | command rm -rf -- /Users/$user || return 30 | command rm -f -- /private/etc/sudoers.d/$user || return 31 | [[ ! -e /Users/$user ]] || return 32 | [[ ! -e /private/etc/sudoers.d/$user ]] || return 33 | } 34 | local -r home=/Users/$user 35 | cmds+=(dscl) 36 | ;; 37 | linux*) 38 | function try-delete-user() { 39 | command userdel -rf $user || true 40 | command rm -f -- /etc/sudoers.d/$user || return 41 | [[ ! -e /home/$user ]] || return 42 | ! command getent passwd $user || return 43 | } 44 | local -r home=/home/$user 45 | cmds+=(userdel getent useradd passwd) 46 | ;; 47 | *) 48 | print -ru2 -- "${ZSH_SCRIPT:t}: unsupported OS: ${(q-)OSTYPE}" 49 | return 1 50 | ;; 51 | esac 52 | 53 | () { 54 | local cmd 55 | for cmd in $cmds; do 56 | if [[ ! -v commands[$cmd] ]]; then 57 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: ${(q-)cmd}" 58 | return 1 59 | fi 60 | done 61 | } 62 | 63 | if [[ ${ZSH_SCRIPT:A} == ${home:A}/* ]]; then 64 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot execute zsh-bench when it's under $home" 65 | return 1 66 | fi 67 | 68 | () { 69 | local -a ps 70 | if ps=(${(f)"$(command ps -u $user -o tty= 2>/dev/null)"}) && 71 | (( ps[(I)${(b)TTY#/dev/}[[:space:]]#] )); then 72 | print -ru2 -- "${ZSH_SCRIPT:t}: user $user is logged in on this TTY" 73 | return 1 74 | fi 75 | } 76 | 77 | function delete-user() { 78 | local -a pids 79 | local -i delay 80 | for delay in {0..4}; do 81 | zselect -t $((100 * ((1 << delay) - 1))) || true 82 | if pids=($(command ps -u $user -o pid= 2>/dev/null)) && (( $#pids )); then 83 | local sig= 84 | (( delay > 2 )) && sig=-9 85 | kill $sig -- $pids || true 86 | (( delay < 4 )) && continue 87 | fi 88 | { 89 | { command rm -rf -- '' /tmp/**/*(Nu[$user]) } 2>/dev/null || true 90 | } always { 91 | TRY_BLOCK_ERROR=0 92 | } 93 | try-delete-user &>/dev/null && return 94 | done 95 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot delete user $user" 96 | return 1 97 | } 98 | 99 | delete-user 100 | 101 | function cleanup() { 102 | if [[ $1 != EXIT ]]; then 103 | print -ru2 -- "${ZSH_SCRIPT:t}: SIG$1: cleaning up..." 104 | fi 105 | { 106 | delete-user 107 | } always { 108 | [[ $1 == EXIT ]] || exit $((127 + ${signals[(Ie)$1]})) 109 | } 110 | } 111 | 112 | local sig trapped=(${${(A)=:-INT TERM HUP EXIT}:*signals}) 113 | for sig in $trapped; do 114 | trap "trap - $trapped; cleanup $sig" $sig 115 | done 116 | unset sig trapped 117 | 118 | if [[ $OSTYPE == darwin* ]]; then 119 | local -a lines 120 | lines=(${(f)"$(command dscl . -readall /Users UniqueID)"}) 121 | local -i id gap prev=1000 122 | for id in ${(on)${${(M)lines:#UniqueID: <1001->}#* }}; do 123 | if (( id != prev + 1 )); then 124 | (( gap = prev + 1 )) 125 | break 126 | fi 127 | (( prev = id )) 128 | done 129 | (( gap || (gap = prev + 1) )) 130 | command dscl . -create $home 131 | command dscl . -create $home UserShell =zsh 132 | command dscl . -create $home RealName "Zsh Bench User" 133 | command dscl . -create $home UniqueID $gap 134 | command dscl . -create $home PrimaryGroupID 20 135 | command dscl . -create $home NFSHomeDirectory $home 136 | command mkdir -- $home 137 | local group=staff 138 | local sudoersd=/private/etc/sudoers.d 139 | else 140 | command useradd -ms =zsh $user 141 | command passwd -qd $user 142 | command rm -rf -- '' $home/*(ND) 143 | local group=$user 144 | local sudoersd=/etc/sudoers.d 145 | fi 146 | 147 | command mkdir -- $home/zsh-bench 148 | command cp -r -- $root_dir/^(.git|configs)(D) $home/zsh-bench/ 149 | command cp -r -- $config_dir $home/zsh-bench/configs 150 | if [[ -z $cfg ]]; then 151 | command cp -r -- $root_dir/configs/minimal $home/zsh-bench/internal/ 152 | fi 153 | command chown -R ${user}:${group} $home 154 | if [[ -z $cfg ]]; then 155 | command sudo -u $user -- $home/zsh-bench/internal/minimal/setup 156 | fi 157 | 158 | if (( privileged )); then 159 | command cat >$sudoersd/$user <<<"$user ALL=(ALL) NOPASSWD:ALL" 160 | command chmod 440 $sudoersd/$user 161 | command visudo -cq || command visudo -c 162 | fi 163 | 164 | command sudo -u $user tee $home/.gitconfig >/dev/null <<\END 165 | [user] 166 | name = Zsh Bench 167 | email = zsh-bench@example.com 168 | [init] 169 | defaultBranch = master 170 | END 171 | 172 | local cmd=( 173 | ${(f)"$(typeset -pm 'LC_*|LANG|LANGUAGE')"} 174 | 'typeset -gaU path=("${path[@]}" ~/zsh-bench)' 175 | 'cd' 176 | ${cfg:+'~/zsh-bench/configs/'${(qqq)cfg}'/setup'} 177 | $@) 178 | sudo -Hu $user =zsh -c -- ${(j: && :)cmd} 179 | 180 | } "$@" 181 | -------------------------------------------------------------------------------- /internal/install-deps: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ue 4 | 5 | printf '==> setting up the container ...\n' 6 | 7 | aptget() { 8 | DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes \ 9 | command apt-get \ 10 | -o DPkg::options::="--force-confdef" \ 11 | -o DPkg::options::="--force-confold" \ 12 | -qq "$@" >/dev/null 13 | } 14 | 15 | aptget update 16 | aptget upgrade -y 17 | aptget install -y -- bsdutils curl git make ncurses-bin perl sudo util-linux zsh direnv tzdata "$@" 18 | [ $# -eq 0 ] || aptget update 19 | 20 | ( 21 | cd / 22 | starship="$(curl -fsSL https://starship.rs/install.sh)" 23 | tmpdir="$(sudo -u nobody mktemp -d)" 24 | sh -c "$starship" sh -y -b "$tmpdir" >/dev/null 25 | install -- "$tmpdir"/starship /usr/local/bin/ 26 | rm -rf -- "$tmpdir" 27 | ) 28 | 29 | ( 30 | dir="$(dirname -- "$0")" 31 | "$dir"/install-tmux 32 | ) 33 | 34 | git config --system core.untrackedCache true 35 | git config --system user.name "Zsh Bench" 36 | git config --system user.email "zsh-bench@example.com" 37 | git config --system init.defaultBranch "master" 38 | -------------------------------------------------------------------------------- /internal/install-tmux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | emulate -L zsh -o err_return -o no_unset -o warn_create_global 4 | 5 | () { 6 | 7 | (( ! ARGC )) 8 | 9 | DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes \ 10 | >/dev/null command apt-get \ 11 | -o DPkg::options::="--force-confdef" \ 12 | -o DPkg::options::="--force-confold" \ 13 | -qq install -y \ 14 | curl libevent-dev ncurses-dev build-essential bison pkg-config autogen autoconf 15 | 16 | local tmpdir 17 | { 18 | tmpdir=$(sudo -u nobody mktemp -d) 19 | cd -- $tmpdir 20 | 21 | local v=3.2a 22 | local sha256=497bc4ee16f10b53b161bf0253b6f9e20cd0f86c5d0104f149212cb0778ae13a 23 | curl -fsSLO https://github.com/tmux/tmux/archive/refs/tags/$v.tar.gz 24 | sha256sum --check --quiet <<<"$sha256 $v.tar.gz" 25 | sudo -u nobody tar -xz <$v.tar.gz 26 | rm -- $v.tar.gz 27 | cd tmux-$v 28 | 29 | # Apply a patch for https://github.com/tmux/tmux/issues/2909. 30 | sudo -u nobody patch --quiet -u tty.c <<-\END 31 | @@ -313 +313 @@ 32 | - tcflush(c->fd, TCIOFLUSH); 33 | + tcflush(c->fd, TCOFLUSH); 34 | END 35 | 36 | sudo -u nobody ./autogen.sh 2>/dev/null 37 | sudo -u nobody env CFLAGS=-Wno-unused-result ./configure --quiet 38 | 39 | local cpus 40 | cpus=$(getconf _NPROCESSORS_ONLN) 41 | [[ $cpus == <1-> ]] 42 | 43 | sudo -u nobody make -s -j $cpus 44 | make -s install >/dev/null 45 | } always { 46 | if [[ -n $tmpdir ]]; then 47 | cd / 48 | rm -rf -- $tmpdir 49 | fi 50 | } 51 | 52 | } "$@" 53 | -------------------------------------------------------------------------------- /internal/zdotdir/.zshenv: -------------------------------------------------------------------------------- 1 | setopt no_rcs 2 | 3 | if (( ${+_ZB_ORIG_ZDOTDIR} )); then 4 | export ZDOTDIR=$_ZB_ORIG_ZDOTDIR 5 | unset _ZB_ORIG_ZDOTDIR 6 | else 7 | unset ZDOTDIR 8 | fi 9 | 10 | zmodload zsh/datetime 11 | 12 | typeset +x -gF _ZB_START_TIME_SEC _ZB_FIRST_PROMPT_LAG_MS _ZB_FIRST_COMMAND_LAG_MS \ 13 | _ZB_COMMAND_LAG_MS _ZB_INPUT_LAG_MS 14 | 15 | function -zb-sleep-until() { 16 | local -F deadline=$1 17 | while (( EPOCHREALTIME < deadline )) : 18 | } 19 | 20 | function -zb-precmd() { 21 | if (( ${+_ZB_FIRST_PROMPT_LAG_MS} )); then 22 | -zb-sleep-until '_ZB_START_TIME_SEC + 1e-3 * _ZB_FIRST_PROMPT_LAG_MS' 23 | unset _ZB_FIRST_PROMPT_LAG_MS 24 | else 25 | -zb-sleep-until 'EPOCHREALTIME + 1e-3 * _ZB_COMMAND_LAG_MS' 26 | fi 27 | } 28 | 29 | function -zb-preexec() { 30 | -zb-sleep-until '_ZB_START_TIME_SEC + 1e-3 * _ZB_FIRST_COMMAND_LAG_MS' 31 | typeset -g preexec_functions=(${(@)preexec_functions:#-zb-preexec}) 32 | } 33 | 34 | function -zb-pre-redraw() { 35 | (( PENDING || KEYS_QUEUED_COUNT )) || -zb-sleep-until 'EPOCHREALTIME + 1e-3 * _ZB_INPUT_LAG_MS' 36 | } 37 | 38 | zle -N -- zle-line-pre-redraw -zb-pre-redraw 39 | typeset -g precmd_functions=(-zb-precmd) 40 | typeset -g preexec_functions=(-zb-preexec) 41 | -------------------------------------------------------------------------------- /zsh-bench: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | 'builtin' 'emulate' '-L' 'zsh' '-o' 'no_aliases' '-o' 'err_return' || 'builtin' 'exit' 4 | setopt no_unset extended_glob typeset_silent no_multi_byte \ 5 | prompt_percent no_prompt_subst warn_create_global pipe_fail 6 | 7 | () { 8 | 9 | if [[ ${ZSH_VERSION-} != (5.<8->*|<6->.*) ]]; then 10 | print -ru2 -- "${ZSH_SCRIPT:t}: zsh >= 5.8 is required to execute this script" 11 | return 1 12 | fi 13 | 14 | autoload zmathfunc 15 | zmathfunc 16 | 17 | local IFS=$' \t\n\C-@' 18 | local NULLCMD=cat 19 | 20 | local -r self_dir=${ZSH_SCRIPT:A:h} 21 | 22 | zmodload zsh/zutil zsh/system zsh/zselect 23 | 24 | local -a help 25 | local -a config_dir 26 | local -a scratch_dir 27 | local -a standalone 28 | local -a isolation 29 | local -a raw 30 | local -a iters=(--iters 16) 31 | local -a git=(--git yes) 32 | local -a login=(--login yes) 33 | 34 | zparseopts -D -K -F -- \ 35 | {h,-help}=help \ 36 | {r,-raw}=raw \ 37 | {l,-login}:=login \ 38 | {s,-standalone}=standalone \ 39 | {I,-isolation}:=isolation \ 40 | {c,-config-dir}:=config_dir \ 41 | {d,-scratch-dir}:=scratch_dir \ 42 | {i,-iters}:=iters \ 43 | {g,-git}:=git 44 | 45 | if (( $#help )); then 46 | print -r -- "usage: ${ZSH_SCRIPT:t} [OPTION].. [CONFIG].." 47 | print -r -- 48 | print -r -- 'OPTIONS' 49 | print -r -- ' -h,--help' 50 | print -r -- ' -i,--iters [default=16]' 51 | print -r -- ' -l,--login [default=yes]' 52 | print -r -- ' -g,--git [default=yes]' 53 | print -r -- ' -c,--config-dir [default=/configs]' 54 | print -r -- ' -d,--scratch-dir ' 55 | print -r -- ' -I,--isolation ' 56 | print -r -- ' -s,--standalone' 57 | print -r -- ' -r,--raw' 58 | return 59 | fi 60 | 61 | if [[ $iters[2] != <1-> ]]; then 62 | print -ru2 -- "${ZSH_SCRIPT:t}: not a positive integer: ${(q-)iters[2]}" 63 | return 1 64 | fi 65 | 66 | if [[ $git[2] != (yes|no|empty) ]]; then 67 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --git: ${(q-)git[2]}" 68 | return 1 69 | fi 70 | 71 | if [[ $login[2] != (yes|no) ]]; then 72 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --login: ${(q-)login[2]}" 73 | return 1 74 | fi 75 | 76 | if [[ $#isolation -ne 0 && $isolation[2] != (docker|user) ]]; then 77 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --isolation: ${(q-)isolation[2]}" 78 | return 1 79 | fi 80 | 81 | if [[ $#scratch_dir -ne 0 && -z $scratch_dir[2] ]]; then 82 | print -ru2 -- "${ZSH_SCRIPT:t}: --scratch-dir cannot have empty value" 83 | return 1 84 | fi 85 | 86 | if [[ -r /proc/1/cpuset(#qN-.) && 87 | "$( starting $img in docker ..." 160 | 161 | local args=($iters $git $standalone $login $raw -- $@) 162 | local cmd=( 163 | 'cpuset="$(cat /proc/1/cpuset)"' 164 | 'printf "==> docker container ID: %.12s\\n" "${cpuset##*/}"' 165 | 'mkdir ~/zsh-bench' 166 | 'cd ~/zsh-bench' 167 | 'head -c '$#self' | tar -xzm' 168 | 'mkdir configs' 169 | 'cd configs' 170 | 'head -c '$#configs' | tar -xzm' 171 | 'cd ..' 172 | '( ( cat <&3 >/dev/null || true; /bin/kill -TERM -- -$$; ) & ) 3<&0' 173 | './internal/install-deps' 174 | './internal/benchmark-many '${(j: :)${(@qqq)args}}) 175 | 176 | local stdout 177 | exec {stdout}>&1 178 | 179 | { 180 | exec {stdout}>&- 181 | print -r -- $sysparams[pid] 182 | print -rn -- $self 183 | print -rn -- $configs 184 | trap 'exit 0' TERM PIPE 185 | while true; do 186 | zselect -t 360000 || true 187 | print 2>/dev/null || exit 0 188 | done 189 | } | { 190 | local pid 191 | IFS= read -r pid 192 | print -r -- $pid 193 | docker-run ${(j: && :)cmd} >&$stdout 194 | } | { 195 | exec {stdout}>&- 196 | local pid dummy 197 | IFS= read -r pid 198 | { 199 | IFS= read -r dummy && return 'error()' 200 | return 0 201 | } always { 202 | kill -- $pid 2>/dev/null || true 203 | } 204 | } 205 | ;; 206 | 207 | user) 208 | if (( EUID )); then 209 | if (( in_docker )); then 210 | print -ru2 -- "${ZSH_SCRIPT:t}: you must be root for --isolation user" 211 | else 212 | print -ru2 -- "${ZSH_SCRIPT:t}: you must be root for --isolation user; try with sudo" 213 | fi 214 | return 1 215 | fi 216 | $self_dir/internal/benchmark-many $config_dir $iters $git $standalone $login $raw -- $@ 217 | ;; 218 | 219 | *) 220 | return 'error()' 221 | ;; 222 | esac 223 | 224 | return 225 | fi 226 | 227 | if (( $#config_dir )); then 228 | print -ru2 -- "${ZSH_SCRIPT:t}: --config-dir cannot be used without positional arguments" 229 | return 1 230 | fi 231 | 232 | if (( $#isolation )); then 233 | print -ru2 -- "${ZSH_SCRIPT:t}: --isolation cannot be used without positional arguments" 234 | return 1 235 | fi 236 | 237 | case $login[2] in 238 | yes) 239 | local loginopt=l 240 | print -r -- "==> benchmarking login shell ${USER:+of user $USER }..." 241 | ;; 242 | no) 243 | local loginopt= 244 | print -r -- "==> benchmarking interactive shell ${USER:+of user $USER }..." 245 | ;; 246 | *) 247 | return 'error()' 248 | ;; 249 | esac 250 | 251 | zmodload zsh/datetime 252 | 253 | local -r stats=( 254 | creates_tty 255 | has_compsys 256 | has_syntax_highlighting 257 | has_autosuggestions 258 | has_git_prompt 259 | first_prompt_lag_ms 260 | first_command_lag_ms 261 | command_lag_ms 262 | input_lag_ms 263 | exit_time_ms) 264 | 265 | local -- $stats 266 | unset -- $stats 267 | 268 | function record-metric() { 269 | local t=$1 270 | local name=$2 271 | local -$t val=$3 272 | if (( $#raw )); then 273 | typeset -ga $name 274 | set -A $name ${(P)name} $val 275 | elif [[ ! -v $name || val -lt $name ]]; then 276 | typeset -g$t $name=$val 277 | fi 278 | } 279 | 280 | () { 281 | local cmd 282 | for cmd in cat cp git ln mkdir mkfifo mktemp rm script touch zsh mv xargs; do 283 | if [[ ! -v commands[$cmd] ]]; then 284 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: ${(q-)cmd}" 285 | return 1 286 | fi 287 | done 288 | } 289 | 290 | local script_version 291 | if script_version=$(LC_ALL=C script -V 2>/dev/null) && 292 | [[ $script_version == 'script from util-linux'* ]]; then 293 | local -ir bsd_script=0 294 | 295 | function script() { 296 | with-env command script -fqec "${(j: :)@:2}" -- "$1" >/dev/null 297 | } 298 | else 299 | local -ir bsd_script=1 300 | 301 | function script() { 302 | with-env command script -rqt0 -- "${(@Q)@}" >/dev/null 303 | } 304 | 305 | () { 306 | local x 307 | printf -v x '%x' -1 308 | if (( $#x < 16 )); then 309 | print -ru2 -- "${ZSH_SCRIPT:t}: 32-bit zsh is not supported when using BSD script" 310 | return 1 311 | fi 312 | } 313 | 314 | function make-int() { 315 | if (( #2 )); then 316 | set -- ${@:3} $1 317 | else 318 | set -- ${(Oa)@:3} $1 319 | fi 320 | (( ARGC <= 9 && (ARGC < 9 || #1 < 128) )) || return 'error()' 321 | typeset -gi ${@[-1]}=0 322 | while (( ARGC > 1 )); do 323 | (( ${@[-1]} = ${@[-1]} << 8 | #1, 1 )) 324 | shift 325 | done 326 | } 327 | 328 | function scr-record() { 329 | local header 330 | while true; do 331 | local -i n=$((24 - $#header)) 332 | (( n )) || break 333 | sysread -s $n 'header[$#header+1]' || return 'error()' 334 | done 335 | header=(${(s::)header}) 336 | make-int scr_len $header[-1] $header[1,8] 337 | make-int scr_sec $header[-1] $header[9,16] 338 | make-int scr_usec $header[-1] $header[17,20] 339 | make-int scr_direction $header[-1] $header[21,24] 340 | typeset -g scr_data= 341 | while (( $#scr_data != scr_len )); do 342 | sysread -s $((scr_len - $#scr_data)) 'scr_data[$#scr_data+1]' || return 'error()' 343 | done 344 | } 345 | 346 | function scr-convert() { 347 | scr-record 348 | (( scr_direction == 115 )) || return 'error()' 349 | local -F last t 350 | local -F6 dt 351 | (( last = scr_sec + 1e-6 * scr_usec, 1 )) 352 | print -ru1 -- 'Script started' 353 | while true; do 354 | scr-record 355 | if (( scr_direction == 111 )); then 356 | (( (t = scr_sec + 1e-6 * scr_usec), (dt = t - last), (last = t), 1 )) 357 | print -ru3 -- $dt $#scr_data 358 | print -nru1 -- $scr_data 359 | elif (( scr_direction == 101 )); then 360 | print -u1 -- '\nScript done' 361 | break 362 | else 363 | (( scr_direction == 105 )) || return 'error()' 364 | fi 365 | done 366 | local REPLY 367 | sysread && return 'error()' 368 | (( $? == 5 )) || return 'error()' 369 | } 370 | fi 371 | 372 | function error() { 373 | local -i ret=$? 374 | print -Pru2 -- '%F{2}'${${ZSH_SCRIPT:t}//\%/%%}'%f: %F{1}fatal error%f' 375 | print -Pru2 -- '%F{3}--- stack trace (most recent call first) ---%f' 376 | print -lru2 -- "${funcfiletrace[@]}" 377 | print -Pru2 -- '%F{3}--- end of stack trace ---%f' 378 | return $(( ret ? ret : 1 )) 379 | } 380 | functions -Ms error 381 | 382 | if (( $#scratch_dir )); then 383 | local -r _zb_tmpdir=${scratch_dir[2]:a} 384 | command rm -rf -- $_zb_tmpdir 385 | if [[ -e $_zb_tmpdir ]]; then 386 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot delete scratch dir: ${(q-)_zb_tmpdir}" 387 | return 1 388 | fi 389 | command mkdir -p -- $_zb_tmpdir 390 | else 391 | unset _zb_tmpdir _zb_fd 392 | 393 | function cleanup() { 394 | if [[ $1 != EXIT ]]; then 395 | print -ru2 -- "${ZSH_SCRIPT:t}: SIG$1: cleaning up..." 396 | fi 397 | if [[ -n ${_zb_fd-} ]]; then 398 | exec {_zb_fd}>&- 2>/dev/null || true 399 | fi 400 | if [[ -n ${_zb_tmpdir-} ]]; then 401 | cd -q -- / 402 | local -i delay 403 | for delay in {0..4}; do 404 | zselect -t $((100 * ((1 << delay) - 1))) || true 405 | command rm -rf -- $_zb_tmpdir 2>/dev/null || true 406 | [[ -e $_zb_tmpdir ]] || break 407 | done 408 | fi 409 | [[ $1 == EXIT ]] || exit $((127 + ${signals[(Ie)$1]})) 410 | } 411 | 412 | local sig trapped=(${${(A)=:-INT TERM HUP EXIT}:*signals}) 413 | for sig in $trapped; do 414 | trap "trap - $trapped; cleanup $sig" $sig 415 | done 416 | unset sig trapped 417 | 418 | typeset -g _zb_tmpdir 419 | _zb_tmpdir=$(command mktemp -d ${TMPDIR:-/tmp}/zsh-bench-XXXXXXXXXX) 420 | typeset -gr _zb_tmpdir 421 | fi 422 | 423 | cd -q -- $_zb_tmpdir 424 | 425 | function make-pat() { 426 | local name=$1 427 | shift 428 | local word words=() junk=$'(\e''(\(B|\[m|\[<->m))#' 429 | for word; do 430 | words+=("(${(pj:$junk:)${(@b)${(@s::)word}}})") 431 | done 432 | typeset -gr $name="(${(j:|:)words})" 433 | } 434 | 435 | local -r zsh_version_file=$_zb_tmpdir/zsh_version 436 | local -r info_file=$_zb_tmpdir/info 437 | local -r fifo_file=$_zb_tmpdir/fifo 438 | local -r out_file=$_zb_tmpdir/out 439 | local -r timing_file=$_zb_tmpdir/timing 440 | local -r merged_file=$_zb_tmpdir/merged 441 | 442 | local -r prefix=ZB${(l:5::0:)RANDOM}- 443 | local -r start=$'\e[H\e[J'${prefix}start$'\e[H\e[J' 444 | local -r msg=${(qqq)prefix}${(qqq):-msg} 445 | local -r cwd=${prefix}cwd 446 | local -r host=${prefix}host 447 | local -r git_branch=${prefix}branch 448 | local -r src=./s 449 | 450 | local -r bench_input_file=$self_dir/internal/-zb-benchmark-input 451 | local -r bench_prompt_file=$self_dir/internal/-zb-benchmark-prompt 452 | 453 | local -ri bench_input_iters=2 454 | local -r bench_prompt_max_iters=1000 455 | 456 | local bench_input_buf=' \abc' 457 | repeat 5 bench_input_buf+=$bench_input_buf 458 | bench_input_buf+="'" 459 | local -r bench_input_buf 460 | 461 | make-pat prompt_pat $cwd $host 462 | make-pat msg_pat ${(Q)msg} 463 | make-pat branch_pat $git_branch 464 | 465 | command mkfifo -- $fifo_file 466 | command mkdir -- $cwd 467 | cd -q -- $cwd 468 | 469 | () { 470 | local -a info_bits=( 471 | '"${(qqq)TERM-}"' 472 | '"${+functions[compinit]}${+functions[compdef]}"' 473 | '"${+_ZSH_AUTOSUGGEST_BIND_COUNTS}"' 474 | '"${+ZSH_HIGHLIGHT_VERSION}${+FAST_HIGHLIGHT_VERSION}"') 475 | 476 | print -r -- '"builtin" "print" '$msg 477 | print -r -- '"builtin" "[" "$?" "-eq" "0" "]" || "builtin" "exit"' 478 | print -rn -- '"builtin" "autoload" "-Uz" "--" '${(qqq)bench_input_file} 479 | print -rn -- ' && "builtin" "autoload" "-Uz" "--" '${(qqq)bench_prompt_file} 480 | print -rn -- ' && "builtin" "print" "-rn" "--" '$info_bits' >| '${(qqq)info_file} 481 | print -rn -- ' && "builtin" "typeset" "-gr" _zb_benchmark_prompt_output_file='${(qqq)info_file} 482 | print -rn -- ' && "builtin" "typeset" "-gir" _zb_benchmark_prompt_max_iters='${(qqq)bench_prompt_max_iters} 483 | print -rn -- " && ${(qqq)bench_input_file:t} ${(qqq)info_file} ${(qqq)fifo_file} ${(qqq)bench_input_buf} ${(qqq)bench_input_iters}" 484 | print -r -- ' || "builtin" "exit"' 485 | } >$src 486 | 487 | unset -m 'GIT_*|TMUX*' || true 488 | 489 | () { 490 | case $git[2] in 491 | yes) 492 | print -rC1 -- {1..10}/{1..10}/{1..10} | command xargs mkdir -p -- 493 | print -rC1 -- {1..10}/{1..10}/{1..10}/{1..10} | command xargs touch -- 494 | ;; 495 | no) return;; 496 | empty) ;; 497 | *) return 'error()';; 498 | esac 499 | 500 | local -x GIT_CONFIG_NOSYSTEM=1 HOME=$_zb_tmpdir 501 | local err=$_zb_tmpdir/git.log 502 | { 503 | command git init 504 | command git config user.name "Your Name" 505 | command git config user.email "you@example.com" 506 | if [[ $git[2] == yes ]]; then 507 | zselect -t 100 || true 508 | command git add . 509 | command git commit --quiet --allow-empty --allow-empty-message --no-gpg-sign -m '' 510 | command git status 511 | fi 512 | command git checkout -b $git_branch 513 | } >/dev/null 2>$err || { 514 | <$err >&2 515 | return 1 516 | } 517 | } 518 | 519 | if (( LINES )); then 520 | local -ri lines=LINES 521 | else 522 | local -ri lines=20 523 | fi 524 | if (( COLUMNS )); then 525 | local -ri columns=COLUMNS 526 | else 527 | local -ri columns=80 528 | fi 529 | 530 | function with-env() { 531 | unsetopt xtrace 532 | HOST=${host} TERM=xterm-256color LINES=$lines COLUMNS=$columns "$@" 533 | } 534 | 535 | function mask-shell-integration() { 536 | local e=$'\e' a=$'\a' 537 | local begin=$e'(\](0|1|2|7|1337);|k)' 538 | local end='('$e'\\|'$a')' 539 | local mid='[^'$e$a']#' 540 | local pat=${begin}${mid}${end} 541 | local MATCH MBEGIN MEND 542 | out=${(S)out//(#m)$~pat/${MATCH//?/X}} 543 | } 544 | 545 | () { 546 | local out 547 | out=$(with-env command zsh -${loginopt}ic '"builtin" "exit"' 2>&1 *|<6->.*) ]]; then 567 | print -ru2 -- "${ZSH_SCRIPT:t}: zsh >= 5.8 is required" 568 | return 1 569 | fi 570 | } 571 | 572 | typeset -g _zb_fd 573 | sysopen -ao cloexec -u _zb_fd >( 574 | exec 2>/dev/null 575 | { 576 | { 577 | print -rn -- ' "builtin" ":" >>'${(qqq)fifo_file} 578 | print -rn -- ' && "builtin" ":" <'${(qqq)fifo_file} 579 | print -r -- ' || "builtin" "exit"' 580 | local REPLY 581 | sysread || true 582 | print -r -- ' "builtin" "exit" "0"' 583 | } | script /dev/null ${(qqq)commands[zsh]} ${(qqq):-"-${loginopt}i"} 584 | } &! 585 | ) 586 | 587 | : <$fifo_file 588 | : >>$fifo_file 589 | zselect -t 100 || true 590 | 591 | if (( $#standalone )); then 592 | exec {_zb_fd}>&- 593 | unset _zb_fd 594 | zselect -t 100 || true 595 | fi 596 | 597 | repeat $iters[2]; do 598 | command rm -f -- $info_file $merged_file {$timing_file,$out_file}{,.orig} 599 | 600 | { 601 | print -r -- ' "builtin" "." '${(qqq)src} 602 | : <$fifo_file 603 | : >>$fifo_file 604 | 605 | repeat $bench_input_iters; do 606 | print -rn -- $bench_input_buf[1,-2] 607 | : <$fifo_file 608 | : >>$fifo_file 609 | print -rn -- $bench_input_buf[-1] 610 | : <$fifo_file 611 | : >>$fifo_file 612 | done 613 | 614 | print -r -- ${(pl:$bench_prompt_max_iters::\n:):-} 615 | } | { 616 | if (( bsd_script )); then 617 | local -a reply 618 | zselect -r 0 619 | script $merged_file $commands[zsh] ${loginopt:+-$loginopt} 620 | else 621 | local cmd='"builtin" "emulate" "-R" "zsh"' 622 | cmd+=' && "builtin" "zmodload" "zsh/zselect"' 623 | cmd+=' && "builtin" "zselect" "-r" "0"' 624 | cmd+=' && "builtin" "print" "-rn" "--" '${(qqqq)start} 625 | cmd+=' && "builtin" "exec" "--" '${(qqq)commands[zsh]}' '${(qqq):-"-${loginopt}i"} 626 | script /dev/null '"command"' '"script"' -fqet${(qqq)timing_file} \ 627 | '"-c"' ${(qqq)cmd} ${(qqq)out_file} 628 | fi 629 | } 630 | 631 | if (( bsd_script )); then 632 | scr-convert <$merged_file >$out_file 3>$timing_file 633 | fi 634 | 635 | local -a timing 636 | timing=($(<$timing_file)) 637 | (( $#timing % 2 == 0 )) || return 'error()' 638 | 639 | local out 640 | out=$(<$out_file) 641 | [[ $out == *$'\n'*$'\n'* ]] || return 'error()' 642 | out=${${out#*$'\n'}%$'\n'*} 643 | 644 | () { 645 | local -i p 646 | local dt dp 647 | for dt dp in $timing; do 648 | [[ $dt == <->(|.<->) ]] || return 'error()' 649 | [[ $dp == <1-> ]] || return 'error()' 650 | (( p += dp )) 651 | done 652 | (( p == $#out )) || return 'error()' 653 | } 654 | 655 | () { 656 | (( bsd_script )) && return 657 | command mv -- $timing_file $timing_file.orig 658 | command mv -- $out_file $out_file.orig 659 | local suf=${out#*$start} 660 | local -i drop=$(($#out - $#suf)) 661 | (( drop )) || return 'error()' 662 | local -r intro=$'\e[H\e[J' 663 | local -i i p dp 664 | local dt 665 | for i in {1..$#timing..2}; do 666 | dt=$timing[i] 667 | dp='timing[i+1]' 668 | (( p += dp )) 669 | (( p < drop )) && continue 670 | if (( p - dp < drop )); then 671 | printf '%.6f %d\n' 0 $#intro 672 | if (( p > drop )); then 673 | printf '%.6f %d\n' 0 $((p - drop)) 674 | fi 675 | else 676 | printf '%s %s\n' $dt $dp 677 | fi 678 | done >$timing_file 679 | timing=($(<$timing_file)) 680 | out=$intro$suf 681 | print -rC1 -- 'Script started' $out 'Script done' >$out_file 682 | } 683 | 684 | mask-shell-integration 685 | 686 | function timeat() { 687 | [[ ARGC -eq 1 && $1 == <1-> ]] || return 'error()' 688 | local -ir needle=$1 689 | local -F t dt 690 | local -i p dp 691 | for dt dp in $timing; do 692 | (( t += dt, p += dp )) 693 | if (( p >= needle )); then 694 | typeset -g REPLY=$((1e3 * t)) 695 | return 0 696 | fi 697 | done 698 | return 1 699 | } 700 | 701 | function timeof() { 702 | [[ ARGC -eq 1 && -n $1 ]] || return 'error()' 703 | local -r pat=$1 704 | local suf=${out#*${~pat}} 705 | local -i pos=$(($#out - $#suf)) 706 | (( pos )) || return 707 | timeat $pos 708 | } 709 | 710 | local REPLY 711 | 712 | if ! timeof $prompt_pat; then 713 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot find prompt; make sure it contains hostname or the last part of the current directory" 714 | return 1 715 | fi 716 | record-metric F3 first_prompt_lag_ms REPLY 717 | 718 | if ! timeof $msg_pat; then 719 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot find the output of the first command" 720 | return 1 721 | fi 722 | record-metric F3 first_command_lag_ms REPLY 723 | 724 | local -F first_cmd=REPLY 725 | if timeof $branch_pat && (( REPLY <= first_cmd )); then 726 | record-metric i has_git_prompt 1 727 | else 728 | record-metric i has_git_prompt 0 729 | fi 730 | 731 | if [[ ! -e $info_file ]]; then 732 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot find the info file" 733 | return 1 734 | fi 735 | 736 | local info 737 | info=$(<$info_file) 738 | info=(${(@Q)${(z)info}}) 739 | (( $#info == 7 )) || return 'error()' 740 | 741 | if [[ $info[1] == (screen|tmux)* ]]; then 742 | record-metric i creates_tty 1 743 | else 744 | record-metric i creates_tty 0 745 | fi 746 | 747 | [[ $info[2] == <0-1><0-1> ]] || return 'error()' 748 | record-metric i has_compsys $(( info[2] == 11 )) 749 | 750 | [[ $info[3] == <0-1> ]] || return 'error()' 751 | record-metric i has_autosuggestions $(( info[3] != 0 )) 752 | 753 | [[ $info[4] == <0-1><0-1> ]] || return 'error()' 754 | record-metric i has_syntax_highlighting $(( info[4] != 0 )) 755 | 756 | [[ $info[5] == <->.<-> ]] || return 'error()' 757 | [[ $info[6] == <->.<-> ]] || return 'error()' 758 | record-metric F3 input_lag_ms 'min(info[5], info[6])' 759 | 760 | [[ $info[7] == <->.<-> ]] || return 'error()' 761 | record-metric F3 command_lag_ms 'info[7]' 762 | 763 | local -F start_s=EPOCHREALTIME 764 | command zsh -${loginopt}ic '"builtin" "exit"' /dev/null || true 765 | record-metric F3 exit_time_ms '1e3 * (EPOCHREALTIME - start_s)' 766 | 767 | zselect -t 10 || true 768 | done 769 | 770 | () { 771 | local name 772 | for name in $stats; do 773 | [[ -v $name ]] || continue 774 | print -rn -- $name= 775 | if [[ $parameters[$name] == array* ]]; then 776 | print -r -- "( ${(j: :)${(@q-)${(P)name}}} )" 777 | else 778 | print -r -- "${(q-)${(P)name}}" 779 | fi 780 | done 781 | } 782 | 783 | } "$@" 784 | -------------------------------------------------------------------------------- /zsh-playground: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | 'builtin' 'emulate' '-L' 'zsh' '-o' 'no_aliases' '-o' 'err_return' || 'builtin' 'exit' 4 | setopt no_unset extended_glob typeset_silent no_multi_byte \ 5 | prompt_percent no_prompt_subst warn_create_global pipe_fail 6 | 7 | () { 8 | 9 | if [[ ${ZSH_VERSION-} != (5.<8->*|<6->.*) ]]; then 10 | print -ru2 -- "${ZSH_SCRIPT:t}: zsh >= 5.8 is required to execute this script" 11 | return 1 12 | fi 13 | 14 | local -r root_dir=${ZSH_SCRIPT:A:h} 15 | 16 | zmodload zsh/zutil zsh/system zsh/zselect 17 | 18 | local -a help privileged git config_dir=(--config-dir $root_dir/configs) 19 | 20 | if [[ -r /proc/1/cpuset(#qN-.) && 21 | "$(' 43 | print -r -- ' -g,--git [default=no]' 44 | return 45 | fi 46 | 47 | if [[ ! -d $config_dir[2] ]]; then 48 | print -ru2 -- "${ZSH_SCRIPT:t}: directory does not exist: ${(q-)config_dir[2]}" 49 | return 1 50 | fi 51 | 52 | if [[ $isolation[2] != (docker|user) ]]; then 53 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --isolation: ${(q-)isolation[2]}" 54 | return 1 55 | fi 56 | 57 | if (( ARGC > 1 )); then 58 | print -ru2 -- "${ZSH_SCRIPT:t}: too many positional arguments" 59 | return 1 60 | fi 61 | 62 | if (( ARGC )); then 63 | local -r cfg=$1 64 | 65 | if [[ -z $cfg || $cfg == */* ]]; then 66 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid config name: ${(q-)cfg}" 67 | return 1 68 | fi 69 | if [[ ! -e $config_dir[2]/$cfg ]]; then 70 | print -ru2 -- "${ZSH_SCRIPT:t}: directory does not exist: $config_dir[2]/$cfg" 71 | return 1 72 | fi 73 | if [[ ! -e $config_dir[2]/$cfg/setup ]]; then 74 | print -ru2 -- "${ZSH_SCRIPT:t}: file does not exist: $config_dir[2]/$cfg/setup" 75 | return 1 76 | fi 77 | if [[ ! -f $config_dir[2]/$cfg/setup || ! -x $config_dir[2]/$cfg/setup ]]; then 78 | print -ru2 -- "${ZSH_SCRIPT:t}: not an executable file: $config_dir[2]/$cfg/setup" 79 | return 1 80 | fi 81 | else 82 | local -r cfg= 83 | fi 84 | 85 | if [[ ! -t 0 || ! -t 1 || ! -t 2 ]]; then 86 | print -ru2 -- "${ZSH_SCRIPT:t}: all standard file descriptors must be TTY" 87 | return 1 88 | fi 89 | 90 | if [[ $isolation[2] == user ]]; then 91 | if (( EUID )); then 92 | if (( in_docker )); then 93 | print -ru2 -- "${ZSH_SCRIPT:t}: you must be root for --isolation user" 94 | else 95 | print -ru2 -- "${ZSH_SCRIPT:t}: you must be root for --isolation user; try with sudo" 96 | fi 97 | return 1 98 | fi 99 | local create_repo=() 100 | if (( $#git )); then 101 | if [[ $git[2] != (yes|no|empty) ]]; then 102 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --git: ${(q-)git[2]}" 103 | return 1 104 | fi 105 | if [[ $git[2] != no ]]; then 106 | create_repo=('~/zsh-bench/internal/create-repo ~/repo '${(q-)git[2]} 'cd ~/repo') 107 | fi 108 | fi 109 | exec -- $root_dir/internal/install-config \ 110 | 'zsh-playground' $#privileged $config_dir[2] "$cfg" $create_repo 'exec zsh -l' 111 | return 112 | fi 113 | 114 | [[ $isolation[2] == docker ]] 115 | 116 | () { 117 | local cmd 118 | for cmd in docker tar; do 119 | if [[ ! -v commands[$cmd] ]]; then 120 | print -ru2 -- "${ZSH_SCRIPT:t}: command not found: ${(q-)cmd}" 121 | return 1 122 | fi 123 | done 124 | } 125 | 126 | local -r img=ubuntu:22.04 127 | 128 | function docker-run() { 129 | local flags=(-i --rm --init -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -w /root) 130 | if (( $#privileged )); then 131 | flags+=(--privileged -v /:/host) 132 | fi 133 | DOCKER_CONTENT_TRUST=1 command docker run $flags -- $img sh -uec "$1" 134 | } 135 | 136 | if ! docker-run true; then 137 | print -ru2 -- "${ZSH_SCRIPT:t}: cannot run docker; try with sudo?" 138 | return 1 139 | fi 140 | 141 | local self configs= minimal= 142 | self=${"$(cd -q -- $root_dir && command tar -cz -- ^(.git|configs) && print -n x)"[1,-2]} 143 | () { 144 | (( $# )) || set -- $config_dir[2]/*(ND:t) 145 | (( $# )) || return 0 146 | configs=${"$(cd -q -- $config_dir[2] && command tar -cz -- $@ && print -n x)"[1,-2]} 147 | } $cfg 148 | if [[ ! -e $root_dir/internal/minimal ]]; then 149 | minimal=${"$(cd -q -- $root_dir/configs && command tar -cz -- minimal && print -n x)"[1,-2]} 150 | fi 151 | 152 | print -r -- "==> starting $img in docker ..." 153 | 154 | local setup=( 155 | 'cpuset="$(cat /proc/1/cpuset)"' 156 | '[ -n "$cpuset" ]' 157 | 'printf "==> docker container ID: %.12s\\n" "${cpuset##*/}" >&2' 158 | 'mkdir ~/zsh-bench' 159 | 'cd ~/zsh-bench' 160 | 'head -c '$#self' | tar -xzm' 161 | 'mkdir configs' 162 | 'cd configs' 163 | ${configs:+'head -c '$#configs' | tar -xzm'} 164 | 'cd ../internal' 165 | ${minimal:+'head -c '$#minimal' | tar -xzm'} 166 | 'cd /' 167 | '( ( cat <&3 >/dev/null || true; /bin/kill -TERM -- -$$; ) & ) 3<&0' 168 | '~/zsh-bench/internal/install-deps >&2' 169 | 'zsh="$(which zsh)"' 170 | 'chsh -s "$zsh"' 171 | '~/zsh-bench/internal/minimal/setup' 172 | 'printf "%s\\n" "$cpuset"' 173 | 'cat >/dev/null') 174 | 175 | if [[ -n $cfg ]]; then 176 | local -a create_repo=() 177 | if (( $#git )); then 178 | if [[ $git[2] != (yes|no|empty) ]]; then 179 | print -ru2 -- "${ZSH_SCRIPT:t}: invalid value of --git: ${(q-)git[2]}" 180 | return 1 181 | fi 182 | if [[ $git[2] != no ]]; then 183 | create_repo=( 184 | '~/zsh-bench/internal/create-repo ~/repo '${(q-)git[2]} 185 | 'cd ~/repo') 186 | fi 187 | fi 188 | local login=( 189 | 'exec' 190 | '~/zsh-bench/internal/install-config' 191 | 'zsh-playground' 192 | $#privileged 193 | '~/zsh-bench/configs' 194 | ${(qqq)cfg} 195 | ${(@qqq)create_repo} 196 | '"exec zsh -l"') 197 | else 198 | if (( $#git )); then 199 | print -ru2 -- "${ZSH_SCRIPT:t}: --git is incompatible with --isolation user and positional arguments" 200 | return 1 201 | fi 202 | local cmds=('cd' 'SHELL=/usr/bin/zsh PATH="$PATH:$HOME/zsh-bench" exec zsh -l') 203 | local login=(${(j: && :)cmds}) 204 | fi 205 | 206 | local tty 207 | exec {tty}<&0 208 | 209 | { 210 | exec {tty}<&- 211 | print -r -- $sysparams[pid] 212 | print -rn -- $self 213 | print -rn -- $configs 214 | print -rn -- $minimal 215 | trap 'exit 0' TERM PIPE 216 | while true; do 217 | zselect -t 360000 || true 218 | print 2>/dev/null || exit 0 219 | done 220 | } | { 221 | exec {tty}<&- 222 | local pid 223 | IFS= read -r pid 224 | print -r -- $pid 225 | docker-run ${(j: && :)setup} 226 | } | { 227 | local pid 228 | IFS= read -r pid 229 | { 230 | local cpuset 231 | IFS= read -r cpuset 232 | exec 0<&$tty {tty}<&- 233 | if [[ $cpuset != /docker/[[:xdigit:]]## ]]; then 234 | print -ru2 -- "${ZSH_SCRIPT:t}: unexpected content of /proc/1/cpuset in the docker container" 235 | return 1 236 | fi 237 | local ret 238 | command docker exec -e TERM -e COLORTERM -e LC_ALL=C.UTF-8 -it -- \ 239 | ${cpuset:t} sh -c ${(j: :)login} || ret=$? 240 | return ret 241 | } always { 242 | kill -- $pid 2>/dev/null || true 243 | } 244 | } 245 | 246 | } "$@" 247 | --------------------------------------------------------------------------------