Skip to content

Instantly share code, notes, and snippets.

@tterb
Created March 19, 2019 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tterb/994a3ae662ba42305ed7a7094e7e4c4a to your computer and use it in GitHub Desktop.
Save tterb/994a3ae662ba42305ed7a7094e7e4c4a to your computer and use it in GitHub Desktop.
Bash aliases and prompt
# ~/.bash_profile
[[ -s ~/.bashrc ]] && source ~/.bashrc
export CLICOLOR=1
export LSCOLORS=gxBxhxDxdxhxhxhxhxcxbx
export TERM=xterm-256color
alias lc='colorls'
alias ls='ls -GFh'
alias ll='ls -l'
alias la='ls -a'
alias lt='tree -C'
alias cd..="cd .."
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias cd-="cd -"
alias git=hub
alias reload='source ~/.bash_profile'
alias emacs='emacs -nw'
alias config='emacs ~/.bash_profile'
alias brewery='brew update; brew upgrade; brew cleanup; brew doctor'
alias http='http -s monokai'
alias google='googler $@'
alias kakapo='curl parrot.live'
alias ip='ipconfig getifaddr en0'
alias trash='rmtrash'
alias macaddress='ifconfig en1 | awk "/ether/{print $2}"'
alias cat='bat --paging=never --style=plain'
alias doc2pdf='pandoc --pdf-engine=/Library/TeX/texbin/pdflatex'
alias qmake='/usr/local/Cellar/qt5/5.7.0/bin/qmake'
alias pypackage='python3 setup.py sdist bdist_wheel && python3 setup.py build --executable="/usr/bin/env python3"'
alias subl='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
alias awk='gawk'
eval $(thefuck --alias fuck)
function search() { ag "$1"; }
function rmsp() { for f in *\ *; do mv "$f" "${f// /-}"; done }
function mkcd() {
if [ ! -n "$1" ]; then
echo "Enter a directory name"
elif [ -d $1 ]; then
echo "\`$1' already exists"
else
mkdir $1 && cd $1
fi
}
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
local GREENBOLD="\[\033[1;32m\]"
local YELLOW="\[\033[0;33m\]"
local YELLOWBOLD="\[\033[1;33m\]"
local BLUE="\[\033[0;34m\]"
local BLUEBOLD="\[\033[1;34m\]"
local PURPLE="\[\033[0;35m\]"
local PURPLEBOLD="\[\033[1;35m\]"
local CYAN="\[\033[0;36m\]"
local CYANBOLD="\[\033[1;36m\]"
local WHITE="\[\033[0;37m\]"
local WHITEBOLD="\[\033[1;37m\]"
local RC="\[\e[00m\]"
local ITALIC="\e[3mMBP\e[0m"
export PS1="\n⚡️ $RED\u$YELLOW@$BLACK\h$RC:$CYAN\w$RC$GREENBOLD\$(git branch 2> /dev/null)\n$RC$BLUE ↳ $RC"
export PS2=" | → $RC"
}
GIT_PROMPT_ONLY_IN_REPO=1 # Use the default prompt when not in a git repo.
GIT_PROMPT_FETCH_REMOTE_STATUS=0 # Avoid fetching remote status
GIT_PROMPT_SHOW_UPSTREAM=0 # Don't display upstream tracking branch
GIT_SHOW_UNTRACKED_FILES=no # Don't count untracked files (no, normal, all)
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
fi
prompt
if [ -x /usr/games/cowsay -a -x /usr/games/fortune ]; then
fortune -s | cowsay -f bud-frogs
fi
export EDITOR='emacs -nw'
@tterb
Copy link
Author

tterb commented Mar 19, 2019

Packages:

  • bash-git-prompt - An informative and fancy bash prompt for Git users
  • thefuck - Magnificent app which corrects your previous console command
  • googler - Google from the terminal
  • hub - A command-line tool that makes git easier to use with GitHub
  • bat - A cat(1) clone with wings
  • colorls - A gem that beautifies the ls command with color and icons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment