Mac OS Terminal tool ITERM2 configuration Daquan

Source: Internet
Author: User
Tags git clone brew cask

have been using the Mac OS comes with the terminal, although some inconvenient, but overall is acceptable, is to have the idea of changing a terminal, and then happened to see a terminal weapon iTerm2, found that really very powerful, but also very easy to use, according to the online configuration of the theme or something, or some pit, This way, it is recorded for later inspection.

1. Installing ITerm2

: https://www.iterm2.com/downloads.html

Download is a compressed file, after the decompression is executed program files, you can directly double-click, or directly drag it to the applications directory.

Or you can install it directly using the Homebrew:

$ brew cask install iterm2
2. Configuring the ITerm2 Theme

The most common theme for ITerm2 is solarized Dark theme,:http://ethanschoonover.com/solarized

Download is a compressed file, you first unzip, then open ITerm2, press the Command + , key, open the Preferences configuration interface, and then Profiles -> Colors -> Color Presets -> Import , select just unzip the solarized->iterm2-colors-solarized->Solarized Dark.itermcolors file, import success, finally select Solarized Dark theme, you can.

3. Configure Oh My Zsh

Oh My Zsh is a further extension of the topic, Address: https://github.com/robbyrussell/oh-my-zsh

One-click Installation:

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

After installation, you need to set the ZSH as the default Shell for the current user (this will use Zsh when creating a new label):

$ chsh -s /bin/zsh

Then, we edit the vim ~/.zshrc file and change the theme configuration to ZSH_THEME="agnoster" .

Agnoster is one of the more commonly used zsh themes, you can pick the theme you like, zsh topic list: Https://github.com/robbyrussell/oh-my-zsh/wiki/themes

The effect is as follows (the declaration highlighting is configured):

4. Configuring Meslo Fonts

Use the above topic, need to meslo font support, otherwise there will be garbled situation, font: [https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG% 20M%20REGULAR%20FOR%20POWERLINE.TTF]

Once downloaded, install it directly in Mac OS.

Then open the ITerm2, press Command + , the key, open the Preferences configuration interface, and then Profiles -> Text -> Font -> Chanage Font Select the Meslo LG M Regular for Powerline font.

Of course, if you think the default 12px font size is inappropriate, you can modify it yourself.

5. Declaration highlighting

The effect is as above, with special commands and error commands that are highlighted.
Install the download under this path cd ~/.oh-my-zsh/custom/plugins

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

This plugin is then activated by the

pluginsthe name of the add-on plugin found in

plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

The last of course is source, let the change take effect

source ~/.zshrc
6. Auto Suggest fill

This function is very practical, it is convenient for us to knock the command quickly.

To configure the 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 the file, find plugins the configuration, add the zsh-autosuggestions plugin.

The last of course is source, let the change take effect

source ~/.zshrc

Note: The above statement highlighting, if the configuration does not take effect, in the plugins configuration, and then add zsh-syntax-highlighting plug-ins to try.

Sometimes, because the auto-fill color is similar to the background color so that autofill doesn't work, we can manually change the color configuration under Auto-fill, and the color value I modified is: 586e75, example:

Effect:

7. ITerm2 Quick Hide and show

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

8. ITerm2 hidden user name and host name

Sometimes our user name and hostname is too long, such as my [email protected], terminal display will be very difficult to see (the picture above can be seen), we can manually remove.

It seems that you use ITEM2 + oh-my-zsh combination, if you use the theme is Agnoster, modify the method is to enter oh-my-zsh/themes/and then VI agnoster.zsh-theme, edit the theme configuration file, find the following code:

# Context: [email protected] (who am I and where am I)prompt_context() {  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then   # 修改如下代码,@Mac可以你自己定义   # prompt_segment black default "%(!.%{%F{yellow}%}.)[email protected]%m"   prompt_segment black default "$"  fi}

Mac OS Terminal tool ITERM2 configuration Daquan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.