2020-09-07 08:30:23 +00:00
|
|
|
export ZSH="$HOME/.oh-my-zsh"
|
|
|
|
|
2021-07-19 06:33:55 +00:00
|
|
|
plugins=(
|
|
|
|
git
|
|
|
|
docker
|
|
|
|
zsh-completions
|
|
|
|
zsh-syntax-highlighting
|
|
|
|
zsh-autosuggestions
|
|
|
|
)
|
2020-09-07 08:30:23 +00:00
|
|
|
autoload -U compinit && compinit
|
|
|
|
fpath=($fpath ~/.zsh/completion)
|
|
|
|
|
|
|
|
source $ZSH/oh-my-zsh.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
|
|
|
|
|
|
|
|
BAT_THEME="Monokai Extended Light"
|
|
|
|
BAT_STYLE="grid,header"
|
|
|
|
|
|
|
|
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 ]]; }
|
|
|
|
# Echo asterisk if git state is dirty
|
|
|
|
gitDirty() { [[ $(git status 2> /dev/null | grep -o '\w\+' | tail -n1) != ("clean"|"") ]] && echo "*" }
|
|
|
|
|
|
|
|
# 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$(gitDirty)\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$(gitDirty)" # Omit construct from $1 to show args
|
|
|
|
}
|