1. Introduction

Hello, I am Asong, today do not do knowledge sharing, to recommend a MAC terminal tool Iterm2. We usually do project development, can not do without the use of terminal, MAC itself with terminal interface is not particularly good-looking (manual dog head), so today to recommend this terminal tool, not only powerful, but also looks pleasing to the eye, do not talk nonsense, direct display.

How is it, it looks good!! Here’s how to install it.

2. Iterm2 installation

To install some software or plug-ins under MAC, I like to use brew command to install, is really convenient. If brew is not installed on the computer, first run the following command to install BREW and then proceed to the following operations.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Copy the code

The installation succeeds.

Next we install iterm2:

brew cask install iterm2
Copy the code

After the installation is successful, I need to modify the default shell. The default Mac shell type is bash and iterm2 corresponds to ZSH. Use the cat command to see which shells are available, and then switch.

cat /etc/shells
chsh -s /bin/zsh
Copy the code

Now we have iterm2 installed, but you will find that the interface is not the same as mine. Don’t panic, because you will need to install another plug-in to use with Oh My Zsh.

3. Oh My Zsh installation

Run the following command:

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

With that installed, let’s do some configuration:

vim ~/.zshrc
Copy the code

Run the preceding commands to modify the configuration file.

Modify the red line in the screenshot. We can also configure the declaration highlighting effect, but we need to install it first:

$ brew install zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Copy the code

Then add the following configuration to the configuration file:

The last two lines add the configuration as follows:

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

This completes the basic configuration. But we will find a problem, there is a garbled situation, because the theme does not support this font, so we need to download the font, configure. Meslo LG M Regular for Powerline.ttf You can download it at this address. I have downloaded it for you. You can follow my official account: Golang Dream Factory. Background reply: iterm2.

Download it and install it directly. Open the Iterm2 terminal, open the Preferences screen, and then click Profiles -> Text -> Font -> Chanage Font and select the Meslo LG M Regular for Powerline Font. Restart iterm2. Garbled characters are resolved.

Common Shortcut keys

Create a label: Command + T Close the label: Command + W Switch the label: Command + Digital Command + Left and right Arrow keys Switch the full screen: Command + Enter Search: Command + F Vertical split screen: Command + D Horizontal split screen: Command + Shift + D Switch screen: command + option + arrow keys Command + [or command +] View history command: command +; View the clipboard history: Command + Shift + h Clear the current line: CTRL + U to the beginning of the line: CTRL + A to the end of the line: CTRL + E Forward and Back: CTRL + F/B (equivalent to the left and right arrow keys) Previous command: CTRL + P Search the command history: CTRL + R Delete the current cursor character: CTRL + D Delete the character before the cursor: CTRL + H Delete the word before the cursor: CTRL + W Delete to the end of the text: CTRL + K Swap the text at the cursor: CTRL + T Clear the screen 1: Command + R Clear the screen 2: CTRL + L ⌘ + number Toggle directly to and fro between TAB tags to select Copy + Middle mouse button to Paste, ⌘ + f ⌘ searches will be automatically copied to + D horizontal split / ⌘ + shift + D vertical split + R = clear, and will only move to a new screen. ⌘ will not create an empty screen like clear, CTRL + U to clear the current line. Press ⌘ + after entering the lead command regardless of where the cursor is; ⌘ automatically lists the entered commands to the clipboard history. You can set the global shortcut to invoke iterm in Preferences > keys. This can also be implemented using AlfredCopy the code

Temporarily said these, there is a need to collect, easy to find yo ~ ~ ~

conclusion

Well, here is the installation, the use of such a sharp tool, development is not also changed more happy, convenient it.

To unlock more gameplay, you can go to the official website to research yourself. Portal: onmyzsh, iterm2

Welcome to the public account: Golang Dreamworks, to obtain the latest official Gin Chinese document in 2020, the author maintains it by himself, and updates it regularly. Welcome your valuable comments.