How to set up a mac terminal with a more humanistic user interface
Run:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Clone the plugins into the oh-my-zsh directory. Run:
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-history-substring-search.git $ZSH_CUSTOM/plugins/zsh-history-substring-search
Instal the cloned plugins into oh-my-zsh. In ~/.zshrc
, on your plugins
array, insert:
zsh-autosuggestions
zsh-syntax-highlighting
history-substring-search
References:
This part is totally up to you, but this is what I use. In ~/.zshrc
, below source $ZSH/oh-my-zsh.sh
, insert:
export PROMPT=$'\e[36m%n\e[92m:\e[93m%d $(git_prompt_info)'
Different people have different needs, I've included below some of the things that works for me.
In ~/.zshrc
, insert:
# -------------------------------
# 1. ENVIRONMENT CONFIGURATION
# -------------------------------
# Set Paths
# ------------------------------------------------------------
# This is where your path variables live. Some tools or runtimes requires this.
# Examples:
# export PATH="/usr/local/opt/qt@5.5/bin:$PATH"
# export PATH="/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin:$PATH"
# export PATH="/Users/tirtawr/Library/Python/2.7/bin:$PATH"
# Set Default Editor (change 'Nano' to the editor of your choice)
# ------------------------------------------------------------
export EDITOR=/usr/bin/nano
# Set default blocksize for ls, df, du
# ------------------------------------------------------------
export BLOCKSIZE=1k
# ---------------------------
# 2. DEVELOPMENT RELATED
# ---------------------------
# This is where I tend to put some aliases or functions that helps me when I'm doing development.
#
# Ruby
# ------------------------------------------------------------
alias dbe="RAILS_ENV=development bundle exec "
alias bed="RAILS_ENV=development bundle exec "
alias tbe="RAILS_ENV=test bundle exec "
alias bet="RAILS_ENV=test bundle exec "
alias be="bundle exec "
alias bers="bundle exec rails s"
# Typo Protection
# ------------------------------------------------------------
alias devleop="develop"
alias cehckout="checkout"
alias gut="git"
alias doker="docker"
# CD Into specific projects/directories
# ------------------------------------------------------------
alias wsp="cd ~/Workspace"
alias desk="cd ~/Desktop"
alias ~="cd ~"
# -----------------------------
# 3. MAKE TERMINAL BETTER
# -----------------------------
# These are some helpers that makes the terminal better
alias cp='cp -iv' # Preferred 'cp' implementation
alias mv='mv -iv' # Preferred 'mv' implementation
alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation
alias ls='ls -FGA' # Preferred 'ls' implementation
alias ll='ls -FGlAhp' # Preferred 'ls' implementation
alias less='less -FSRXc' # Preferred 'less' implementation
alias cd..='cd ../' # Go back 1 directory level (for fast typers)
alias ..='cd ../' # Go back 1 directory level
alias ...='cd ../../' # Go back 2 directory levels
alias .1='cd ../'. # Go back 1 directory levels
alias .2='cd ../../'. # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
alias f='open -a Finder ./' # f: Opens current directory in MacOS Finder
alias c='clear' # c: Clear terminal display
alias which='type' # which: Find executables
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new Dir and jumps inside
trash () { command mv "$@" ~/.Trash ; } # trash: Moves a file to the MacOS trash
ql () { qlmanage -p "$*" >& /dev/null; } # ql: Opens any file in MacOS Quicklook Preview