The terminal has recently been reconfigured to make it look better.

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 choose 3024Night, you can configure your favorite theme, there are a lot of this in the official website, download iterm2colorschemes.com;

Oh – my – ZSH installation

Github Connection: github.com/robbyrussel…

Install with CRUL:

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

 

Or use wget:

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Copy the code

 

The theme

After the installation is successful, open the hidden.zshrc file with vim and change the theme to agnoster:

ZSH_THEME="agnoster"
Copy the code

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 16px 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

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Copy the code

2. Use vim to open the.zshrc file and find plugins=(git)

plugins=(zsh-autosuggestions git)
Copy the code

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:

cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions 
Copy the code
vim  zsh-autosuggestions.zsh
Copy the code

Modified ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=’fg=10′ (fg=10 looks good on my computer).

 

Syntax highlighting

1. Install zsh-syntax-highlighting plug-ins using Homebrew.

brew install zsh-syntax-highlighting
Copy the code

2. Configure the. ZSHRC file and insert a line.

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Copy the code

3. Enter the command.

source ~/.zshrc
Copy the code

4.ls

Mac OS X is based on FreeBSD, so some tools such as LS, top, etc. are BSD, ls is not GNU LS, so even if Terminal/iTerm2 is configured with color, the command ls will not be highlighted on the Mac. This can be resolved by installing coreutils

brew install coreutils
Copy the code

PS: Install the Homebrew package management tool:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code

Jimmy’s tech playground



(Creative Commons 4.0 License)