# If you come from bash you might have to change your $PATH. # export PATH=$HOME/bin:/usr/local/bin:$PATH export PATH=$PATH:$HOME/.local/bin # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" # Set name of the theme to load --- if set to "random", it will # load a random theme each time oh-my-zsh is loaded, in which case, # to know which specific one was loaded, run: echo $RANDOM_THEME # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes ZSH_THEME="agnoster" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. HYPHEN_INSENSITIVE="true" # Uncomment the following line to disable bi-weekly auto-update checks. # DISABLE_AUTO_UPDATE="true" # Uncomment the following line to automatically update without prompting. # DISABLE_UPDATE_PROMPT="true" # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work) # See https://github.com/ohmyzsh/ohmyzsh/issues/5765 # COMPLETION_WAITING_DOTS="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" # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Add wisely, as too many plugins slow down shell startup. plugins=(git zsh-autosuggestions zsh-syntax-highlighting docker docker-compose zsh-you-should-use z ssh) export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST source $ZSH/oh-my-zsh.sh # Initialize zoxide eval "$(zoxide init zsh)" # User configuration # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='mvim' # fi # Compilation flags # export ARCHFLAGS="-arch x86_64" # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # Load custom aliases # Define ZSH_CUSTOM if not already defined if [ -z "$ZSH_CUSTOM" ]; then ZSH_CUSTOM="$HOME/.oh-my-zsh/custom" fi if [ -f "$ZSH_CUSTOM/aliases.zsh" ]; then source "$ZSH_CUSTOM/aliases.zsh" elif [ -f "$HOME/.oh-my-zsh/custom/aliases.zsh" ]; then source "$HOME/.oh-my-zsh/custom/aliases.zsh" fi # set directory to home cd ~ if [ -x /usr/games/cowsay -a -x /usr/games/fortune -a -x /usr/games/lolcat ]; then fortune -s | cowsay | lolcat fi # NVM configuration export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Automatically use node version specified in .nvmrc if present # Only enable if nvm is loaded if command -v nvm_find_nvmrc > /dev/null 2>&1; then autoload -U add-zsh-hook load-nvmrc() { local nvmrc_path="$(nvm_find_nvmrc)" if [ -n "$nvmrc_path" ]; then local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") if [ "$nvmrc_node_version" = "N/A" ]; then nvm install elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then nvm use fi elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then nvm use default fi } add-zsh-hook chpwd load-nvmrc load-nvmrc fi [[ -s $HOME/.autojump/etc/profile.d/autojump.sh ]] && source $HOME/.autojump/etc/profile.d/autojump.sh # Enable bash completion compatibility in zsh autoload -U +X bashcompinit && bashcompinit autoload -U compinit && compinit -u # Load custom backup scripts completion if [ -f "$HOME/shell/completions/backup-scripts-completion.bash" ]; then source "$HOME/shell/completions/backup-scripts-completion.bash" fi # Load Plex scripts completion if [ -f "$HOME/shell/completions/plex-scripts-completion.bash" ]; then source "$HOME/shell/completions/plex-scripts-completion.bash" fi # Load environment backup completion if [ -f "$HOME/shell/completions/env-backup-completion.bash" ]; then source "$HOME/shell/completions/env-backup-completion.bash" fi # Go environment variables # GOROOT is auto-detected by Go when installed via package manager export GOPATH=$HOME/go export PATH=$GOPATH/bin:$PATH # SSH Agent Management - Start only if needed and working properly ssh_agent_start() { local ssh_agent_env="$HOME/.ssh-agent-env" # Function to check if ssh-agent is running and responsive ssh_agent_running() { [ -n "$SSH_AUTH_SOCK" ] && [ -S "$SSH_AUTH_SOCK" ] && ssh-add -l >/dev/null 2>&1 } # Load existing agent environment if it exists if [ -f "$ssh_agent_env" ]; then source "$ssh_agent_env" >/dev/null 2>&1 fi # Check if agent is running and responsive if ! ssh_agent_running; then # Start new agent only if ssh key exists if [ -f "$HOME/.ssh/id_ed25519" ]; then # Clean up any stale agent environment [ -f "$ssh_agent_env" ] && rm -f "$ssh_agent_env" # Start new agent and save environment ssh-agent -s > "$ssh_agent_env" 2>/dev/null if [ $? -eq 0 ]; then source "$ssh_agent_env" >/dev/null 2>&1 # Add key to agent ssh-add "$HOME/.ssh/id_ed25519" >/dev/null 2>&1 fi fi fi } # Only run SSH agent setup if we have SSH keys if [ -f "$HOME/.ssh/id_ed25519" ]; then ssh_agent_start fi