Updated in 2018:
In the process of use, I found that although the theme of Agnoster is beautiful, it is not very friendly to users in the actual use. Personally, YS theme is more suitable for me.
Change theme:
?
1 | ZSH_THEME= "ys" |
The system was recently reinstalled, so the terminal was reconfigured to make it more user-friendly.
The effect is as follows:
Have syntax highlighting, command line TAB completion, automatic prompt, display Git repository status and other functions.
The installation
First, we downloaded iTem2, which is more powerful than the Mac terminal. Download and install iterm2.com from iterm2.com.
configuration
Set iTem2 as the default terminal:
ITerm2 -> Make iTerm2 Default Term
Then open preference, select Keys, select Show/hide iTerm2 with a system-wide Hotkey, and set the Hotkey to Command +., so that you can use command+. Global hotkeys to open or close the iTerm2 window, very handy.
The color scheme
I used solarized, and it worked pretty well. Click on the official website, download, unzip, and open preference under iTerm2, click on colors under Profiles, click on Color Presets in the lower right corner, and select Import. Import solarized Dark. Itermcolors from the extracted solarized file.
Oh – my – ZSH installation
Github Connection: github.com/robbyrussel…
Install with CRUL:
?
1 | sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" |
Or use wget:
?
1 | sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" |
The theme
After the installation is successful, open the hidden.zshrc file with vim and change the theme to agnoster:
?
1 | ZSH_THEME= "agnoster" |
To apply this theme, you need special font support. Otherwise, garbled characters will appear.
1. Using the Meslo font, open the link and click View Raw to download the font.
2. Install fonts to the system font book.
3. Apply the Font to iTerm2. I personally like to set the Font size to 14px and look comfortable (iTerm -> Preferences -> Profiles -> Text -> Change Font).
4. Open the iTerm2 window again and you can see the effect.
At this point our terminal looks pretty good, now let’s install other plug-ins to make the terminal look more elegant.
Autoprompt command
When we input commands, the terminal will automatically prompt you to enter the next command, then press → can output these commands, very convenient.
The Settings are as follows:
1. Clone the repository to the ~/. Oh-my-zsh /custom/plugins directory
?
1 | git clone git: //github .com /zsh-users/zsh-autosuggestions $ZSH_CUSTOM /plugins/zsh-autosuggestions |
2. Use vim to open the.zshrc file and find plugins=(git)
?
1 | plugins=(zsh-autosuggestions git) |
3. Open the terminal window again.
PS: When you open the terminal again, you may not see the change, maybe your font color is too light, let’s make it lighter:
Move to the ~/. Oh-my-zsh /custom/plugins/zsh-autosuggestions path
?
1 | cd ~/.oh-my-zsh /custom/plugins/zsh-autosuggestions |
ZSH file with vim and modify ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=’fg=10′ (fg=10 looks good on my computer).
Syntax highlighting
1. Install zsh-syntax-highlighting plug-ins using Homebrew.
?
1 | brew install zsh-syntax-highlighting |
2. Configure the. ZSHRC file and insert a line.
?
1 | source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting .zsh |
3. Enter the command.
?
1 | source ~/.zshrc |
PS: Install the Homebrew package management tool:
?
1 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
* At this time open the terminal window, your terminal looks as beautiful as mine ~
*use it and enjoy it~