Tao He

Tao He

  • Docs
  • API
  • Help
  • Blog

›Recent Posts

Recent Posts

  • Microsoft PowerPoint
  • Chrome
  • Alfred
  • Docusaurus
  • Git Commands

Zsh

November 15, 2013

{% include JB/setup %}

zsh

macOS

brew options zsh
brew install zsh --with-gdbm --with-pcre --with-unicode9
brew install zsh-completions
chsh -s $(which zsh)

If encountered this error:

chsh: /usr/local/bin/zsh: non-standard shell

Add /usr/local/bin/zsh to /etc/shells

Ubuntu

sudo apt-get install zsh
chsh -s $(which zsh)

Operations

Exit zsh, but leave running jobs open?

Weird “jobs” behavior within zsh

oh-my-zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Edit your new .zshrc file your home directory. You can select themes and plugins for usage in zsh. For a complete list of themes and plugins, look in the .oh-my-zsh folder in your home directory. This was installed with zsh. There is a themes folder here and a plugins folder.

To add new plugins, find this line in .zshrc:

plugins=(git)

I like plugins, so this is my setup:

plugins=(autojump git git-extras git-flow git-flow-avh git-hubflow git-prompt git-remote-branch gitfast github gitignore svn svn-fast-info cp brew tmux history history-substring-search terminalapp brew nanoc osx xcode zsh-syntax-highlighting)

Optionally set DEFAULT_USER in ~/.zshrc to your regular username to hide the user@hostname info when you’re logged in as yourself on your local machine. For example

DEFAULT_USER=taohe

If use brew, modify PATH

Put /usr/local/bin before /usr/bin

Put /usr/local/sbin before /usr/sbin

How to get an awesome looking terminal on mac os x

No, Really. Use Zsh.

zsh-completions

git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions

Enable it in ~/.zshrc by adding it to your plugin list and reloading the completion:

plugins=(… zsh-completions)

# zsh-completions
autoload -U compinit && compinit

zsh plugins

Method 1, install in oh-my-zsh (recommended)

cd ZSH/custom/plugins
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
Activate the plugin in ~/.zshrc (in last position):
plugins=( [plugins...] zsh-syntax-highlighting)
source ~/.zshrc

Method 2, install in zsh

brew install zsh-syntax-highlighting
brew install zsh-history-substring-search
more "/usr/local/opt/zsh-history-substring-search/README.md"
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/opt/zsh-history-substring-search/zsh-history-substring-search.zsh
source ~/.zshrc

themes

Themes

set ZSH_THEME in ~/.zshrc to "agnoster".

agnoster theme shows git icons but needs patched font.

Make sure you have already downloaded powerline.

fontforge -script ~/.vim/bundle/powerline/font/fontpatcher.py /System/Library/Fonts/Menlo.ttc

If you prefer the old Monaco font, you should type

fontforge -script ~/.vim/bundle/powerline/font/fontpatcher.py /System/Library/Fonts/Monaco.dfont

For macOS, Fonts are located in '/Library/Fonts/' or '/System/Library/Fonts/'.

Menlo is the new default font in Mavericks.

OS X: Fonts included with Mavericks

After running this command, 'Monaco for Powerline.otf' or 'Menlo Regular for Powerline.otf' is generated. Install the font by double-clicking the font file in Finder and click “Install this font” from the preview window.

Font patching

Change iTerm fonts in

iTerm -> Preferences... -> Profiles -> (Select a profile) -> Text -> ChangeFont -> Menlo Regular for Powerline

Recent Posts
  • zsh
    • macOS
    • Ubuntu
  • Operations
  • oh-my-zsh
  • zsh-completions
  • zsh plugins
    • Method 1, install in oh-my-zsh (recommended)
    • Method 2, install in zsh
    • themes
Tao He
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2019 Your Name or Your Company Name