Home

Awesome

zpwr: World's Most Advanced UNIX Terminal Environment

tmux final

Master Build Status Dev Build Status Version GitHub tag Commits GitHub commits Contributors All Contributors

This project started out as my own version of Hashrocket's Dotmatrix repo and it then grew.

It is an extremely powerful custom terminal environment built on top of zinit.

There is a significant amount of custom zsh, bash, vimL and perl code that I wrote to support very advanced functionality that I desired.

Contents

Full Installation Instructions to ~/.zpwr

sh -c "$(curl -fsSL raw.githubusercontent.com/MenkeTechnologies/zpwr/master/install/s)"

OR

git clone --depth 1 -- https://github.com/MenkeTechnologies/zpwr.git ~/.zpwr && cd ~/.zpwr/install && ./zpwrInstall.sh

The installer will confirm what will be installed and overwritten before executing.

Zinit will install plugins on first zsh after install.

Full Installation Instructions to $ZPWR

To install to a custom directory, clone the project to custom directory and start the installer. ZPWR will pick up its location and export ZPWR to that directory. This also means you can move ZPWR after install after updating the sym links that are in $HOME. First export ZPWR_INSTALL=<mydirectory>/install in current shell. Replace <mydirectory> with your new install dir and keep /install in the export. Then run zpwr regenconfiglinks in same shell to create new sym links pointing to your new directory <mydirectory>. Then exec a new zsh with exec zsh and all environment variables will be set accordingly.

Installation Options to ~/.zpwr/install/zpwrInstall.sh

    Options:
        -a  Install all dependencies
        -c  Copy just configs
        -n  Do not start tmux at end of installer
        -s  Skip main section
        -h  Display this message
        -V  Display script version

ZPWR Features

ZPWR Dependencies

Supported Operating Systems:

ZPWR Extras Not Installed

Limited Install

git clone --depth 1 -- https://github.com/MenkeTechnologies/zpwr.git ~/.zpwr && cd ~/.zpwr/install && ./zpwrInstall.sh -c

This will install just config files not dependencies.

You can then run each install shell script in ~/.zpwr/install manually to install just vim plugins or cargo packages etc.

Install Destination

All zpwr custom configs will be installed to ~/.zpwr by default. This is the ZPWR environment variable. ~/.zshrc, ~/.vimrc, ~/.tmux.conf and other config files are sym linked into home dir to be read by the respective program. Your old configs for these files will be found in a directory name approximately ~/.zpwr/local/username.rc.bak.date after install. Exact directory name is generated as shown.

backupdir="$ZPWR_HIDDEN_DIR/$USER.rc.bak.$(date +'%m.%d.%Y')"

Installer artifacts such as log files and cloned repos go into ~/.zpwr/local/installer.

Uninstall

Run zpwr uninstall. This will ask for confirmation before moving backups dirs to $HOME, unlinking all configs from $HOME and deleting all config dirs.

OR

  1. Run zpwr rmconfiglinks (zpwrUnlinkConf) to unlink all zpwr config symlinks.
  2. Copy all configs from backup dir mentioned above to home directory most importantly the .zshrc, .vimrc and .tmux.conf.
  3. Remove the zpwr dir as shown.
rm -rf ~/.zpwr

This will not uninstall packages installed by system package manager, pip modules, gems, vim plugins, tmux plugins and zsh plugins. You must remove these manually if desired. If desired you can also uninstall zinit with rm -rf ~/.zinit. Make sure ~/.zshrc and other config files in $HOME are original versions.

Font

You need to change the Terminal font to display the Powerline triangles and other special characters in the Powerlevel10k $PROMPT.

The installer installs Hack Nerd Font on the Mac with Homebrew and Powerline Symbols on Linux. Consult your terminal emulator documentation for details on how to change the font.

Updating

zpwr updateall (zua) links all zpwr config files, updates zpwr and zsh plugins, regens all caches and updates all dependencies.

zpwr update and zpwrLinkConf functions

There is a shell function called zpwr update that will update ZPWR by pulling the latest changes from this repository into ~/.zpwr, links all zpwr config files and updates all zsh plugins. It invokes zpwr regenconfiglinks (zpwrLinkConf) which sym links ~/.zshrc, ~/.vimrc and ~/.tmux.conf and some other miscellaneous configuration files into $HOME.

Tmux prefix

The default tmux prefix key is C-a (control-a) on macOS so one can control inner tmux sessions (inside tmux session login to another computer and attach to its tmux session) on Linux/UNIX (prefix is C-b) separately. To invoke C-a in the shell press C-a twice or to invoke C-b press C-b twice. The left most segment of the tmux powerline status bar will be highlighted when the prefix is pressed and dehighlight when prefix is deactivated. You change the prefixes in ~/.zpwr/local/.tokens.sh with these environment variables.

# the tmux prefix on mac
export ZPWR_TMUX_PREFIX_MAC='C-a'
# the tmux prefix on linux
export ZPWR_TMUX_PREFIX_LINUX='C-b'

