Make the Mac command line more rich and efficient
Install Brew
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Source:link
一 .Iterm2 Introduction
1. Installation
iterm2 is a completely free of order application for Mac OS users. Directly on the official websitehttp://iterm2.com/download and install.
2. Configuration
Set iterm as the default terminal
2. Install OH-My-Zsh
1. See how many shells are there in the system
cat /etc/shells
Huixian is this
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
Bash is the shell that comes with Terminal in MAC, and replace it with ZSH. This function is much more. Having functions such as high grammar, command line TAB complement, automatic prompts, displaying the git warehouse status and other functions.
Use the following command to set the default shell
chsh -s /bin/zsh
2. Install OH-My-Zsh
github address:https://github.com/robbyrussell/oh-my-zsh
Installation with crul:
sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”
3. Theme
After the installation is successful, use vim ~/.zshrc to open the hidden file and modify the theme of Agnoster
PS:zsh theme, refer to the topic connection to select your favorite theme.
ZSH_THEME=”agnoster”
Apply this theme requires special font support, otherwise it will be garbled. At this time, we will configure the font:
1. UseMesloFont, click the connection to click View RAW to download the font.
2. Install the font to the system font book.
3. Application fonts to ITERM2, setting my favorite font size, I set 14px (iterm-> preferences-> Profiles-> Text-> Change Font).
4. Set the color matching scheme
After setting up the theme through OH-My-Zsh, the background color that comes with ITERM2 is uncomfortable, and it is more beautiful to download other color schemes. I choose
solarized, the effect is not bad. Click on the official website, download, decompress, and then open the preference settings under ITERM2, click on the Colors option under the PROFILES, click on the Color Presets option in the lower right corner, select Import, import the unblocked solarized dark.itermcolors。After coloring VIM, this solarized will also be used
git clone git://github.com/seebi/dircolors-solarized.git
At this step, our terminal looks very good. At this time, we will install other plug -ins, making the terminal look more coquettish.
5. Automatically prompt command
When we enter the command, the terminal will automatically prompt you to enter the command that may be input next. At this time, you can output these commands, which is very convenient.
Settings are as follows:
1. Klong warehouse to local ~/.oh-my-zsh/custom/plugins path
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
2. Use vim ~/.zshrc to open the file and find the plug -in setting command. The default is plugins = (git). We modify it to
plugins=(zsh-autosuggestions git)
3. Open the terminal window again.
6. High grammar
1. Install Zsh-Syntax-Highlighting plug-in using Homebrew.
brew install zsh-syntax-highlighting
2. vim ~/.zshrc configuration file, insert a line, save exit.
source /usr/local/Cellar/zsh-syntax-highlighting/0.6.0/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
PS: The above path is the path of the Brew installation plug -in. The installation will be displayed successfully. Copy records.
3. Enter command.
source ~/.zshrc
PS: Install Homebrew Package Management Tool:
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
The display effect after installation is complete
3. color giving VIM in ITERM
Vim’s color matching is best to keep the same color as the terminal, otherwise the use of command line VIM in Terminal/Iterm2 will be awkward.
First download solarized, there are download methods and addresses above. Execute the following command
$ cd solarized
$ cd vim-colors-solarized/colors
$ mkdir -p ~/.vim/colors
$ cp solarized.vim ~/.vim/colors/
$ vi ~/.vimrc
Add the following three lines settings
syntax enable
set background=dark
colorscheme solarized
4. color matching for ITERM2 LS
1. Download and install coreutils
brew install coreutils
2. Create color configuration file
gdircolors –print-database > ~/.dir_colors
3. Enable color configuration file
sudo vim ~/.zshrc
Add as follows
if brew list | grep coreutils > /dev/null ; then PATH=”$(brew –prefix coreutils)/libexec/gnubin:$PATH” alias ls=’ls -F –show-control-chars –color=auto’ eval `gdircolors -b $HOME/.dir_colors` fi
Use
Multi -window use
⌘ (Command) + D horizontal flat shop
) (Command) + ⇧ (shift) + d longitudinal tank
) (Command) + ⇧ (shift) + i turn off