preface

Most of the time in the team, you can see friends using VScode terminals to manage code, because it is convenient to switch from one terminal to another, and even some friends directly type commands on MAC terminals. Don’t you think it is really a little difficult to use? Every time I look at these special obsessive-compulsive want to say: you use iTerm2 ah! Why wouldn’t you use it if it worked so well? You use! Use it!! But another way to think about it is if someone says to you: your blah blah blah is too low, you can use my blah blah blah. I would reject it outright, no matter how good it is or how good it smells. So I decided to write a brief introduction to my iTerm2 experience, hoping that in addition to attracting team members to use it, it can also help people in need.

Introduction to the

ITerm2 is a replacement for Terminal and a successor to iTerm. It works with macOS 10.14 or later. ITerm2 brings terminals into the modern world, bringing functionality you never knew you wanted.

ITerm2, iTerm2, iTerm2, iTerm2, iTerm2, iTerm2

The installation

  1. Installation package installation
  2. Command line installation

Installation package installation

Personally, I still recommend the installation package installation, directly enter the official website link, download directly install

Command line installation

It is also possible to install Homebrew directly, but it is not recommended to install BREW and configure CASK first.

$ brew cask install iterm2
Copy the code

After the installation of the appearance is also very plain, and MAC terminal feel no difference 🙂.

So how do you turn iTerm2 into something you like? Then it’s time for plugins.

Configuration iTerm

oh-my-zsh

Install oh-my-zsh first.

/ / curl way sh -c "$(curl - fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"/sh/wget way - c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh - O -) "# ps: sometimes bad network installation will fail, try a few times more is OK.Copy the code

\

After installing oH-my-Zsh

The feeling is still rather monotonous, to make iTerm2 more beautiful we can change some themes to configure our favorite colors and styles

Open “iTerm2 –> Preferences –> Profiles –> Colors –> Color Preferences”

Here iTerm2 comes with several themes, but the overall feeling is not very good, there are many good themes on the web, we can configure a look at,

Configure the iTerm2 theme

Here are some of the themes iTerm2 comes with, some of which I think are pretty cute. Choose one you like and start configuring it.

Theme / / https://github.com/ohmyzsh/ohmyzsh/wiki/themesCopy the code

These themes can also be viewed using a command line, but not as intuitively as a web page.

// Enter CD ~/. Oh -my-zsh/themes && ls directly on the terminalCopy the code

Zsh-theme (apple), cloud.zsh-theme (cloud),

Just type the following command in iTerm2

vim ~/.zshrc
Copy the code

Then press the “I” key to enter the editing mode, change the default theme: “Robbyrussell” to “Apple”, the small apple theme we want to change

Finally, press Esc to enter editing mode, enter :wq to exit and save the configuration. Finally, remember to source

source ~/.zshrc
Copy the code

The alternate theme is displayed

The configuration is complete at this topic.

The default topic library for iTerm2

These theme libraries are iTerm2’s own default, overall feel…. How to say, the feeling is general, always feel and own ideal bad some. ITerm2 also supports importing its own Color Preset library

Then I found that since there are a lot of big guys write their own library online, so I tried, the result is…… God, it smells good.

\

Here is a list of my favorite themes to share with you. If the aesthetic differences are large, you can find them by yourself.

https://github.com/mbadolato/iTerm2-Color-Schemes
Copy the code

Open the link and choose your preferred method to download the project locally

Once you’ve downloaded it, go to screenshots and Schemes in your project

So if we go to ScreenShots we can see a lot of different colors,

And then the themes in screenshots for these color schemes are in the Schemes folder and we start importing them

Click “Import” to Open the Import window, go to the Schemes folder, “Ctrl + A” select all and “Open” Import all

After the import is completed, we will find that we have many more themes, we just need to choose one we like, for example, I like “AYu”.

Here the theme configuration is OK, but if you are not satisfied, then I say again now in the use of a theme, is now more popular online

Compare powerLevel9k at 🔥

/ / powerlevel9k making address https://github.com/Powerlevel9k/powerlevel9kCopy the code

The configuration procedure is as follows:

1, open the “~/. Oh-my-zsh /custom/themes” file in iTerm2

cd ~/.oh-my-zsh/custom/themes
Copy the code

2, then clone the project into “~/. Oh-my-zsh /custom/themes” file and look at it later

Locate the theme file “PowerLevel9k.zsh-theme” and start the configuration

vim ~/.zshrc
Copy the code

Remember to source after saving

source ~/.zshrc
Copy the code

Do you suddenly feel superior? Ha ha 😄 😄 😄 😄

Does it feel perfect at this point? The answer is definitely no. As the old saying goes, there is no best but better. With this in mind, I continued to explore, not to mention, there are really interesting things.

I found some more configurations in the PowerLevel9k documentation, so let’s move on.

https://github.com/Powerlevel9k/powerlevel9k#prompt-customization
Copy the code

This configuration description is mainly a configuration of the left and right sides of the iTerm2 panel

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(OS-icon dir_writable Context dir VCS VI_mode POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time ip)Copy the code

Let’s change the default file and configure it to the ~/.zshrc file to see the effect

After configuration, you still need source

source ~/.zshrc
Copy the code

Let’s see how it looks before and after

Do you feel like you’re getting to like it? So like what according to the document to configure their own look at it, hard work after the harvest of good often can give their great satisfaction. Try it yourself.

Here to share a small partners my own configuration, I hope you like.

# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir_writable host dir VCS) # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status date os_icon battery)Copy the code

Finally, how could iTerm2 not be accompanied by a little sister or favorite cartoon? The background pops up

Setting the background image

Open iTerm2 –> Preferences –> Profiles –> Window check ☑️ Enabled and select a background image you like

Choose finished to see the effect

Multi-screen display (Multi-screen shortcut: Ctrl + Shift + D or Ctrl + D)