Autosaving Vim Plugins

One of the vim plugin is vim-autosave which autosaves all edits thus making :w unnecessary. :u 0 in vim command(colon) mode will reset all changes in buffer which will then be autosaved.

Auto List Completions

zpwr startauto [delay] will start automatically listing completion choices. zpwr stopauto will disable this. ZPWR_AUTO_COMPLETE will turn this on permanently with ZPWR_AUTO_COMPLETE_DELAY as delay time.

# list completion choices automatically
export ZPWR_AUTO_COMPLETE=false
# delay before listing completion choices automatically
export ZPWR_AUTO_COMPLETE_DELAY=3.0

Bypassing expansion on space

C-Space (Control-Space or actually the ^@ terminal escape code) will bypass all expansion of globbing, aliases and words. Expansion can be disabled entirely by adding zinit unload MenkeTechnologies/zsh-expand &>/dev/null to ~/.zpwr/local/.tokens-post.sh or removing zsh-expand from ZPWR_GH_PLUGINS array in ~/.zpwr/local/.tokens.sh.

~/.zpwr/local/.tokens-post.sh

zinit unload MenkeTechnologies/zsh-expand &>/dev/null

OR

~/.zpwr/local/.tokens.sh

ZPWR_GH_PLUGINS[$ZPWR_GH_PLUGINS[(i)MenkeTechnologies/zsh-expand]]=()

Alternatively, change these env vars to false in ~/.zpwr/local/.tokens.sh. The first turn off expansion in any position. The second variable turns off expansion in second position. For example with sudo/zpwr/env in the first position and the alias to expand in the second position on the command line. The third turn offs glob/history/param etc expansion in any position. The fourth turns off spelling correction in any position.

~/.zpwr/local/.tokens.sh

# disable all expansion
export ZPWR_EXPAND=false
# aliases expand in second position after sudo
export ZPWR_EXPAND_SECOND_POSITION=false
# expand globs, history etc with zle expand-word
export ZPWR_EXPAND_NATIVE=false
# spelling correction in zsh-expand plugin
export ZPWR_CORRECT=false
# expand inside "
export ZPWR_EXPAND_QUOTE_DOUBLE=true
# expand inside '
export ZPWR_EXPAND_QUOTE_SINGLE=false

Turning off ponies (default is off) and colors globally

To turn off all ponysay ponies, colored groups and colored group descriptions, add to tokens file.

~/.zpwr/local/.tokens.sh

# ponysay banner when shell startup finishes
export ZPWR_BANNER_TYPE=noponies
# output is more colorful
export ZPWR_COLORS=false
# colored section headers
export ZPWR_COLORS_SECTIONS=false

Running script from vim in tmux right pane is supported for these languages

~/.vimrc

    let supportedTypes=['sh','zsh', 'cr','py','rb','pl', 'clj', 'tcl', 'vim', 'lisp', 'hs', 'ml', 'coffee', 'swift', 'lua', 'java', 'f90']

File ending of currently edited file in vim determines the interpreter used by the bash script $ZPWR_SCRIPTS/runner.sh which defaults to ~/.zpwr/scripts/runner.sh

Tmux Main Window

The main window show in the screenshots is started by prefix-D (tmux prefix definition mentioned above) in an empty tmux window. This sources a tmux script ~/.zpwr/tmux/control-window.conf. Alternatively you could invoke the script by prefix-: source-file ~/.zpwr/tmux/control-window.conf or in the terminal with tmux source-file ~/.zpwr/tmux/control-window.conf in an empty tmux pane.

Personal Config

Startup shell files will source ~/.zpwr/local/.tokens.sh before zsh config and zinit startup so you can put your additional code there. This file will not be overridden with the zpwr update shell function. You can override installer variables in this file before install. Because this file is sourced by bash installer and zsh startup you should check if the shell is zsh before any zsh only features like zpwrIsZsh && myZshConfig. Startup shell files will source ~/.zpwr/local/.tokens-post.sh after all zsh config and zinit startup.

To use a different .vimrc and/or tmux.conf, set these environment variables to absolute path of custom configs and then zpwr regenconfiglinks.

~/.zpwr/local/.tokens.sh

# user tmux.conf file
export ZPWR_TMUXRC="$HOME/.tmux.conf"
# user vimrc file
export ZPWR_VIMRC="$HOME/.vimrc"

Running zpwr regen will regenerate all cache files in ~/.zpwr/local and create a ctags file named ~/tags in your home directory. YCM (vim code completion engine) will source this file (autocmd filetype * set tags+=~/tags includes ~/tags), while providing completion so ZPWR env vars vim code completion in ~/.zpwr/local/.tokens.sh should work. Inside vim <Space>] will jump to definition of the tag in the preview window.

zpwr verbs

