Files
dotfiles/base/zshrc

107 lines
2.8 KiB
Bash
Executable File

# this is my zsh config. there are many like it, but this one is mine.
# shellcheck shell=bash
export DOTFILES="$HOME/.dotfiles"
# Explicitly set XDG folders
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"
# custom variables
export XDG_BIN_HOME="$HOME/.local/bin"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_RUNTIME_DIR="$HOME/.local/run"
export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$HOME/.local/go/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_DATA_HOME/cargo/bin:/opt/homebrew/bin:/usr/local/bin:$PATH"
x-load-configs
export COMPLETION_WAITING_DOTS=true
if type brew &> /dev/null; then
eval "$(brew shellenv)"
FPATH="$HOMEBREW_PREFIX/share/zsh/site-functions:${FPATH}"
fi
export ZSH_CUSTOM_COMPLETION_PATH="$XDG_CONFIG_HOME/zsh/completion"
x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
# Add completion scripts to zsh path
FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
# Try to load antigen, if present
ANTIGEN_ZSH_PATH="$XDG_BIN_HOME/antigen.zsh"
# shellcheck source=../../.local/bin/antigen.zsh
[[ -f "$ANTIGEN_ZSH_PATH" ]] && source "$ANTIGEN_ZSH_PATH"
# antigen is present
antigen use oh-my-zsh
export ZSH_TMUX_AUTOSTART=true
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
export ZSH_TMUX_UNICODE=true
export ZSH_TMUX_AUTOQUIT=false
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
export NVM_DIR="$XDG_CONFIG_HOME/nvm"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
# z, the zsh version
export ZSHZ_DATA="$XDG_STATE_HOME/z"
antigen bundle z
# these should be always available
antigen bundle tmux
antigen bundle colored-man-pages
antigen bundle command-not-found
antigen bundle ssh-agent
antigen bundle jreese/zsh-titles
antigen bundle zsh-users/zsh-completions
# these should be available if there's need
x-have brew && antigen bundle brew
x-have php && antigen bundle php
x-have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
# nvm is a strange beast
zstyle ':omz:plugins:nvm' autoload yes
antigen bundle nvm
# antigen bundle "$DOTFILES/config/zsh/plugins/nvm-auto-use"
# nice to have stuff
antigen bundle gcloud
# this needs to be the last item
antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply
# shellcheck source=../config/fzf/fzf.zsh
[ -f "${DOTFILES}/config/fzf/fzf.zsh" ] \
&& source "${DOTFILES}/config/fzf/fzf.zsh"
x-have op && {
eval "$(op completion zsh)"
compdef _op op
}
x-have rbenv && {
eval "$(rbenv init - zsh)"
}
# Autoupdate tmux window name
TMUX_WINDOW_NAME_PLUGIN="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py"
[ -f "$TMUX_WINDOW_NAME_PLUGIN" ] && {
tmux-window-name()
{
($TMUX_WINDOW_NAME_PLUGIN &)
}
add-zsh-hook chpwd tmux-window-name
}
# Start starship
eval "$(starship init zsh)"
source $DOTFILES/config/alias