113 lines
		
	
	
	
		
			3.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
	
		
			3.2 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| # If not running interactively, don't do anything
 | |
| case $- in
 | |
|     *i*) ;;
 | |
|       *) return;;
 | |
| esac
 | |
| 
 | |
| # =============================================================================
 | |
| # 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
 | |
| 
 | |
| # =============================================================================
 | |
| # Ripped from default .bashrc
 | |
| # =============================================================================
 | |
| HISTCONTROL=ignoreboth
 | |
| shopt -s histappend
 | |
| HISTSIZE=1000
 | |
| HISTFILESIZE=2000
 | |
| shopt -s checkwinsize
 | |
| 
 | |
| if ! shopt -oq posix; then
 | |
|   if [ -f /usr/share/bash-completion/bash_completion ]; then
 | |
|     . /usr/share/bash-completion/bash_completion
 | |
|   elif [ -f /etc/bash_completion ]; then
 | |
|     . /etc/bash_completion
 | |
|   fi
 | |
| fi
 | |
| 
 | |
| # =============================================================================
 | |
| # Command Prompt Customization
 | |
| # =============================================================================
 | |
| ps1_startup_file="$HOME/.startup/ps1"
 | |
| if [ -f "$ps1_startup_file" ]; then
 | |
|     source $ps1_startup_file
 | |
| else
 | |
|     if $logging_enabled; then
 | |
|         echo "[warn] Custom PS1 for bash missing at " \
 | |
|             "'$ps1_startup_file': " \
 | |
|             "see git@git.sr.ht:~eidolon/scripts" >> $log_file
 | |
|     fi
 | |
| fi
 | |
| 
 | |
| # =============================================================================
 | |
| # PATH
 | |
| # =============================================================================
 | |
| if [ -f "$HOME/.cargo/env" ]; then
 | |
|     source "$HOME/.cargo/env"
 | |
| fi
 | |
| 
 | |
| if [ -f ~/.fzf.bash ]; then
 | |
|     source ~/.fzf.bash
 | |
| fi
 | |
| 
 | |
| export RACKET_HOME="$HOME/opt/racket"
 | |
| if [ -d "$RACKET_HOME" ]; then
 | |
|     export PATH=$PATH:$RACKET_HOME/bin
 | |
| fi
 | |
| 
 | |
| export BUILDKIT_HOME="$HOME/opt/buildkit"
 | |
| if [ -d "$BUILDKIT_HOME" ]; then
 | |
|     export PATH=$PATH:$HOME/opt/buildkit/bin
 | |
| fi
 | |
| 
 | |
| export JAVA_HOME="$HOME/opt/jdk"
 | |
| if [ -d "$JAVA_HOME" ]; then
 | |
|     export PATH=$PATH:$JAVA_HOME/bin
 | |
| fi
 | |
| 
 | |
| export COURSIER_HOME="$HOME/.local/share/coursier"
 | |
| if [ -d "$COURSIER_HOME" ]; then
 | |
|     export PATH="$PATH:$COURSIER_HOME/bin"
 | |
| 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'
 | |
| 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
 | 
