Terminal configuration under Mac (item2 + oh-my-zsh + solarized color scheme)

2018 Update:

In the process of using it, I found that although the theme of agnoster is beautiful, it is not very user-friendly in the actual use process. Personally, the ys theme is more suitable for me.

Change the theme:

1

ZSH_THEME="ys"

 

1. I recently reinstalled the system, so I reconfigured the terminal to make it more in line with user habits.

The effect is as follows:

It has functions such as syntax highlighting, command line tab completion, automatic prompting, and Git repository status display.

 

Install

First of all, the iTem2 software we downloaded is more powerful than the terminal that comes with Mac.  Download and install directly from the official website  http://iterm2.com/ .

configure

Set iTem2 as default terminal:

(Menu bar) iTerm2 -> Make iTerm2 Default Term

Then open the preferences, select Keys, check Show/hide iTerm2 with a system-wide hotkey under Hotkey, and set the hotkey to command+., so that you can open or close the iTerm2 window through the command+. global hotkey, Very convenient.

 

coloring scheme

    I chose  solarized , and the effect is not bad. Click on the official website, download, unzip, then open the preferences under iTerm2, click the colors option under profiles, click the Color Presets option in the lower right corner, select import, and import Solarized Dark.itermcolors under the unzipped solarized file .

install oh-my-zsh

github connection: https://github.com/robbyrussell/oh-my-zsh

Install with crul:

1

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

or use wget:

1

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

theme

After the installation is successful, open the hidden file .zshrc with vim, and modify the theme to agnoster:

1

ZSH_THEME="agnoster"

Applying this theme requires special font support, otherwise there will be garbled characters, then we configure the font:

1. Use the  Meslo  font, click the link and click view raw to download the font.

2. Install the fonts to the system font book.

3. Apply the font to iTerm2, I like to set the font size to 14px, which looks comfortable (iTerm -> Preferences -> Profiles -> Text -> Change Font).

4. Re-open the iTerm2 window, and then you can see the effect.

At this point, our terminal looks very good. At this time, we will install other plug-ins to make the terminal look more coquettish.

 

auto prompt command

When we enter commands, the terminal will automatically prompt you for the commands that you may want to enter next. At this time, you can press → to output these commands, which is very convenient.

The settings are as follows:

1. Clone the repository to the local ~/.oh-my-zsh/custom/plugins path

1

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

2. Open the .zshrc file with vim, find the plugin setting command, the default is plugins=(git) , we will change it to

1

plugins=(zsh-autosuggestions git)

3. Reopen the terminal window.

PS: You may not see the change when you reopen the terminal, maybe your font color is too light, let's make it brighter:

Move to ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions path

1

cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

Open the zsh-autosuggestions.zsh file with vim and change ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' (fg=10 works fine on my computer).

 

syntax highlighting

1. Install using homebrew zsh-syntax-highlighting 插件。

1

brew install zsh-syntax-highlighting

2. Configure the .zshrc file and insert a line.

1

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

3. Enter the command.

1

source ~/.zshrc

PS: Install the homebrew package management tool:

1

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    

*Open the terminal window at this time, your terminal will look as beautiful as mine~

*use it and enjoy it~

 

ps :

    This article is reproduced, just for my own record

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325215681&siteId=291194637
Recommended