Typing zpwr <tab> will invoked zsh menucompletion for zpwr verbs/subcommands. These subcommands invoke other shell functions passing all args. zpwr verbs will list them all in fzf and then execute selected verbs (fzf multiselection is enabled). zpwr verbsedit puts selected verbs onto command line for editing.

ZPWR_GITHUB_ACCOUNT variable

Change in ~/.zpwr/local/.tokens.sh

export ZPWR_GITHUB_ACCOUNT='MenkeTechnologies'

to match your GitHub account name to enable various functionality with your account like zpwr github, zpwr githubcreate and zpwr githubdelete shell functions for opening your GitHub home page, creating and deleting GitHub repos from the command line respectively.

Adding more Zinit plugins

Add in ~/.zpwr/local/.tokens-post.sh your extra plugins like such

zinit ice lucid nocompile wait'0a'
zinit load \
hlissner/zsh-autopair

Environment Variables

These are environment variables set in ~/.zpwr/env/.zpwr_env.sh and ~/.zpwr/env/.zpwr_re_env.sh which you can override in your ~/.zpwr/local/.tokens.sh to customize the behavior of the terminal setup. The file ~/.zpwr/env/.zpwr_re_env.sh is reread after user tokens file to update environment variables that depend on previous variables that could change in user token file.

