Engaged for a period of time, stepped on a lot of pits, and finally completed Iterm 2 and oh my zsh, the process twists and turns, in fact, still want to find good information, was a lot of information pit to ....
Objective
Many people recommend using ZSH, today with, with Oh-my-zsh, custom strong, better with more cool. It is worth your time to transfer from bash to zsh, although the process encountered a lot of problems, but everything is worth it, here is a guide to avoid the pit.
First
First of all to install ZSH, General Mac computer has been installed, but have to look at
Zsh
You will see zsh-newuser-installand the Novice guide will help you with some of the most basic configurations. I recommend skipping directly, zsh configuration files can be copied from the Oh-my-zsh, there is no need to create their own, and have no experience and do not know how to configure.
Bash is generally used on Mac computers, and installation of zsh is not possible with homebrew (no homebrew command please Google fix):
Brew Install Zsh
When the installation is complete, set the ZSH as the system default shell instead of bash. Open with editor /etc/shells
, add at the end /usr/local/bin/zsh
, save close. Execute the following command in the terminal:
Chsh-s $ (which zsh)
If you want to convert to bash later, just change the zsh to bash and restart.
After reboot, the shell defaults to zsh, the first step is completed
Second
Install Oh-my-zsh, at this time the zsh is still the most initial appearance, we want to turn it into a powerful terminal, need to configure it, in order to let zsh produce like above image effect, we need to install oh-my-zsh.
The oh-my-zsh is available in two mounting modes and is recommended for automatic mode, in the terminal input
Curl-l http://install.ohmyz.sh | Sh
If you have wget, you can use it
wget--no-check-certificate Http://install.ohmyz.sh-O-| Sh
In general, the OH-MY-ZSH has been installed
Third
The ZSH is configured, this full pit, the zsh configuration is almost all ~/.zshrc
below, and open with the nano or VIM command, because it is a hidden file, the command should be like this
Vim. ZSHRC
The Nano is the same, but because of inexperience, this pit is prone to suspicion of life, in general,. ZSHRC already have, but sometimes also do not want to create their own, this is really pit Father fighter Ah! After my hard labor search, finally found a way, that is, the copy above, execute the following command:
CP ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.ZSHRC
Using the oh-my-zsh template file, you can then modify the. zshrc file to customize your favorite themes and features
In the presence of a ~/.oh-my-zsh/themes
wide variety of theme files, the look of each theme can be viewed through this URL, after selecting the style, in .zshrc
the Zsh_theme set to your chosen theme. Restart ITerm2 and you will see the corresponding effect. It is recommended to use Agnosterfor better looking.
But this is only a semi-finished product, want to achieve the above effect need to do some more effort
Fourth
Add, 1, install powerline
In the official website has the tutorial, we only need the Executive network first installs the instruction to be OK, if your terminal can perform the PIP instruction normally, then executes the following instruction directly to complete the installation
Pip Install Powerline-status
If not, perform the install PIP command first
sudo easy_install pip
2, after download font https://github.com/powerline/fonts
(1), download the project after the CD to the install.sh
directory where the files, (2), execute instructions to install the font library, execute ./install.sh
instructions to install all powerline fonts
Prompts all fonts to be downloaded to the path after installation is complete /Users/superdanny/Library/Fonts
3, then set the font of ITERM2
After installing the font library, the Iterm 2 in the settings in the Profile
Text
tab Regular Font
and Non-ASCII Font
the font are set to powerline font, I set the font here is 12pt meslo LG S DZ Regular for Powerline
4. Finally make some color matching
Download color scheme https://github.com/altercation/solarized
solarized/iterm2-colors-solarized
You can import the configuration file into the ITerm2 by double-clicking on the project you just downloaded Solarized Dark.itermcolors
and Solarized Light.itermcolors
two files, then select the color scheme you just installed in the load presets.
Export zsh_theme= "Agnoster" default_user= "Sasuke6"
You can set default_user in. ZSHRC to alleviate the bloat of the header names.
After some kung fu, your iterm moment different from other people, geek style, if you want to further set up, you can refer to the following links
Https://wiki.archlinux.org/index.php/Zsh_ (%e7%ae%80%e4%bd%93%e4%b8%ad%e6%96%87) #.zshrc. e6.96.87.e4.bb.b6.e5.ae.9e.e4.be.8b
The configuration scheme is rich enough, interested students can also try more
ITerm 2 with oh-my-zsh, customize your terminal.