TL; DR

  • Install the ZSHbrew install zsh zsh-completions
  • Switch to the ZSH[sudo] chsh -s $(which zsh)
  • Oh – my – ZSH installationgit clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
  • Modify the theme~/.zshrcIn theZSH_THEME="ys"
  • Install autoJump, zsh-autoSuggestions, and zsh-syntax-highlighting plug-insbrew install autojump; git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions; git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
  • Don’t forget to~/.zshrcfindplugins=Add the following, and finally save the executionsource ~/.zshrc
plugins=(
  autojump
  zsh-autosuggestions
  zsh-syntax-highlighting
)
Copy the code

Oh – my – ZSH profile

The default Shell for Linux and OS X systems is bash. “Oh my ZSH” is a strengthened Shell.

Using the step

1. Install the ZSH

# LinuxSudo yum install ZSH (Fedora, RedHat, SUSE) or sudo apt-get install ZSH (Debian series, Ubuntu)MacOS comes with ZSH, which is usually not the latest version. If you need the latest version, you can install it using Homebrew (confirm Homebrew is installed).
brew install zsh zsh-completions

You can also use MacPorts.
sudo port install zsh zsh-completions
Copy the code

2. Change the default shell

#Setting ZSH as the default shell does not work if ZSH is not in the shell list or if you do not have the CHSH permissionEcho $SHELL [sudo] CHSH -s $(which ZSH) or CHSH -s /bin/zshCopy the code

3. Install oh My ZSH

ZSH is not installed! ZSH is not installed! Please install zsh first!
Method 1: Install wget or curl on your website. Wget, used to download the file from the specified URL. Curl, make a network request, and then get and extract the data.
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# Method 2: Of course, you can also download git, I think git is the most friendly haha
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
Copy the code

4. Configure topics

The default configuration file for # oh-my-zsh is at: ~/.zshrc. Edit ~ /. ZSHRC modify the theme, here I am using ys theme, more subjects to see [here] (https://github.com/robbyrussell/oh-my-zsh/wiki/Themes), can be modified directly, without having to download
ZSH_THEME="ys"
#!!!!!!!!!! This parameter is valid after the terminal restarts or you can use source ~/.zshrc to update the configuration

As an aside, I don't want to display the host name, so I just kill the host name
~/.oh-my-zsh/themes/ys
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} {\ % (#, %$bg[yellow]%}%{$fg[black]%}%n%{$reset_color% %}, {$fg[cyan]%}%n) \
%{$fg[white]%}in \
%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%} \${hg_info}\
${git_info}{\ \ %$fg[white]%}[%*] $exit_code% {$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
Copy the code

Oh-my-zsh plug-in recommended

Plugins still need to open ~/.zshrc, find plugins=, and write in the name of the plugins you want. Some plugins may need to be installed. !!!!!!!!!! Note that as long as this file is changed, it will be valid after restarting the terminal or using source ~/.zshrc to update the configuration.

Right: Autojump, zsh-Autosuggestion and zsh-syntax-highlighting.

autojump

Function: to achieve a quick jump between directories, want to go to which directory directly J + directory name, not in the frequent CD! Making the address.

The history | grep “git clone” this command will find the recent clone which libraries, dispense with writing a pile of code.

Autojump keeps track of all the paths you have visited in your history. When you enter a path name, it will blur the paths you have visited in your previous CD.

Here’s the picturecdGo to some directory, and then you canjQuickly switch, usejoExpress opens folders in finder

# Installation Steps

# ------ mac -------
brew install autojump
vim ~/.zshrc
Find plugins in the file and add them
plugins=(autojump)
# Add at the end of file
[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
source $ZSH/oh-my-zsh.sh
# the last
source ~/.zshrc



# ------ linux -----
git clone git://github.com/joelthelion/autojump.git
cd autojump
./install.py
vim ~/.zshrc
Find plugins in the file and add them
plugins=(autojump)
# Add at the end of file
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
source ~/.zshrc
Copy the code

zsh-autosuggestion

As shown in the figure, automatic completion (gray) can be prompted when entering the command, and then press the keyboard → (!!!!) Up and down left and right right, not TAB key) can be completed

# installation
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
vim ~/.zshrc
Find plugins in the file and add them
plugins=(
  autojump
  zsh-autosuggestions
)
source ~/.zshrc
Copy the code

zsh-syntax-highlighting

Everyday commands are highlighted, and command errors are shown in red

# installation
git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
vim ~/.zshrc
Find plugins in the file and add them
plugins=(
  autojump
  zsh-autosuggestions
  zsh-syntax-highlighting
)
source ~/.zshrc
Copy the code

Refer to the article

  • Oh-my-zsh plugin recommendations: AutoJump, zsh-Autosuggestion and zsh-syntax-highlighting
  • Autojump is the efficiency tool for Mustache’s Mac