# Global Environment Variables for ZPWR by MenkeTechnologies
# More Environment Variables in ~/.zpwr/env/.shell_aliases_functions.sh near top of file
# override in ~/.zpwr/local/.tokens.sh, ~/.zpwr/local is git ignored
# see README.md
# linux OS SSH auto attach to tmux sessions
export ZPWR_AUTO_ATTACH=true
# list completion choices automatically
export ZPWR_AUTO_COMPLETE=false
# delay before listing completion choices automatically
export ZPWR_AUTO_COMPLETE_DELAY=3.0
# run ls after rm and other modifying commands such as touch automatically
export ZPWR_AUTO_LS_RM=true
# run ls after cd automatically
export ZPWR_AUTO_LS_CD=true
# auto select first item of menuselect
export ZPWR_AUTO_SELECT=true
# clear and ls before and after banner
export ZPWR_BANNER_CLEARLIST=true
# cd to Desktop after banner Darwin
export ZPWR_BANNER_DESKTOP_DARWIN=false
# cd to Desktop after banner Linux
export ZPWR_BANNER_DESKTOP_LINUX=true
# ponysay banner when shell startup finishes
export ZPWR_BANNER_TYPE=ponies
# bat (syntax highlighting) theme
export ZPWR_BAT_THEME='GitHub'
# this the description separator in compsys option completions (ls -<tab>)
# and the separator for function se() between row number and learning
export ZPWR_CHAR_LOGO='<<)(>>'
# group description leading chars
export ZPWR_DESC_PRE='-<<'
# group description trailing chars
export ZPWR_DESC_POST='>>-'
# group description text color ANSI codes
export ZPWR_DESC_TEXT_COLOR='34'
# group description leading chars color ANSI codes
export ZPWR_DESC_PRE_COLOR='1;31'
# group description trailing chars color ANSI codes
export ZPWR_DESC_POST_COLOR='1;31'
# output is more colorful
export ZPWR_COLORS=true
# colored section headers
export ZPWR_COLORS_SECTIONS=true
# zpwr <tab> is more colorful
export ZPWR_COLORS_VERBS=true
# common colors ANSI codes
export ZPWR_COLOR_BLUE="\x1b[37;44m"
export ZPWR_COLOR_RED="\x1b[31m"
export ZPWR_COLOR_RESET="\x1b[0m"
# ANSI styling codes for git commits
export ZPWR_COMMIT_STYLE='1;37;45'
# named compsys colors zsh pattern and ANSI codes
export ZPWR_NAMED_COLORS='=(#b)(*)=1;37;46'
# file prefix compsys colors
export ZPWR_COMMON_ZSTYLE_OPTS='reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)(*)==37;45=37;43=34}:${(s.:.)LS_COLORS}")'
# sudo prefix to add when you get permission denied
export ZPWR_SUDO_CMD='sudo -E'
# sudo for aliases and expansion
export ZPWR_FULL_SUDO='"builtin" "command" "sudo" -E "env" PATH="$PATH"'
# the repo name for more zsh compsys completions
export ZPWR_COMPLETION_DIR='zsh-more-completions'
# spelling correction in zsh-expand plugin
export ZPWR_CORRECT=true
# aliases expand after spelling correction
export ZPWR_CORRECT_EXPAND=true
# turns on debugging logs using zpwrLogDebug function
export ZPWR_DEBUG=false
# default OMZ theme if Powerlevel 10k not used
export ZPWR_DEFAULT_OMZ_THEME=simonoff
# for alternating pretty printer
export ZPWR_DELIMITER_CHAR='%'
# the default vim command, override in tokens file
export ZPWR_VIM='nvim'
# set EDITOR to $ZPWR_VIM command
export ZPWR_EDITOR_TO_VIM='true'
# the emacs command
export ZPWR_EMACS='command emacs -nw'
# the emacs client command
export ZPWR_EMACS_CLIENT='emacsclient -c -nw -a ""'
# exa command invoked from zpwrClearList shows extended attributes
export ZPWR_EXA_EXTENDED=true
# enable all expansion
export ZPWR_EXPAND=true
# aliases expand in second position after sudo
export ZPWR_EXPAND_SECOND_POSITION=true
# expand globs, history etc with zle expand-word
export ZPWR_EXPAND_NATIVE=true
# aliases expand before command line is accepted
export ZPWR_EXPAND_PRE_EXEC=true
# globs etc expand before command line is accepted
export ZPWR_EXPAND_PRE_EXEC_NATIVE=false
# second pos expand before command line is accepted
export ZPWR_EXPAND_PRE_EXEC_SECOND_POSITION=true
# expand inside "
export ZPWR_EXPAND_QUOTE_DOUBLE=true
# expand inside '
export ZPWR_EXPAND_QUOTE_SINGLE=false
# command for fd
export ZPWR_FD='command fd --follow --type file --threads 8'
# command for all fzf
export ZPWR_FZF='fzf --ansi'
# prompt for all fzf
export ZPWR_FZF_LOGO='<<)ZPWR(>>'
# GH username
export ZPWR_GITHUB_ACCOUNT='MenkeTechnologies'
# the char that prefixes global aliases like je<space>
export ZPWR_GLOBAL_ALIAS_PREFIX=j
# whether to search interactively in menuselect
export ZPWR_INTERACTIVE_MENU_SELECT=true
# timeout for keybindings
export ZPWR_KEYTIMEOUT=10
# whether to include all the zpwr learning functions
export ZPWR_LEARN=true
# zpwrLogColor function underscore color ANSI codes
export ZPWR_LOG_UNDER_COLOR='\x1b[0;34m'
# zpwrLogColor function quote color
export ZPWR_LOG_QUOTE_COLOR='\x1b[0;35m'
# zpwrLogColor function timestamp color
export ZPWR_LOG_DATE_COLOR='\x1b[0;32;44m'
# zpwrLogColor function message color
export ZPWR_LOG_MSG_COLOR='\x1b[0;37;45m'
# when true vim normal mode C-V mapped to exec current file in right tmux pane
export ZPWR_MAP_C_V_VIM_NORMAL=false
# the marker found color in bat output into fzf from ag search ANSI codes
export ZPWR_MARKER_COLOR='0;1;4;37;44m'
# default value for pygmentize theme
export ZPWR_PYGMENTIZE_COLOR="emacs"
# zpwr colorizer = bat or pygmentize
export ZPWR_COLORIZER=bat
# zsh options set in precmd fn before prompt
export ZPWR_OPTS=
# the OS of the host
export ZPWR_OS_TYPE="$(uname -s | tr A-Z a-z)"
# plugin framework
export ZPWR_PLUGIN_MANAGER=zinit
# global python version
export ZPWR_PYTHON='python3.10'
# uses the zprof function to profile startup
export ZPWR_PROFILING=false
# set to POWERLEVEL to use the powerlevel10k prompt
export ZPWR_PROMPT=powerlevel10k
# pssh timeout
export ZPWR_PSSH_TIMEOUT=0
# git colored output cmd prefix
export ZPWR_GIT_COLOR_PREFIX="git -c color.status=always -c color.ui=always --no-pager"
# char to separate log messages
export ZPWR_QUOTE_START_CHAR='<<('
# char to separate log messages
export ZPWR_QUOTE_END_CHAR=')>>'
# maybe z4ze
export ZPWR_REPO_NAME='zpwr'
# when true sends every char to synced panes
# when false does not send enter and Control to synced panes
export ZPWR_SEND_KEYS_FULL=false
# how long to sleep after display of counts in zpwr display of all
export ZPWR_LOOK_TIME=5
# set to comma separated list of pane numbers
# to activate sending to numbered tmux panes
export ZPWR_SEND_KEYS_PANE=-1
# typing leading quote, paren, bracket inserts trailing after caret
export ZPWR_SURROUND=true
# the string that marks a tabstop when expanding aliases
export ZPWR_TABSTOP=__________
# include tabstop aliases
export ZPWR_TABSTOP_ALIASES=true
# the tmux prefix on mac
export ZPWR_TMUX_PREFIX_MAC='C-a'
# the tmux prefix on linux
export ZPWR_TMUX_PREFIX_LINUX='C-b'
# the tmux copy mode history limit
export ZPWR_TMUX_HISTORY_LIMIT=30000
# turns on set -x in critical regions
export ZPWR_TRACE=false
# add header template to certain filetypes in vim
export ZPWR_VIM_TEMPLATES=true
# use bindkey -v
export ZPWR_BINDKEY_VI=true
# delay between shell start and compinit
export ZPWR_ZINIT_COMPINIT_DELAY=0
# username for zdharma
export ZPWR_ZDHARMA="zdharma-continuum"
# regex for tmux thumbs
export ZPWR_THUMBS_REGEX='^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
((?:[a-z0-9]+(?:-[a-z0-9]+)*\.)+[a-z]{2,})(?::.*)?'
# store tty for faster prompt
export ZPWR_TTY=$(tty)
if [[ $ZPWR_PLUGIN_MANAGER == zinit ]]; then
    zpwrEvalIfNeeded ZPWR_PLUGIN_MANAGER_HOME "$ZPWR_PLUGIN_MANAGER_HOME" "$HOME/.zinit" "$HOME"
    export ZSH="$ZPWR_PLUGIN_MANAGER_HOME"
    zpwrEvalIfNeeded ZSH_CUSTOM "$ZSH_CUSTOM" "$ZSH" "$ZSH"
