This article is launched on the wechat public account “AndroidTraveler”.

background

I work with MAC and often use the command line. Therefore, I have found some useful software and GitHub tools besides The Terminal provided by Apple, and I would like to share them with you. Hope can improve everybody’s development efficiency.

iTerm

Why it’s cool: Split screen

The four screens are as follows:

If the default Terminal is used, the split screen is not supported and four separate Windows need to be opened.

In addition, because of the shortcut keys to close Windows sometimes accidentally close all Windows. So I looked for the shortcut key configuration and found a funny thing.

Path Settings are shown below:

What’s so special about using this shortcut to open a global hover window? What’s special is that when you close the terminal, you open it again and start again, but the suspension window always seems to be there. Even if you exit iTerm and enter it again, it will remain the same. It will not reset. Leave it where you left it last time.

zsh

This is a tool found on GitHub. It was originally intended to change the theme, so that the terminal is not too boring, but after installing it, it turns out that the theme is not so simple. So, what can we do to improve our productivity?

Making a link

Github.com/ohmyzsh/ohm…

Installation method

GitHub installation method actually said very clear, you can directly go to see, the simplest is to directly run the following command:

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

Warm prompt

Some users who are not familiar with the terminal may find that some of the previous commands, such as ADB, cannot be used after installing ZSH.

First, execute the following command:

vi ~/.zshrc
Copy the code

Open the ZSH configuration file and add the following command to the end of the file:

source ~/.bash_profile
Copy the code

Run the following command to make the changes take effect.

source ~/.zshrc
Copy the code

ZSH advantages

To illustrate the advantages of ZSH, we compare the iTerm(ZSH) display with the Terminal (bash) display of Android Studio.

In addition, ZSH here uses the default theme of Robbyrussell.

The main difference is the display, let’s take a look:

You can see that the iTerm display is a little cleaner.

So what happens to the LLL if we execute commands that don’t exist?

You can see that the command does not exist, but the arrow on the left of iTerm turns red, indicating that the command failed to execute.

Now, for Git repository display, let’s switch to one of my open source libraries.

The comparison is obvious, as ZSH first shows that this is a Git repository, along with the branch name of the current repository.

This can greatly improve our efficiency.

Because sometimes if we don’t know the branch of the current repository, we have to run the command to know what the branch of the current repository is. But ZSH doesn’t, you can see it directly. And it keeps us from doing the wrong branch.

We then execute the ls command to see the difference.

You can see that bash is white for both normal binaries, directory files, and files with executable permissions.

ZSH normal binaries are white, files with executable permissions are red, and directories are cyan.

So we don’t need to run the command to know exactly what files are under the directory.

So in a nutshell, ZSH is more efficient than bash at showing the above changes and less likely to have to run commands to get this information.

AndroidStudio terminal Settings

After that, the Terminal on the newly opened Android Studio is ZSH’s.

ZSH summary

ZSH is used for a while and always for a while.

Finally, I wish you all a happy 2020 Spring Festival ~