Skip to content

Mac_Terminal

bootstraponline edited this page Sep 27, 2016 · 38 revisions

iTerm2 & ZSH on Mac

  • Install iTerm2 stable

  • Install solarized dark iTerm colors.

    • wget https://raw.github.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors
    • iTerm2Preferences...ProfilesColorsColor Presets...Import
    • After importing, manually select Solarized Dark from the drop down list.
  • Install Oh My ZSH

    • sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • Edit ~/.zshrc and update:

    • ZSH_THEME="agnoster"
    • DEFAULT_USER="your_username"
    • plugins=(git)
  • Install powerline font

    • git clone https://github.com/powerline/fonts.git
    • cd fonts; ./install.sh
    • iTerm2Preferences...ProfilesTextChange FontMeslo LG M DZ Regular for Powerline
      • Make sure to uncheck Use a different font for non-ASCII text. If this is checked, the Git symbols won't render correctly.

--

Custom alias

Open the Command Palette in visual studio code then type shell command and click Shell Command: Install 'code' command in PATH

$ code ~/.oh-my-zsh/custom/custom.zsh
alias c="$HOME/code"
alias o="code --disable-extensions --reuse-window"
alias zshconfig="o \"$HOME/.zshrc\""
alias zshcustom="o \"$HOME/.oh-my-zsh/custom/custom.zsh\""
alias zshreload=". ~/.zshrc"
alias dd="rm -rf \"$HOME/Library/Developer/Xcode/DerivedData\""
alias ddo="open \"$HOME/Library/Developer/Xcode/DerivedData\""

mc() {
  mkdir "$@"
  cd "$@"
}

--

ZSH Git Cheat Sheet

ZSH shortcuts:

  • Ctrl + U = Clear
  • Ctrl + A = Go to start
  • Ctrl + E = Go to end
  • ⌥← = Back one word (option + left arrow)
  • ⌥→ = Forward one word (option + right arrow)

Add word jumping to iTerm2

Configure left ⌥ to act as +Esc then add Escape codes for ⌥← and ⌥→

word_jump_left word_jump_right

--

Set working directory.

Preferences → Profile → General → Working directory.... → Advanced Configuration

  • Working Directory for New Windows~/code
  • Working Directory for New Tabs → Reuse previous session's directory

--

General usage tip:

  • Store code in ~/code. Make Alias on desktop so it's easy to reach via Finder.

--

Jump directly to a location in a path

  • Option + Click

--

History info

  • cat ~/.zsh_history
  • history

Clone this wiki locally