elif [[ $ZPWR_PLUGIN_MANAGER == oh-my-zsh ]]; then
    zpwrEvalIfNeeded ZPWR_PLUGIN_MANAGER_HOME "$ZPWR_PLUGIN_MANAGER_HOME" "$HOME/.oh-my-zsh" "$HOME"
    export ZSH="$ZPWR_PLUGIN_MANAGER_HOME"
    zpwrEvalIfNeeded ZSH_CUSTOM "$ZSH_CUSTOM" "$ZSH/custom" "$ZSH"
fi

# fzf dir
zpwrEvalIfNeeded ZPWR_FZF_DIR "$ZPWR_FZF_DIR" "$ZSH_CUSTOM/plugins/fzf" "$ZSH"
# local file ignored by git
zpwrEvalIfNeeded ZPWR_LOCAL "$ZPWR_LOCAL" "$ZPWR/local" "$ZPWR"
# plugin misc cache files
zpwrEvalIfNeeded ZSH_CACHE_DIR "$ZSH_CACHE_DIR" "$ZPWR_LOCAL/.cache" "$ZPWR_LOCAL"
# alias and function file bash compatible
zpwrEvalIfNeeded ZPWR_ALIAS_FILE "$ZPWR_ALIAS_FILE" "$ZPWR_ENV/.shell_aliases_functions.sh" "$ZPWR_ENV"
# autoloaded non completion functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD "$ZPWR_AUTOLOAD" "$ZPWR/autoload" "$ZPWR"
# autoloaded common non completion functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_COMMON "$ZPWR_AUTOLOAD_COMMON" "$ZPWR_AUTOLOAD/common" "$ZPWR_AUTOLOAD"
# autoloaded common completion but completion helper functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_COMPS "$ZPWR_AUTOLOAD_COMPS " "$ZPWR_AUTOLOAD/comps" "$ZPWR_AUTOLOAD"
# autoloaded common non completion but completion helper functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_COMP_UTILS "$ZPWR_AUTOLOAD_COMP_UTILS " "$ZPWR_AUTOLOAD/comp_utils" "$ZPWR_AUTOLOAD"
# autoloaded darwin non completion functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_DARWIN "$ZPWR_AUTOLOAD_DARWIN" "$ZPWR_AUTOLOAD/darwin" "$ZPWR_AUTOLOAD"
# autoloaded fzf helper functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_FZF "$ZPWR_AUTOLOAD_FZF" "$ZPWR_AUTOLOAD/fzf" "$ZPWR_AUTOLOAD"
# autoloaded linux non completion functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_LINUX "$ZPWR_AUTOLOAD_LINUX" "$ZPWR_AUTOLOAD/linux" "$ZPWR_AUTOLOAD"
# autoloaded systemctl non completion functions
zpwrEvalIfNeeded ZPWR_AUTOLOAD_SYSTEMCTL "$ZPWR_AUTOLOAD_SYSTEMTCTL" "$ZPWR_AUTOLOAD/systemctl" "$ZPWR_AUTOLOAD"
# autoloaded completion functions
zpwrEvalIfNeeded ZPWR_COMPS "$ZPWR_COMPS" "$ZPWR/autoload/comps" "$ZPWR"
# cross OS comand file
zpwrEvalIfNeeded ZPWR_CROSS_OS_CMD "$ZPWR_CROSS_OS" "$ZPWR_SCRIPTS/crossOSCommands.sh" "$ZPWR_SCRIPTS"
# cross OS fn file
zpwrEvalIfNeeded ZPWR_CROSS_OS_EXE "$ZPWR_CROSS_OS" "$ZPWR_SCRIPTS/crossOSExecute.sh" "$ZPWR_SCRIPTS"
# the location of macOS only associated interpreted scripts
# custom plugin dir
zpwrEvalIfNeeded ZPWR_PLUGIN_DIR "$ZPWR_PLUGIN_DIR" "$ZSH_CUSTOM/plugins" "$ZSH_CUSTOM"
# fzf custom plugin dir
zpwrEvalIfNeeded ZPWR_ZINIT_FZF "$ZPWR_ZINIT_FZF" "$ZPWR_PLUGIN_DIR/MenkeTechnologies---fzf" "$ZPWR_PLUGIN_DIR"
# same as zpwr local
zpwrEvalIfNeeded ZPWR_HIDDEN_DIR "$ZPWR_HIDDEN_DIR" "$ZPWR/local" "$ZPWR"
# private tokens file sourced before
zpwrEvalIfNeeded ZPWR_TOKEN_PRE "$ZPWR_TOKEN_PRE" "$ZPWR_LOCAL/.tokens.sh" "$ZPWR_LOCAL"
# private tokens file sourced after
zpwrEvalIfNeeded ZPWR_TOKEN_POST "$ZPWR_TOKEN_POST" "$ZPWR_LOCAL/.tokens-post.sh" "$ZPWR_LOCAL"
zpwrEvalIfNeeded ZPWR_TEST "$ZPWR_TEST" "$ZPWR/tests" "$ZPWR"
# zpwr install files
zpwrEvalIfNeeded ZPWR_INSTALL "$ZPWR_INSTALL" "$ZPWR/install" "$ZPWR"
# user tmux.conf file
zpwrEvalIfNeeded ZPWR_TMUXRC "$ZPWR_TMUXRC" "$ZPWR_INSTALL/.tmux.conf" "$ZPWR_INSTALL"
# user vimrc file
zpwrEvalIfNeeded ZPWR_VIMRC "$ZPWR_VIMRC" "$ZPWR_INSTALL/.vimrc" "$ZPWR_INSTALL"
# user ideavimrc file
zpwrEvalIfNeeded ZPWR_IDEAVIMRC "$ZPWR_IDEAVIMRC" "$ZPWR_INSTALL/.ideavimrc" "$ZPWR_INSTALL"
# zpwr tmux config files
zpwrEvalIfNeeded ZPWR_TMUX "$ZPWR_TMUX" "$ZPWR/tmux" "$ZPWR"
# zpwr tmux git ignored files
zpwrEvalIfNeeded ZPWR_TMUX_LOCAL "$ZPWR_TMUX_LOCAL" "$ZPWR_TMUX/local" "$ZPWR_TMUX"
# the base path for zsh temp
zpwrEvalIfNeeded TMPPREFIX "$TMPPREFIX" "$ZPWR_LOCAL/.temp/zsh" "$ZPWR_LOCAL"
# the base dir for zpwr temp
zpwrEvalIfNeeded ZPWR_LOCAL_TEMP "$ZPWR_LOCAL_TEMP" "$ZPWR_LOCAL/.temp" "$ZPWR_LOCAL"
# the path to a lock file (semaphore) for zpwr
zpwrEvalIfNeeded ZPWR_LOCK_FILE "$ZPWR_LOCK_FILE" "$ZPWR_LOCAL/.lock" "$ZPWR_LOCAL"
# cache file for all zpwr env lookups
zpwrEvalIfNeeded ZPWR_LOCAL_ENV "$ZPWR_LOCAL_ENV" "$ZPWR_LOCAL/zpwrEnv" "$ZPWR_LOCAL"
# forked powerlevel10k config file for PROMPT
zpwrEvalIfNeeded ZPWR_PROMPT_FILE "$ZPWR_PROMPT_FILE" "$ZPWR_ENV/.p10k.zsh" "$ZPWR_ENV"
# the location of associated interpreted scripts
zpwrEvalIfNeeded ZPWR_SCRIPTS "$ZPWR_SCRIPTS" "$ZPWR/scripts" "$ZPWR"
# the location of macOS only associated interpreted scripts
zpwrEvalIfNeeded ZPWR_SCRIPTS_MAC "$ZPWR_SCRIPTS_MAC" "$ZPWR_SCRIPTS/macOnly" "$ZPWR_SCRIPTS"
# the location of zpwr verbs setup script
zpwrEvalIfNeeded ZPWR_VERBS_FILE "$ZPWR_VERBS_FILE" "$ZPWR_SCRIPTS/zpwr.zsh" "$ZPWR_SCRIPTS"
# the location of zpwr lib file
zpwrEvalIfNeeded ZPWR_LIB "$ZPWR_LIB" "$ZPWR_SCRIPTS/lib.sh" "$ZPWR_SCRIPTS"
# the location of zpwr init file
zpwrEvalIfNeeded ZPWR_LIB_INIT "$ZPWR_LIB_INIT" "$ZPWR_SCRIPTS/init.sh" "$ZPWR_SCRIPTS"
# command for all fzf clearlist in preview pane
zpwrEvalIfNeeded ZPWR_FZF_CLEARLIST "$ZPWR_FZF_CLEARLIST" "zsh $ZPWR_SCRIPTS/zpwrClearList.zsh -- \\\$file | fold -s -w 80" "$ZPWR_SCRIPTS"
# the file used to find most recent files opened in neovim
zpwrEvalIfNeeded ZPWR_NVIMINFO "$ZPWR_NVIMINFO" "$ZPWR_LOCAL/.nviminfo" "$ZPWR_LOCAL"
# emacs recent files
zpwrEvalIfNeeded ZPWR_RECENTF "$ZPWR_RECENTF" "$HOME/.emacs.d/.cache/recentf" "$HOME"
# alternate banner to ponysay
zpwrEvalIfNeeded ZPWR_BANNER_COMMAND "$ZPWR_BANNER_COMMAND" "bash $ZPWR_SCRIPTS_MAC/figletRandomFontOnce.sh $(hostname)" "$ZPWR_SCRIPTS_MAC"
# zpwr banner file location
zpwrEvalIfNeeded ZPWR_BANNER_SCRIPT "$ZPWR_BANNER_SCRIPT" "$ZPWR_SCRIPTS/about.sh" "$ZPWR_SCRIPTS"
# cache of git dirs
zpwrEvalIfNeeded ZPWR_ALL_GIT_DIRS "$ZPWR_ALL_GIT_DIRS" "$ZPWR_LOCAL/zpwrGitDirs.txt" "$ZPWR_LOCAL"
# cache of clean git dirs
zpwrEvalIfNeeded ZPWR_ALL_GIT_DIRS_CLEAN "$ZPWR_ALL_GIT_DIRS_CLEAN" "$ZPWR_LOCAL/zpwrGitDirsClean.txt" "$ZPWR_LOCAL"
# cache of dirty git dirs
zpwrEvalIfNeeded ZPWR_ALL_GIT_DIRS_DIRTY "$ZPWR_ALL_GIT_DIRS_DIRTY" "$ZPWR_LOCAL/zpwrGitDirsDirty.txt" "$ZPWR_LOCAL"
# log file
zpwrEvalIfNeeded ZPWR_LOGFILE "$ZPWR_LOGFILE" "$ZPWR_LOCAL/zpwrLog.txt" "$ZPWR_LOCAL"
# cache of env keys
zpwrEvalIfNeeded ZPWR_ENV_KEY_FILE "$ZPWR_ENV_KEY_FILE" "${ZPWR_LOCAL_ENV}Key.txt" "$ZPWR_LOCAL_ENV"
# cache of env values
zpwrEvalIfNeeded ZPWR_ENV_VALUE_FILE "$ZPWR_ENV_VALUE_FILE" "${ZPWR_LOCAL_ENV}Value.txt" "$ZPWR_LOCAL_ENV"
# temp files
zpwrEvalIfNeeded ZPWR_TEMPFILE "$ZPWR_TEMPFILE" "$ZPWR_LOCAL_TEMP/.temp$$-$USER" "$ZPWR_LOCAL_TEMP" "$USER"
zpwrEvalIfNeeded ZPWR_TEMPFILE1 "$ZPWR_TEMPFILE1" "$ZPWR_LOCAL_TEMP/.temp$$-1$USER" "$ZPWR_LOCAL_TEMP" "$USER"
zpwrEvalIfNeeded ZPWR_TEMPFILE2 "$ZPWR_TEMPFILE2" "$ZPWR_LOCAL_TEMP/.temp$$-2$USER" "$ZPWR_LOCAL_TEMP" "$USER"
zpwrEvalIfNeeded ZPWR_TEMPFILE3 "$ZPWR_TEMPFILE3" "$ZPWR_LOCAL_TEMP/.temp$$-3$USER" "$ZPWR_LOCAL_TEMP" "$USER"
zpwrEvalIfNeeded ZPWR_TEMPFILE4 "$ZPWR_TEMPFILE4" "$ZPWR_LOCAL_TEMP/.temp$$-4$USER" "$ZPWR_LOCAL_TEMP" "$USER"
zpwrEvalIfNeeded ZPWR_TEMPFILE_PROCESSED "$ZPWR_TEMPFILE_PROCESSED" "$ZPWR_LOCAL_TEMP/.temp$$-processed$USER" "$ZPWR_LOCAL_TEMP" "$USER"
# SQL temp files for use with learning collection
zpwrEvalIfNeeded ZPWR_TEMPFILE_SQL "$ZPWR_TEMPFILE_SQL" "$ZPWR_LOCAL_TEMP/.temp$$-2$USER.sql" "$ZPWR_LOCAL_TEMP" "$USER"
# last tmux window text capture
zpwrEvalIfNeeded ZPWR_TMUX_CAPTURE "$ZPWR_TMUX_CAPTURE" "$ZPWR_TMUX_LOCAL/tmux-capture-$$-$USER" "$ZPWR_TMUX_LOCAL" "$USER"
# socket for IPC
zpwrEvalIfNeeded ZPWR_SOCKET "$ZPWR_SOCKET" "$ZPWR_LOCAL_TEMP/.temp-$USER-socket" "$ZPWR_LOCAL_TEMP" "$USER"
# fifo for IPC
zpwrEvalIfNeeded ZPWR_FIFO "$ZPWR_FIFO" "$ZPWR_LOCAL_TEMP/.temp-$USER-fifo" "$ZPWR_LOCAL_TEMP" "$USER"
# zsh compsys completion system dir for cached completions
zpwrEvalIfNeeded ZPWR_COMPSYS_CACHE "$ZPWR_COMPSYS_CACHE" "$ZPWR_LOCAL/zcompcache" "$ZPWR_LOCAL"
# compsys cache file
zpwrEvalIfNeeded ZSH_COMPDUMP "$ZSH_COMPDUMP" "$ZPWR_LOCAL/.zcompdump-$ZPWR_REPO_NAME-$ZPWR_GITHUB_ACCOUNT" "$ZPWR_LOCAL" "$ZPWR_REPO_NAME" "$ZPWR_GITHUB_ACCOUNT"
# forked repos dir
zpwrEvalIfNeeded ZPWR_FORKED_DIR "$ZPWR_FORKED_DIR" "$HOME/forkedRepos" "$HOME"
# common dirs
zpwrEvalIfNeeded ZPWR_D "$ZPWR_D" "$HOME/Desktop" "$HOME"
zpwrEvalIfNeeded ZPWR_DOC "$ZPWR_DOC" "$HOME/Documents" "$HOME"
zpwrEvalIfNeeded ZPWR_DL "$ZPWR_DL" "$HOME/Downloads" "$HOME"
# history file
zpwrEvalIfNeeded HISTFILE "$HISTFILE" "$ZPWR_LOCAL/.$ZPWR_REPO_NAME-$ZPWR_GITHUB_ACCOUNT-history" "$ZPWR_LOCAL" "$ZPWR_REPO_NAME" "$ZPWR_GITHUB_ACCOUNT"
# the path for vim keybindings cache
zpwrEvalIfNeeded ZPWR_VIM_KEYBINDINGS "$ZPWR_VIM_KEYBINDINGS" "$ZPWR_LOCAL/zpwrVimKeybindings.txt" "$ZPWR_LOCAL"
# the path for all keybindings cache
zpwrEvalIfNeeded ZPWR_ALL_KEYBINDINGS "$ZPWR_ALL_KEYBINDINGS" "$ZPWR_LOCAL/zpwrAllKeybindings.txt" "$ZPWR_LOCAL"
# build GitHub URL
zpwrEvalIfNeeded ZPWR_GITHUB_URL "$ZPWR_GITHUB_URL" "https://github.com/$ZPWR_GITHUB_ACCOUNT" "$ZPWR_GITHUB_ACCOUNT"

