This is the 11th day of my participation in the August More Text Challenge. For details, see:August is more challenging

preface

Above all, this article is mainly for macOS users, if you use Windows or Linux computer, it may not be suitable for you. Of course, if you just want to learn something new, then welcome!

Most of us think of terminals (or consoles in Windows) as black with a few white words. If you still think so, then you are Out, now, our terminal can also be transformed into a cool and fashionable look, like the following picture, then how to change? Check it out.

iTerm2

MacOS’s own terminals were ugly and difficult to use, but they were wise enough to find a tool on the Internet that could completely replace native terminals – iTerm2.

First install iTerm2, go to the official website to download, and then directly decompress and drag it into the Application is done, then let’s first take a look at its original skin!

Seems to be very ugly, why, not said iTerm2 is very cool, is not the same ugly not pull ji??

Don’t panic! The dishes are coming up!

Oh My Zsh

All right, the main character is here!

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

It is an open source, community-driven framework for managing ZSH configurations! All right, let’s do it!

The installation

The website provides the following two automatic installation methods:

  1. throughcurlThe way of
# via curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Copy the code
  1. throughwgetThe way of
# via wget
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Copy the code

However due to some unknown reasons, through the above two methods are generally not successful installation, that how to do?

If you can’t do it automatically, you can do it manually.

  1. downloadoh-my-zshThe source code.
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
Copy the code
  1. Copy the configuration file to the root directory.
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
Copy the code
  1. Make the configuration file effective.
source ~/.zshrc
Copy the code

Okay, that’s when the interface should change!

.zshrc

This file is the configuration file of oH-my-zsh. It is located in the root directory. You can generally run the following command to view or edit it.

vim ~/.zshrc
Copy the code

To make the Lima configuration take effect after each modification, run the following command:

source ~/.zshrc
Copy the code

Modify the color

Open the configuration file.zshrc to see the configuration for the color scheme:

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="agnoster"
Copy the code

For color matching, you can go to the theme market to choose, but here is a recommended theme for yourself: PowerLevel10k;

Run the following command to install, then open the configuration file.zsrch and set the theme to PowerLevel10k;

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Copy the code
ZSH_THEME="powerlevel10k/powerlevel10k"
Copy the code

MesloLGS NF: iTerm2->Preferences->Profiles->Text MesloLGS NF: iTerm2->Preferences->Profiles->Text

Then restart iTerm2 and enter p10k configure to configure the theme as you like.

  1. Does this symbol look like a diamond (rotating square)?
  2. Does this symbol look like a lock?
  3. Does this symbol look like the Debian logo?
  4. Are all of these ICONS crossed between the X’s?
  5. style
  6. coding
  7. Show time or not
  8. Directory level separator
  9. Head (left)
  10. Tail (right)
  11. Whether a newline
  12. Whether there is a connection line between the left and right
  13. The command line and prompt are connected
  14. Sparse or loose distribution between two lines of commands
  15. Do I need an icon?

Common Plugins

To make our terminal more useful, it is recommended to install the following plug-ins;

  1. Git: Built-in plug-in, enabled by default

It allows you to use very useful Git commands to improve development efficiency:

Before using plug-ins After using the plug-in
git add --all gaa
git branch -D gbD
git commit -a -m gcam
git checkout -b gcb
git checkout master gcm

The above table shows only partial configurations. If you want to see all the configurations, you can use the following command to view them:

vim ~/.oh-my-zsh/plugins/git/git.plugin.zsh
Copy the code
  1. Autojump: Automatically jumps to the corresponding directory

This plugin will record all your access records, different separate configuration, direct access can be installed as follows:

brew install autojump
Copy the code

Then add the following configuration to the.zshrc configuration file:

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
Copy the code

If I want to jump to /home/cunyu/code, I just need to use the following command, but only if you have previously visited the code directory.

j code
Copy the code
  1. ZSH -autosuggestions: Command suggestions

The plugin prompts you when you type a command and completes it automatically;

The installation command is as follows:

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

Add the following configuration to the.zshrc configuration file.

plugins=(zsh-autosuggestions git)
Copy the code
  1. ZSH — syntax highlighting: highlighting

The plug-in commands are automatically highlighted;

The installation command is as follows:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
Copy the code
  1. Extract: One-click decompress

Tar, gz, zip, and rar packages can be decompressed using the extract command. The alias is x.

X Compressed package nameCopy the code

conclusion

Well, that’s all for today’s article. ITerm2: iTerm2 + Oh My Zsh: iTerm2 + Oh My Zsh: iTerm2 + Oh My Zsh: iTerm2 + Oh My Zsh

Finally, originality is not easy, if you think my article is helpful to you, then like a wave of attention!