You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							66 lines
						
					
					
						
							2.2 KiB
						
					
					
				
			
		
		
	
	
							66 lines
						
					
					
						
							2.2 KiB
						
					
					
				#! /usr/bin/env bash | 
						|
 | 
						|
# Use the iterm2 material theme in the root directory of the essentials repository. For linux, | 
						|
# you will need to source a material theme color scheme for your terminal (for XFCE use nord in the xfce | 
						|
# themes folder). | 
						|
 | 
						|
# This monstrosity returns the directory of the .bashrc from it's symlinked source so we can | 
						|
# call script files correctly. | 
						|
 | 
						|
if [[ "$OSTYPE" == "linux-gnu" ]]; then | 
						|
  symlink_dir=$(cd "$( dirname "`readlink -f ${BASH_SOURCE[0]}`" )" && pwd) | 
						|
else | 
						|
  # OS X is not a fan of `readlink -f` | 
						|
  symlink_dir=$(cd "$( dirname "`readlink ${BASH_SOURCE[0]}`" )" && pwd) | 
						|
fi | 
						|
 | 
						|
# Useful global functions | 
						|
alias cgen=$symlink_dir/scripts/cgen.sh | 
						|
 | 
						|
if [ -f ~/.inputrc ]; then | 
						|
        bind -f ~/.inputrc | 
						|
else | 
						|
        echo "No .inputrc detected" | 
						|
fi | 
						|
 | 
						|
if [[ "$OSTYPE" == "darwin"* ]]; then | 
						|
	if [ -f ~/.macrc ]; then | 
						|
        	source ~/.macrc | 
						|
	fi | 
						|
fi | 
						|
 | 
						|
parse_git_branch() { | 
						|
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | 
						|
} | 
						|
 | 
						|
# If you ever needed weather... | 
						|
weather() { | 
						|
    curl wttr.in | 
						|
} | 
						|
 | 
						|
# Test for the `bash-completion` package. Installing this adds better tab completion to bash. | 
						|
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" | 
						|
 | 
						|
# Ignore duplicates in history to make history less of a hassle to use. | 
						|
export HISTCONTROL=ignoredups | 
						|
 | 
						|
# Better color handling so scrolling doesn't get broken. | 
						|
# Note for Cygwin you need ncurses for this to work. | 
						|
reset=$(tput sgr0) | 
						|
green=$(tput setaf 2) | 
						|
blue=$(tput setaf 4) | 
						|
white=$(tput setaf 7) | 
						|
 | 
						|
bold=$(tput bold || tput md) | 
						|
 | 
						|
export PROMPT_DIRTRIM=2 | 
						|
 | 
						|
# Important note for PS1 modification - everything non-printable must be escaped with `\[` and `\]`. Otherwise readline | 
						|
# fails to track the prompt right and things get messed up when you input long strings. | 
						|
 | 
						|
if [[ "$OSTYPE" == "linux-gnu" ]]; then | 
						|
  # I had some rendering issues running in XFCE unless I added an extra space at the end. | 
						|
  export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]\[$(parse_git_branch)\]\[$reset\]\[$bold\]\[$white\]⇨\[$reset\]  ' | 
						|
else | 
						|
  export PS1='\[$bold\]\[$white\]\u@\h\[$reset\]: \[$bold\]\[$blue\]\w\[$reset\] \[$green\]\[$(parse_git_branch)\]\[$reset\]\[$bold\]\[$white\]⇨\[$reset\] ' | 
						|
fi
 | 
						|
 |