Tests

You can run zpwr unit tests via zpwr test and include plugin tests wth zpwr testall.

There is also the alias tru (tests run) to run the tests.

zpwrExists zunit && {
    alias tru="( builtin cd $ZPWR && zunit --verbose )"
}

Shell Startup speed

Running zpwr recompile will zrecompile all zpwr configs and all autoloaded functions and compsys completions in fpath. zpwr refreshzwc will remove old .zwc files before zrecompile. This will maximize startup and running speed. ~/.zpwr/autoload contains ZPWR autoloaded functions and ~/.zpwr/autoload/comps contains autoloaded compsys functions.

With Zinit Turbo mode, despite the number of plugins and completions, startup usually takes < 1 second on faster machines (.15 to .2 seconds on M1 Max) but up to 2-10 seconds on slow machines such as WSL. Zinit runs compinit in the background after startup and you will experience a brief lockup (unnoticeable if zpwr regenzsh and zpwr recompile have run to create .zcompdump.zwc). This variable controls the delay between prompt and compinit.

export ZPWR_ZINIT_COMPINIT_DELAY=0

Contributing

I am looking for contributors mostly for documentation, marketing, video tutorials, GIFs/screenshots in README and expanding the tests.

Warnings

Moving scripts from $ZPWR_SCRIPTS which defaults to ~/.zpwr/scripts and $ZPWR_TMUX which defaults to ~/.zpwr/tmux will break a lot of functionality because vim and tmux configurations depend on these scipts for advanced features. The only user modifiable files are the user token files.

Running on a MacbookPro

Alt text Alt text

Running on the Raspberry Pi 3

Alt text Alt text

Running on the Rock64

Final 5

Keybindings generated with source keybindingsToREADME.zsh >> README.md

Tmux keybindings (tmux lsk)

Zsh Vim Insert Mode keybindings (bindkey -M viins -L)

Zsh Vim Normal Mode keybindings (bindkey -M vicmd -L)

Zsh Menuselect Mode keybindings (bindkey -M menuselect -L)

Zsh Vim Visual Mode keybindings (bindkey -M visual -L)

Zsh Listscroll Mode keybindings (bindkey -M listscroll -L)

Zsh Vim Operator Mode keybindings (bindkey -M viopp -L)

Vim Keybindings Insert Mode

Vim Keybindings Normal Mode

Vim Keybindings Visual Mode

Vim Keybindings Command Colon Mode