Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up iTerm2 personalized terminal

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to set up the iTerm2 personalized terminal, I believe that many inexperienced people do not know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

ITerm2 color matching settings set terminal and ls color matching

Terminal input command vim ~ / .bash_profile

Add the following export

Export CLICOLOR=1 export LSCOLORS=gxfxcxdxbxegedabagacad export PS1='\ [\ 033 [01bot 32m\]\ u@\ h\ [\ 033 [00m\]:\ [\ 033 [01bot 36m\]\ w\ [\ 033 [00m\]\ $'export TERM=xterm-256color

Note: if you are installing Oh my zsh, you don't have to set it up as above.

Set vim color matching

Terminal input command vim .vimrc

The settings are as follows

Syntax on set number set ruler sets color theme

Download the theme from Iterm2-color-schemes (https://iterm2colorschemes.com/) iTerm2- > Preferences- > Profiles- > Color Select Color Presets- > import to the downloaded theme directory under the schemes directory and select the theme you want to import, and don't forget to set it to the theme you want after import. If there are many themes in it, I recommend a theme Solarized Dark Higher Contrast if there are barriers to choice.

ITerm2 function setup and extension installation Oh my zsh

There are two common ways to install. You can use curl or wget, and if it is macOS, you can install it using brew, as follows:

Sh-c "$(curl-fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Sh-c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh-O -)"

After installation, you need to set Zsh as the current user's default Shell (so that you will use Zsh when you create a new tag): chsh-s / bin/zsh, and then we edit the vim ~ / .zshrc file to change the theme configuration to ZSH_THEME= "agnoster".

Install the highlight plug-in

Execute the following command

Cd / .oh-my-zsh/custom/plugins/

Git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

If macOS can also be installed using brew install zsh-syntax-highlighting method. After downloading, set up, edit the vim ~ / .zshrc file, and install the plug-in as shown in the figure.

Be sure to make sure the plug-in order, zsh-syntax-highlighting must be in the last one. Then add the following to the last line of the file:

Source ~ / .oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If macOS is installed in brew mode, you can set it this way

Source / usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

Click the esc call-up vi command, type: wq to save and exit vi mode, and then execute the command source ~ / .zshrc to make the configuration effective.

Automatic recommended filling

This function is very practical and makes it easy for us to type commands quickly.

In the configuration step, 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 the vim ~ / .zshrc file to find the plugins configuration and add the zsh-autosuggestions plug-in. The configuration is the same as installing the highlighted plug-in. Note that the order zsh-syntax-highlighting must be the last, and the space bar is used between the plug-ins, as shown below:

Note: there are many plug-ins, too many plug-ins will slow down the efficiency of the tool, please install and use reasonably.

ITerm2 hides username and hostname

Sometimes our user name and host name are too long, such as my ville@villedeMacBook-Pro, the terminal display will be very ugly, we can remove it manually. Edit vim ~ / .zshrc file to add DEFAULT_USER= "ville" configuration

ITerm2 shortcut command

Shortcut command description:

Command description command + t new label command + w close label command + digital command + left and right key switch label command + enter switch full-screen command + f find command + d vertical split screen command + shift + d horizontal split command + option + direction key command + [or command +] switch screen command + View history command command + shift + h view clipboard history ctrl + u clear the current line ctrl + l clear screen ctrl + a to the beginning of the line ctrl + e to the end of the line ctrl + fash b forward and backward one command on ctrl + p ctrl + r search command history

Note: if some commands cannot be used in the previous configuration under bash, add a sentence source ~ / .bash_profile in the vim ~ / .zshrc file

After reading the above, have you mastered the method of how to set up the iTerm2 personalized terminal? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report