The terminal that comes with Mac OS--iTerm2

1. Statement highlighting The
effect is as shown in the screenshot above. Special commands and error commands will be highlighted.

Install using Homebrew:

$ brew install zsh-syntax-highlighting
After the successful installation, edit the vim ~/.zshrc file and add the following configuration in the last line:

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
The terminal that comes with Mac OS-iTerm2
2. Automatic suggestion filling
This function is very practical and can facilitate us to quickly type commands.

Configuration steps, first clone the zsh-autosuggestions project to the specified directory:

$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
then edit vim ~/.zshrc file, find the plugin configuration, add zsh- autosuggestions plugin.

Mac OS's own terminal-iTerm2
Note: The above statement is highlighted. If the configuration does not take effect, configure in the plugins and try adding the zsh-syntax-highlighting plugin.

Sometimes because the color of auto-fill is very similar to the background color, so that auto-fill has no effect, we can manually change the color configuration of auto-fill. The color value I modified is: 586e75, example:

Mac OS's own terminal-iTerm2
effect:

The terminal that comes with Mac OS-iTerm2
3. Left and right keys to jump
Mainly press option + → or ← to switch between the beginning and the end of the command. It was originally ineffective and needs to be opened manually.

Open iTerm2, press Command +, to open the Preferences configuration interface, then Profiles → Keys → Load Preset… → Natural Text Editing, and that's it.

  1. iTerm2 quickly hide and show
    This function is also very useful, that is, through the shortcut keys, you can quickly hide and open iTerm2, sample configuration (Commond + .):

The terminal that comes with Mac OS – iTerm2
5. iTerm2 hides the username and hostname.
Sometimes our username and hostname are too long, such as my xishuai@xishuaideMacBook-Pro, the terminal will not look good when displayed (see the picture above) To), we can remove it manually.

Edit the vim ~/.zshrc file and add DEFAULT_USER="xishuai" configuration, example:

The terminal that comes with Mac OS-iTerm2,
we can use the whoami command to view the current user and the effect (in addition to the split screen effect):

The terminal that comes with Mac OS – iTerm2
6. iTerm2 configuration proxy
Edit ~ vim ~/.zshrc, add the following configuration (shadowsocks used):

proxy list

alias proxy='export all_proxy=socks5://127.0.0.1:1086'
alias unproxy='unset all_proxy'
iTerm2 needs to create a new tab to have an effect:

$ proxy
$ curl ip.cn
Current IP: 185.225.14.5 From: United States

$ unproxy
$ curl ip.cn
Current IP: 115.236.186.130 From: Hangzhou Telecom, Zhejiang Province
We can test:

$ curl https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64

Directory listing for /yum/repos/kubernetes-el7-x86_64/

Index of /yum/repos/kubernetes-el7-x86_64/

repodata

Guess you like

Origin blog.csdn.net/u014306892/article/details/111843113