Created
October 18, 2018 05:31
-
-
Save fahadgudu/2aff90b43e3b5e655d19277d670f6514 to your computer and use it in GitHub Desktop.
Terminal Options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
alias ls='ls -GFh' | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
alias ..="cd .." | |
alias ...="cd ../.." | |
alias ....="cd ../../.." | |
alias .....="cd ../../../.." | |
alias ~="cd ~" # `cd` is probably faster to type though | |
alias -- -="cd -" | |
alias web="cd ~/work/web" | |
alias rn ="cd ~/work/rn" | |
alias dl="cd ~/Downloads" | |
alias dt="cd ~/Desktop" | |
alias g="git" | |
alias h="history" | |
# Detect which `ls` flavor is in use | |
if ls --color > /dev/null 2>&1; then # GNU `ls` | |
colorflag="--color" | |
else # OS X `ls` | |
colorflag="-G" | |
fi | |
# List all files colorized in long format | |
alias l="ls -lF ${colorflag}" | |
# List all files colorized in long format, including dot files | |
alias la="ls -laF ${colorflag}" | |
# List only directories | |
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'" | |
# Always use color output for `ls` | |
alias ls="command ls ${colorflag}" | |
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' | |
# Always enable colored `grep` output | |
# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage. | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
# Enable aliases to be sudo’ed | |
alias sudo='sudo ' | |
# Get week number | |
alias week='date +%V' | |
# Stopwatch | |
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' | |
# Git Aliases | |
alias gst='git status ' | |
alias gad='git add ' | |
alias gbr='git branch ' | |
alias gam='git commit --amend ' | |
alias gc='git commit' | |
alias gdi='git diff' | |
alias gt='git checkout ' | |
alias gk='gitk --all&' | |
alias gx='gitx --all' | |
alias gpl='git pull' | |
alias pullo='git pull origin' | |
alias gpu='git push' | |
alias pusho='git push origin' | |
alias pushf='git push -f origin' | |
alias pushu='git push -u origin' | |
alias merge='git merge' | |
alias add='git add' | |
# npm aliases | |
alias ni='npm install' | |
alias nig='npm install -g' | |
alias nis='npm install -S' | |
alias nid='npm install -D' | |
alias nu='npm uninstall' | |
alias nug='npm uninstall -g' | |
alias nus='npm uninstall -S' | |
alias nud='npm uninstall -D' | |
alias nit='npm init' | |
alias nity='npm init -y' | |
#export PS1="\\w:\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)\$ " | |
function shortwd() { | |
num_dirs=3 | |
pwd_symbol="..." | |
newPWD="${PWD/#$HOME/~}" | |
if [ $(echo -n $newPWD | awk -F '/' '{print NF}') -gt $num_dirs ]; then | |
newPWD=$(echo -n $newPWD | awk -F '/' '{print $1 "/.../" $(NF-1) "/" $(NF)}') | |
fi | |
echo -n $newPWD | |
} | |
git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
PS1='\n\e[38;5;211m$(shortwd)\e[38;5;48m $(git_branch)\e[0m$' | |
export PS1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment