dotfiles/.zshrc

137 lines
4 KiB
Bash

export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="spaceship"
SPACESHIP_TIME_SHOW=true
SPACESHIP_TIME_FORMAT="%D{%D %r}"
SPACESHIP_HG_SHOW=false
SPACESHIP_HG_BRANCH_SHOW=false
SPACESHIP_HG_STATUS_SHOW=false
SPACESHIP_XCODE_SHOW_LOCAL=false
SPACESHIP_SWIFT_SHOW_LOCAL=false
SPACESHIP_PHP_SHOW=false
SPACESHIP_AWS_SHOW=false
SPACESHIP_GCLOUD_SHOW=false
SPACESHIP_CONDA_SHOW=false
SPACESHIP_DOTNET_SHOW=false
SPACESHIP_EMBER_SHOW=false
SPACESHIP_BATTERY_SHOW=false
VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(gitfast vi-mode)
source $ZSH/oh-my-zsh.sh
# =============================================================================
# Personalized Logging for Shell Setup
# =============================================================================
logging_enabled=false
log_dir="$HOME/log/$USER"
log_file="$log_dir/shell.log"
if [ -d "$log_dir" ]; then
export SHELL_LOG_FILE="$log_file"
logging_enabled=true
touch "$SHELL_LOG_FILE"
fi
# =============================================================================
# Common Environment Configuration
# =============================================================================
export EDITOR=nvim
# =============================================================================
# PATH
# =============================================================================
if [ -d "$HOME/bin" ]; then
export PATH="$HOME/bin:$PATH"
fi
if [ -d "$HOME/.local/bin" ]; then
export PATH="$HOME/.local/bin:$PATH"
fi
if [ -f "$HOME/.cargo/env" ]; then
source "$HOME/.cargo/env"
fi
if [ -f ~/.fzf.zsh ]; then
source ~/.fzf.zsh
fi
export RACKET_HOME="$HOME/opt/racket"
if [ -d "$RACKET_HOME" ]; then
export PATH="$RACKET_HOME/bin:$PATH"
fi
export BUILDKIT_HOME="$HOME/opt/buildkit"
if [ -d "$BUILDKIT_HOME" ]; then
export PATH="$HOME/opt/buildkit/bin:$PATH"
fi
export JAVA_HOME="$HOME/opt/jdk"
if [ -d "$JAVA_HOME/bin" ]; then
export PATH="$JAVA_HOME/bin:$PATH"
fi
export COURSIER_HOME="$HOME/.local/share/coursier"
if [ -d "$COURSIER_HOME/bin" ]; then
export PATH="$COURSIER_HOME/bin:$PATH"
fi
export N_PREFIX=/home/pfm/.n
if [ -d "$N_PREFIX/bin" ]; then
export PATH="$N_PREFIX/bin:$PATH"
fi
# =============================================================================
# SSH Agent Management
# =============================================================================
ssh_agent_startup_file="$HOME/.startup/start-ssh-agent"
if [ -f "$ssh_agent_startup_file" ]; then
source "$ssh_agent_startup_file"
else
if $logging_enabled; then
echo "[warn] SSH Agent startup code missing at " \
"'$ssh_agent_startup_file': " \
"see git@git.sr.ht:~eidolon/scripts" >> "$log_file"
fi
fi
# =============================================================================
# Aliases
# =============================================================================
if command -v exa > /dev/null 2>&1; then
alias ls='exa'
alias ll='exa -l'
else
if $logging_enabled; then
echo "[warn] exa is not setup! Using the system ls" >> "$log_file"
fi
fi
if command -v nvim > /dev/null 2>&1; then
alias vim='nvim'
else
if $logging_enabled; then
echo "[warn] Neovim is not setup! Using the system vim" >> "$log_file"
fi
fi
# =============================================================================
# Scala/SBT Setup
# =============================================================================
if command -v sbt > /dev/null 2>&1; then
export SBT_OPTS="-XX:+UseG1GC -Xmx2048m"
fi
# =============================================================================
# Enable Command Syntax Highlighting
# This must be the last item in this file.
# =============================================================================
source $HOME/src/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh