diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:52:28 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:52:28 -0500 |
commit | 2dc486fb891e65658dff83ab34ca8878756a6a90 (patch) | |
tree | 03b39eb93f38534ab0972beadb770fecbd2243b8 | |
download | zsh-2dc486fb891e65658dff83ab34ca8878756a6a90.tar.xz zsh-2dc486fb891e65658dff83ab34ca8878756a6a90.zip |
initial commit
-rw-r--r-- | .gitignore | 1 | ||||
l--------- | .zshrc | 1 | ||||
-rwxr-xr-x | profiles/zprofile.libreX60 | 4 | ||||
-rwxr-xr-x | profiles/zprofile.voidx250 | 3 | ||||
-rw-r--r-- | zplugs | 1 | ||||
-rwxr-xr-x | zprofile | 55 | ||||
-rwxr-xr-x | zscripts/!rootcolors.zsh | 3 | ||||
-rwxr-xr-x | zscripts/.lfub.zsh | 27 | ||||
-rwxr-xr-x | zscripts/aliasrc.zsh | 64 | ||||
-rwxr-xr-x | zscripts/hosts/aliasrc.G3N2.zsh | 6 | ||||
l--------- | zscripts/hosts/aliasrc.T495.zsh | 1 | ||||
-rwxr-xr-x | zscripts/hosts/aliasrc.desktop.zsh | 12 | ||||
-rwxr-xr-x | zscripts/hosts/aliasrc.libreX60.zsh | 11 | ||||
-rwxr-xr-x | zscripts/hosts/aliasrc.voidx250.zsh | 8 | ||||
-rwxr-xr-x | zscripts/hosts/colors.desktop.zsh | 9 | ||||
-rwxr-xr-x | zscripts/hosts/colors.voidx250.zsh | 9 | ||||
-rwxr-xr-x | zscripts/keybindrc.zsh | 24 | ||||
-rwxr-xr-x | zscripts/nicegit.zsh | 31 | ||||
-rwxr-xr-x | zscripts/shortcuts.zsh | 12 | ||||
-rwxr-xr-x | zscripts/terminalname.zsh | 8 | ||||
-rwxr-xr-x | zscripts/termuxprompt.zsh | 8 | ||||
-rwxr-xr-x | zscripts/vicursor.zsh | 21 | ||||
-rwxr-xr-x | zscripts/zplug.zsh | 136 | ||||
-rwxr-xr-x | zscripts/zshcompmenu.zsh | 18 | ||||
-rwxr-xr-x | zshrc | 32 |
25 files changed, 505 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dea2d4f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.zcompdump @@ -0,0 +1 @@ +zshrc
\ No newline at end of file diff --git a/profiles/zprofile.libreX60 b/profiles/zprofile.libreX60 new file mode 100755 index 0000000..d4f4e9c --- /dev/null +++ b/profiles/zprofile.libreX60 @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +export WM="awesome" +export TERMINAL="st" diff --git a/profiles/zprofile.voidx250 b/profiles/zprofile.voidx250 new file mode 100755 index 0000000..61eb34e --- /dev/null +++ b/profiles/zprofile.voidx250 @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$XDG_DATA_DIRS" # .desktop files @@ -0,0 +1 @@ +https://github.com/zdharma-continuum/fast-syntax-highlighting diff --git a/zprofile b/zprofile new file mode 100755 index 0000000..f7b2549 --- /dev/null +++ b/zprofile @@ -0,0 +1,55 @@ +#!/usr/bin/env zsh + +# Default programs +export EDITOR='nvim' +export TERMINAL='alacritty' +export BROWSER='launch firefox' +export SUDO='doas' + +# Use sudo=${SUDO-sudo} +[ $EUID = 0 ] && export SUDO='' # When running as root, don't use sudo + +# Make programs follow the XDG base directory specification +export XDG_CACHE_HOME="$HOME/.cache" +export ANSIBLE_GALAXY_CACHE_DIR="${XDG_CACHE_HOME}/ansible/galaxy_cache" +export DOCKER_CONFIG="$XDG_CACHE_HOME/docker" +export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" + +export XDG_CONFIG_HOME="$HOME/.config" +export ANSIBLE_HOME="${XDG_CONFIG_HOME}/ansible" +export ANSIBLE_CONFIG="${XDG_CONFIG_HOME}/ansible/ansible.cfg" +export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" +export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config" +export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch/config" +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" +export X11CONFIG="$XDG_CONFIG_HOME/x11" # Used for X11 scripts +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" + +export XDG_DATA_HOME="$HOME/.local/share" +export CARGO_HOME="$XDG_DATA_HOME/cargo" +export GNUPGHOME="$XDG_DATA_HOME/gnupg" +export GRADLE_USER_HOME="$XDG_DATA_HOME/gradle" +export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store" +export PYTHONUSERBASE="$XDG_DATA_HOME/python" +export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=$XDG_DATA_HOME/java" + +export XDG_STATE_HOME="$HOME/.local/state" +export LESSHISTFILE='-' # Disable this, but it would be considered a state file +export ZHISTFILE="$XDG_STATE_HOME/zsh/zhistory" # Used to set HISTFILE in zshrc without exporting since HISTFILE is generic to most shells, and desired behavior is for zsh to have its own history file + +# Path +setopt nullglob # Set in case .local/bin doesn't exist +for lbin in "$HOME/.local/bin"{/,/*/}; do export PATH="${lbin%/}:$PATH"; done 2>/dev/null # Add ~/.local/bin and all sub dirs +export PATH="$HOME/.local/opt:$PATH" +export PATH="$CARGO_HOME/bin:$PATH" +export PATH="$PYTHONUSERBASE/bin:$PATH" + +# Theming +export QT_QPA_PLATFORMTHEME='gtk2' + +# Misc Zsh setup +mkdir -p "$(dirname "$ZHISTFILE")" +source "$ZDOTDIR/profiles/zprofile.$HOST" 2>/dev/null # Source additional host-specific profiles + +# Autostart X after login +[ -z $DISPLAY ] && [[ $UID != 0 ]] && [[ $TTY =~ /dev/tty(1|C0) ]] && startx "$X11CONFIG/xinitrc" diff --git a/zscripts/!rootcolors.zsh b/zscripts/!rootcolors.zsh new file mode 100755 index 0000000..d146aa5 --- /dev/null +++ b/zscripts/!rootcolors.zsh @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +[ $EUID = 0 ] && declare col{br,name,at,host,dir}=red && clear # Clear to get rid of last login message diff --git a/zscripts/.lfub.zsh b/zscripts/.lfub.zsh new file mode 100755 index 0000000..2e1f7f4 --- /dev/null +++ b/zscripts/.lfub.zsh @@ -0,0 +1,27 @@ +#!/bin/sh +# This is a wrapper script for lf that allows it to create image previews with +# ueberzug. This works in concert with the lf configuration file and the +# lf-cleaner script. + +cleanuplf() { + exec 3>&- + \rm "$FIFO_UEBERZUG" +} + +lfub() { + dircache=/tmp/$USER-lflastdir + lfopt="--last-dir-path=$dircache" + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + lf "$lfopt" "$@" + else + export FIFO_UEBERZUG="/tmp/ueberzug-$$" + mkfifo "$FIFO_UEBERZUG" + ueberzug layer -s <"$FIFO_UEBERZUG" -p json & + exec 3>"$FIFO_UEBERZUG" + trap cleanuplf HUP INT QUIT TERM PWR EXIT + lf "$lfopt" "$@" 3>&- + fi + [ -f "$dircache" ] && dir="$(cat "$dircache")" && [ -d "$dir" ] && cd "$dir" +} + +alias lf="lfub" diff --git a/zscripts/aliasrc.zsh b/zscripts/aliasrc.zsh new file mode 100755 index 0000000..f4e5035 --- /dev/null +++ b/zscripts/aliasrc.zsh @@ -0,0 +1,64 @@ +#!/usr/bin/env zsh + +# Replacement programs +typeset -A repaliases=( + #alias replacement + htop htim + mutt neomutt + vim nvim + sudo "${SUDO:- }" + neofetch fastfetch +) +for alias rep in ${(kv)repaliases}; do + command -v $rep >/dev/null && alias $alias=$rep +done # Tests if replacement exists before creating alias + + +# Shorten program names +alias \ + open="xdg-open" \ + smci="sudo make clean install" \ + smi="sudo make install" \ + su="sudo su -l" \ + +# Power scripts +alias \ + halt="launch shutdown" \ + off="launch shutdown" \ + reboot="launch reboot" \ + zzz="launch suspend" \ + +# Colorize command output +alias \ + bat="bat --theme='Monokai Extended'" \ + diff="diff --color=auto" \ + exa="exa --icons -a --group-directories-first" \ + grep="grep --color=auto -I --ignore-case --line-number" \ + ip="ip --color=auto" \ + ls="ls -vAhN --color=auto --group-directories-first" \ + +# (Non)-Verbosity +alias \ + cp="cp -iv" \ + dd="sudo dd status=progress bs=4M" + ffmpeg="ffmpeg -hide_banner" \ + ffprobe="ffprobe -hide_banner" \ + mkd="mkdir -p" \ + mv="mv -iv" \ + rm="rm -v" \ + +# Miscellaneous +alias \ + yt-dlp-album="yt-dlp -x -o '%(uploader)s (%(upload_date>%Y)s) - %(playlist_title)s%%%(playlist_index)s - %(title)s.%(ext)s'" \ + yt-dlp="yt-dlp -o '%(uploader)s - %(title)s.%(ext)s'" \ + +# Clean home directory +alias \ + mbsync="mbsync --config $MBSYNCRC" \ + startx="startx $X11CONFIG/xinitrc" \ + +# Copy-pasting from internet +alias \ + \$="" \ + \#="${SUDO-sudo}" \ + diff --git a/zscripts/hosts/aliasrc.G3N2.zsh b/zscripts/hosts/aliasrc.G3N2.zsh new file mode 100755 index 0000000..8e8d2a5 --- /dev/null +++ b/zscripts/hosts/aliasrc.G3N2.zsh @@ -0,0 +1,6 @@ +#!/bin/sh + +# Package Management +alias \ + e="sudo emerge" \ + diff --git a/zscripts/hosts/aliasrc.T495.zsh b/zscripts/hosts/aliasrc.T495.zsh new file mode 120000 index 0000000..6c84487 --- /dev/null +++ b/zscripts/hosts/aliasrc.T495.zsh @@ -0,0 +1 @@ +aliasrc.desktop.zsh
\ No newline at end of file diff --git a/zscripts/hosts/aliasrc.desktop.zsh b/zscripts/hosts/aliasrc.desktop.zsh new file mode 100755 index 0000000..141212f --- /dev/null +++ b/zscripts/hosts/aliasrc.desktop.zsh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Package Management +alias \ + d="sudo dnf" \ + dnf="sudo dnf" \ + +# Shorten program names +alias \ + systemctl="sudo systemctl" \ + sd="systemctl" \ + diff --git a/zscripts/hosts/aliasrc.libreX60.zsh b/zscripts/hosts/aliasrc.libreX60.zsh new file mode 100755 index 0000000..1180171 --- /dev/null +++ b/zscripts/hosts/aliasrc.libreX60.zsh @@ -0,0 +1,11 @@ +#!/bin/sh + +# Package Management +alias \ + apt="sudo apt" \ + +# Shorten program names +alias \ + systemctl="sudo systemctl" \ + sd="systemctl" \ + diff --git a/zscripts/hosts/aliasrc.voidx250.zsh b/zscripts/hosts/aliasrc.voidx250.zsh new file mode 100755 index 0000000..4bb85ea --- /dev/null +++ b/zscripts/hosts/aliasrc.voidx250.zsh @@ -0,0 +1,8 @@ +#!/bin/sh + +# Package Management +alias \ + xi="sudo xbps-install" \ + xq="xbps-query -R --search" \ + xr="sudo xbps-remove" \ + diff --git a/zscripts/hosts/colors.desktop.zsh b/zscripts/hosts/colors.desktop.zsh new file mode 100755 index 0000000..dee7ed3 --- /dev/null +++ b/zscripts/hosts/colors.desktop.zsh @@ -0,0 +1,9 @@ +#!/usr/bin/env zsh + +if [ -n "$DISPLAY" ]; then + declare col{br,at}=57 + declare col{name,host}=13 + coldir=129 +else + declare col{br,name,at,host,dir}=magenta +fi diff --git a/zscripts/hosts/colors.voidx250.zsh b/zscripts/hosts/colors.voidx250.zsh new file mode 100755 index 0000000..910f1f9 --- /dev/null +++ b/zscripts/hosts/colors.voidx250.zsh @@ -0,0 +1,9 @@ +#!/usr/bin/env zsh + +if [ -n "$DISPLAY" ]; then + declare col{br,at}=green + declare col{name,host}=76 + coldir=40 +else + declare col{br,name,at,host,dir}=green +fi diff --git a/zscripts/keybindrc.zsh b/zscripts/keybindrc.zsh new file mode 100755 index 0000000..2f2e664 --- /dev/null +++ b/zscripts/keybindrc.zsh @@ -0,0 +1,24 @@ +#!/usr/bin/env zsh + +# Vi mode + requirements for ALL keybindings to work correctly +bindkey -v # Select viins keymap +KEYTIMEOUT=1 + +# Keybindings +autoload edit-command-line; zle -N edit-command-line # Edit line in Vim buffer +bindkey '^E' edit-command-line # Ctrl-e - edit line in Vim buffer + +bindkey '^[[P' delete-char # Delete Key +bindkey '^[[F' end-of-line # End Key +bindkey '^[[H' beginning-of-line # Home Key +bindkey '^[[2~' overwrite-mode # Insert Key +bindkey '^D' kill-whole-line # Ctrl-d - delete line +bindkey '^X' clear-screen # Ctrl-x - clear screen +bindkey '^H' backward-delete-word # Ctrl-Backspace - delete entire word behind cursor +bindkey '^[[3;5~' delete-word # Ctrl-Delete - delete currect word in front of the cursor +# History completion +bindkey '\e[A' history-search-backward # Up arrow - seach history backwards +bindkey '\e[B' history-search-forward # Down arrow - seach history forwards + +# Ignore ctrl-d to exit shell +setopt IGNORE_EOF diff --git a/zscripts/nicegit.zsh b/zscripts/nicegit.zsh new file mode 100755 index 0000000..276d98e --- /dev/null +++ b/zscripts/nicegit.zsh @@ -0,0 +1,31 @@ +#!/usr/bin/env zsh + +alias \ + ga="git add" \ + gpl="git pull" \ + gph="git push" \ + gl="git log" \ + gldaily='git log --pretty="format:- %s" --after="00:00" --before="24:00"' \ + + +function gc() { + if ! __is_diff; then + echo "Nothing to commit, working tree clean" + return + fi + + if [[ "$@" != "" ]]; then + commit="$@" + else + echo "Enter commit message:" && read commit + fi + git commit -m "$commit" +} + +function __is_diff() { + ! git diff --quiet HEAD $REF -- $DIR +} + +function gdf() { + __is_diff && git diff HEAD $RED -- $DIR || echo "Repo is unchanged" +} diff --git a/zscripts/shortcuts.zsh b/zscripts/shortcuts.zsh new file mode 100755 index 0000000..214b7f7 --- /dev/null +++ b/zscripts/shortcuts.zsh @@ -0,0 +1,12 @@ +#!/usr/bin/env zsh + +# TODO make this script more comprehensive to allow real aliases for directories +# Quick navigate to directories / open specific files +alias \ + cdc="cd ~/docs/src/programs" \ + cds="cd ~/docs/src/scripts" \ + cdw="cd ~/docs/src/sites" \ + vrc="vim ~/.config/nvim/init.vim" \ + xrc="cd ~/.config/x11" \ + zrc="cd ~/.config/zsh" \ + diff --git a/zscripts/terminalname.zsh b/zscripts/terminalname.zsh new file mode 100755 index 0000000..6e55d22 --- /dev/null +++ b/zscripts/terminalname.zsh @@ -0,0 +1,8 @@ +function xtitle () { + builtin print -n -- "\e]0;$@\a" +} + +# Updates the window title whenever a command is run +function precmd () { + xtitle "$(print -P ${USER}@${HOST} %~)" +} diff --git a/zscripts/termuxprompt.zsh b/zscripts/termuxprompt.zsh new file mode 100755 index 0000000..1442cc8 --- /dev/null +++ b/zscripts/termuxprompt.zsh @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh + +if [ -n "$TERMUX_VERSION" ]; then + PS1="%B%F{green}[%F{blue}%U%~%u%F{green}]%f%b%(!.#.$) " + PS1OVERRIDE=1 + export ZPLUGINSDIR=~/.local/share/zsh/zplugins + export ZPLUGNOROOT=1 +fi diff --git a/zscripts/vicursor.zsh b/zscripts/vicursor.zsh new file mode 100755 index 0000000..3e4320d --- /dev/null +++ b/zscripts/vicursor.zsh @@ -0,0 +1,21 @@ +#!/usr/bin/env zsh + +# Change cursor shape for different vi modes +# Copied from LARBS +if [ -n "$DISPLAY" ]; then + function zle-keymap-select () { + case $KEYMAP in + vicmd) echo -n '\e[1 q';; # block + viins|main) echo -n '\e[5 q';; # beam + esac + } + zle -N zle-keymap-select + zle-line-init() { + #zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -n "\e[5 q" + } + zle -N zle-line-init + echo -n '\e[5 q' # Use beam shape cursor on startup + preexec() { echo -n '\e[5 q' ;} # Use beam shape cursor for each new prompt +fi + diff --git a/zscripts/zplug.zsh b/zscripts/zplug.zsh new file mode 100755 index 0000000..27dc70f --- /dev/null +++ b/zscripts/zplug.zsh @@ -0,0 +1,136 @@ +#!/usr/bin/env zsh + +local home=~ +local zplugs="${ZDOTDIR:-$home/.}${ZDOTDIR:+/}zplugs" # Declare all variables using `local` to keep them away from the interactive shell +local zplugins="${ZPLUGINSDIR:-$home/.local/share/zsh/zplugins}" +#[[ $EUID != 0 ]] && [ -z "$ZPLUGNOROOT" ] && local sudo=${SUDO-sudo} + +function __zplugInstall() { + touch "$zplugs" + local pluglist=( `\grep -v '#' "$zplugs"` ) + local confirm plug + shift + for plug in "$@"; do; pluglist+=(${plug}); done + + $sudo mkdir -p "$zplugins" + + for plug in ${pluglist[@]}; do + [ -d "$zplugins/$(basename -s'.git' "$plug")" ] && continue + if ! `$sudo git -C "$zplugins" clone "$plug" "$(basename -s'.git' "$plug")"`; then + # Runs if git has an error + printf "Remove \"$plug\"? [y|n]: " + read confirm + case $confirm in + y|yes) pluglist=(${pluglist#$plug}) && echo "Repo Deleted" ;; + *) echo "Repo Kept" ;; + esac + fi + echo + done + for plug in ${pluglist[@]}; do echo "$plug"; done | sort -u > "$zplugs" + echo "All plugins installed and saved to $zplugs!\nDone" +} + +function __zplugUninstall() { + local pluglist=( `cat "$zplugs"` ) pluglistbn=() + local confirm i plug plugids plugig + + [ -z "$pluglist" ] && echo "No packages are installed!" && return + + $sudo mkdir -p "$zplugins" + echo "Listing all packages in $zplugins ..." + for i in {1..${#pluglist[@]}}; do + pluglistbn[$i]="$(basename -s'.git' "${pluglist[$i]}")" + printf '%3d) %s\n' $i "${pluglistbn[$i]}" + done + + echo + printf "Choose zsh plugin(s) to remove: " + read plugids + [ -z "$plugids" ] && echo "No plugins selected\nAborting" && return + + echo "\nListing selected plugins:" + for plugid in $=plugids; do + if [ -z ${pluglist[$plugid]} ]; then + echo "Error: input \"$plugid\" is not a valid plugin identifier" + return + fi + echo "\t${pluglistbn[$plugid]}" + done + + printf "\nReally remove all of these plugins? [y|n]: " + read confirm + case $confirm in + y|yes) ;; + n|no) echo "Aborted" && return ;; + *) echo "Input not understood\nAborted" && return ;; + esac + for plugid in $=plugids; do + printf '\t' + $sudo rm -vrf "$zplugins/${pluglistbn[$plugid]}" + pluglist[$plugid]="" + done + for plug in ${pluglist[@]}; do echo "$plug"; done | sort -u > "$zplugs" + echo "\nDone" +} + +function __zplugUpgrade() { + local plugdir + $sudo mkdir -p "$zplugins" + echo "Upgrading all packages...\n" + for plugdir in "$zplugins"/*; do; + basename "$plugdir" + $sudo git -C "$plugdir" pull; + echo + done + echo "Done" +} + +function __zplugList() { + mkdir -p "$zplugins" + echo "Listing all packages...\n" + ls "$zplugins" | nl -s') ' -w3 + echo "\nDone" +} + +function __zplugHelp() { + echo "Usage: zplug [install/add/i|uninstall/remove/r|upgrade/update/u|list/l|help/h] + install, add, i [packages] : Install plugins from config file & add any new plugins + uninstall, remove, r : Interactively remove plugins + upgrade, update, u : Update all installed plugins + list, l : List all installed plugins + help, h : Show this help menu + + All plugins are listed in $zplugs + All plugins are installed in $zplugins + + To install a plugin, just put it in the zplug file and run \"zplug install\" + or just run \"zplug install [plugin]\" where [plugin] is a link to download the + plugin using git + + For instance, \"https://github.com/zdharma-continuum/fast-syntax-highlighting\" is + a valid plugin link for the fast-syntax-highlighting plugin. + + To use your plugins, just put \"zplugInitialize\" as the last line of your zshrc!" +} + +function zplug() { + local cmd=${1:-h} + case $cmd in + install|add|i) __zplugInstall $@ ;; + uninstall|remove|r) __zplugUninstall ;; + upgrade|update|u) __zplugUpgrade ;; + list|l) __zplugList ;; + help|h) __zplugHelp ;; + *) echo "zplug: input \"$1\" not recognized!" && __zplugHelp ;; + esac +} + +function zplugInitialize() { + local plugin + if ! [ -d "$zplugins" ] && [ -f "$zplugs" ]; then + echo "zplug installing plugins..." + __zplugInstall 0 # Put in some value since there is a shift + fi + for plugin in "$zplugins"/*/*.zsh; do source "$plugin"; done 2>/dev/null +} diff --git a/zscripts/zshcompmenu.zsh b/zscripts/zshcompmenu.zsh new file mode 100755 index 0000000..0d471a5 --- /dev/null +++ b/zscripts/zshcompmenu.zsh @@ -0,0 +1,18 @@ +#!/usr/bin/env zsh + +# Basic auto/tab complete +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit -d "${XDG_CACHE_HOME:-$HOME/.config}/zcompdump" # Change where .zcompdump is stored +_comp_options+=(globdots) # Include hidden files. + +# Use ctrl-vi keys in tab complete menu +bindkey -M menuselect '^h' vi-backward-char +bindkey -M menuselect '^j' vi-down-line-or-history +bindkey -M menuselect '^k' vi-up-line-or-history +bindkey -M menuselect '^l' vi-forward-char +bindkey -v '^?' backward-delete-char + +# Options +setopt MENU_COMPLETE # Immediately insert first option from completion menu @@ -0,0 +1,32 @@ +#!/usr/bin/env zsh + +setopt +o NOMATCH # Non-existant wildcard matches won't produce an error + +# Zsh scripts (load general scripts, then host specific scripts, then scripts with ! prefix) (loaded later = higher priority) +for zscript in "$XDG_CONFIG_HOME/zsh/zscripts"{/[^\!]*.zsh,/hosts/*.$HOST.zsh,/!*.zsh}; do source "$zscript"; done 2>/dev/null + +# Colors! + Prompt +autoload -U colors && colors +[ -z "$PS1OVERRIDE" ] && PS1="%B%F{${colbr:-red}}[%F{${colname:-yellow}}%n%F{${colat:-green}}@%F{${colhost:-blue}}%m %F{${coldir:-magenta}}%U%~%u%F{${colbr:-red}}]%f%b%(!.#.$) " + +# Cd settings +setopt AUTO_CD # `cd` is implied when path is entered + +# History settings +HISTFILE="${ZHISTFILE:-$HOME/.zhistory}" +HISTSIZE=500 # Max lines of history loaded into memory for each zsh session +SAVEHIST=10000000 # Max lines of history saved to HISTFILE before overwriting +setopt EXTENDED_HISTORY # Save superfluous info with command to reduce disk writes when using INC_APPEND_HISTORY or SHARE_HISTORY +setopt HIST_IGNORE_DUPS # Successive duplicate entries ignored +setopt HIST_IGNORE_SPACE # Entries with leading space aren't stored in histfile +setopt HIST_REDUCE_BLANKS # Remove superfluous blank characters before saving +setopt INC_APPEND_HISTORY # Create entries after each command, not after zsh exits +setopt SHARE_HISTORY # Share history between zsh sessions + +# Input/output settings +setopt INTERACTIVE_COMMENTS # Comments won't be interpreted in an interactive shell + +# Disable bell +unsetopt BEEP + +zplugInitialize # Load zsh plugins using zplug; goes last |