dotfiles/home/.dotfiles/1-zsh

63 lines
1.8 KiB
Plaintext

export ZSH="$HOME/.oh-my-zsh"
plugins=(
zsh-syntax-highlighting
)
autoload -U compinit
# Use this setting if you want to disable marking untracked files under VCS as dirty.
# This makes repository status checks for large repositories much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
SHOW_AWS_PROMPT=false
COMPLETION_WAITING_DOTS=true
source $ZSH/oh-my-zsh.sh
zstyle ':omz:update' mode reminder
source `brew --prefix switch`/switch.sh
# History
HISTFILE="$HOME/.zsh_history"
HISTIGNORE="&:exit:reset:clear:zh"
setopt append_history
setopt hist_ignore_space
setopt HIST_IGNORE_DUPS
setopt sharehistory
setopt INC_APPEND_HISTORY
setopt HIST_REDUCE_BLANKS
# Options
setopt autocd
autoload -U add-zsh-hook
DISABLE_AUTO_TITLE="true"
# Override auto-title when static titles are desired ($ title My new title)
title() { export TITLE_OVERRIDDEN=1; echo -en "\e]0;$*\a"}
# Turn off static titles ($ autotitle)
autotitle() { export TITLE_OVERRIDDEN=0 }; autotitle
# Condition checking if title is overridden
overridden() { [[ $TITLE_OVERRIDDEN == 1 ]]; }
# Show cwd when shell prompts for input.
precmd() {
if overridden; then return; fi
pwd=$(pwd) # Store full path as variable
cwd=${pwd##*/} # Extract current working dir only
print -Pn "\e]0;$cwd\a" # Replace with $pwd to show full path
}
# Prepend command (w/o arguments) to cwd while waiting for command to complete.
preexec() {
if overridden; then return; fi
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
}
# Giant Swarm specific
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
which gsctl &>/dev/null && gsctl completion zsh --stdout > /usr/local/share/zsh/site-functions/_gsctl
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl