The Mac came with a terminal that wasn’t particularly easy to use and didn’t have a pretty interface. ITerm2 is a terminal tool that can extend themes, highlighting, autofill, split-screen and other effects in addition to regular terminal operations.

1. Download and install iTerm2 download address: www.iterm2.com/downloads.h…

Download and double-click to install, or use Homebrew to install

brew cask install iterm2
Copy the code

Note :Homebrew is a software package management tool based on Mac OS. It has many useful functions such as install, uninstall, update, view, search and so on. If you do not install Homebrew, you will need to install Homebrew first. Direct Google has a lot of articles

Two. Theme import and use

  1. ITerm2 common themes download address: ethanschoonover.com/solarized

  2. After downloading iTerm2, press Command +, to open the Preferences interface. Click on profiles to select colors and click on Color Presets in the lower right corner. Select Import and import solarized Dark. Itermcolors from the extracted solarized file

B: Oh My Zsh

Oh My Zsh is a further extension of the theme, download github.com/robbyrussel…

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

If git installation is required, run the preceding command again after git installation is complete

  1. Once installed, Zsh needs to be set as the default Shell for the current user
chsh -s /bin/zsh

Copy the code

If yes, run the command

sudo chsh -s /bin/zsh

Copy the code

Note: Sudo is a Linux system administration directive, a tool that allows system administrators to have ordinary users execute some or all of the root commands

  1. Modify the theme

Note that some people have reported that using themes after copying and pasting the command to iTerm2 can be very difficult

$ vim ~/.zshrc

Copy the code

Enter I to enter editing mode, ZSH_THEME=”agnoster”, change the theme to agnoster, press Esc to exit the editing mode, and enter :wq to save the configuration and exit

open ~/.zshrc

Copy the code

Open a text editor, type ZSH_THEME=”agnoster” and save

Github.com/robbyrussel… This is ZSH’s list of topics, you can pick your favorite topics,

Meslo font support is required if the above theme is garbled

Font download address: github.com/powerline/f…

After the download and installation is successful, press Commond + and open Preferences page Profiles->Text->Font->Chanage Font select Meslo LG M Regular for Powerline Font.

5. Font highlighting

  1. To use Homebrew installation, enter the command
brew install zsh-syntax-highlighting

Copy the code
  1. After successful installation, edit the vim ~/.zshrc file to addsource /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zshAfter saving
  2. The inputsource ~/.zshrcActivating profiles

Vi. Automatic filling similar to the development tool automatic code completion function. 1. Clone the Zsh-autoSuggestions project

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
Copy the code
  1. Use vim to edit. ZSHRC files or open them directly
$ vim ~/.zshrc

Copy the code

3. Enter source ~/.zsh/ ZSH -autosuggestions/ ZSH -autosuggestion. ZSH to save the file

source ~/.zshrc

Finally, we summarize some shortcut tags for iTerm2

Create a new label: Command + t

Close the tag: Command + w

Switch labels: Command + digit Command + left and right arrow keys

Switch to full screen: Command + Enter

Find: command + f

Split screen

Vertical split screen: Command + D

Horizontal split screen: Command + Shift + D

Switch screen: Command + option + arrow keys Command + [or Command +]

To view the history command: command +;

View the clipboard history: Command + shift + h

other

Clear the current line: CTRL + U

To the beginning of the line: CTRL + A

End of line: CTRL + E

Forward and Backward: CTRL + F/B (equivalent to left and right arrow keys)

Previous command: CTRL + P

Search command history: CTRL + R

Delete the current cursor character: CTRL + D

Delete the character before cursor: CTRL + H

Delete word before cursor: CTRL + W

Delete to the end of the text: CTRL + K

Swap text at the cursor: CTRL + T

Clear screen 1: Command + r

Clear screen 2: CTRL + L