Article directory
item2 install
- Download: https://iterm2.com/features.html
Oh My Zsh Installation
1. List item download
- curl
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- wget
$ sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
2. Catalog introduction
In fact, the above installation is just to download the git repository of oh my zsh. After entering the ~/.oh-my-zsh directory, look at the structure of the directory
$ ls .oh-my-zsh
CODE_OF_CONDUCT.md README.md lib plugins tools
CONTRIBUTING.md cache log templates
LICENSE.txt custom oh-my-zsh.sh themes
- lib provides the script library for the core functionality
- tools Provide shortcut tools for installation, upgrade and other functions
- plugins The location where the built-in plugin exists
- templates The existence of the built-in template
- where themes comes with the theme file
- custom personalized configuration directory, self-installed plugins and themes can be placed here
For this configuration, we only need to care about plugins
and themes
two directories, you can enter these two directories to see which plugins and themes oh my zsh provides by default.
See what plugins are included
$ ls ~/.oh-my-zsh/plugins
adb debian git-flow last-working-dir profiles systemd
alias-finder dircycle git-flow-avh lein pyenv taskwarrior
ansible direnv git-hubflow
省略...
Comes with themes
ls ~/.oh-my-zsh/themes
3den.zsh-theme gallifrey.zsh-theme nebirhos.zsh-theme
Soliah.zsh-theme gallois.zsh-theme nicoulaj.zsh-theme
adben.zsh-theme garyblessington.zsh-theme norm.zsh-theme
af-magic.zsh-theme gentoo.zsh-theme obraun.zsh-theme
afowler.zsh-theme geoffgarside.zsh-theme peepcode.zsh-theme
agnoster.zsh-theme gianu.zsh-theme philips.zsh-theme
alanpeabody.zsh-theme gnzh.zsh-theme pmcgee.zsh-theme
省略...
3. Theme configuration
Modify the .zshrc file, ~/.oh-my-zsh/themes
find the theme you want to use from the directory, and configure the theme name to the value of ZSH_THEME as the key in the .zshrc file.
Only one topic can be configured, and the format is as follows:
ZSH_THEME="themeName"
I am using the theme ys.zsh-theme. When configuring, you need to omit the following .zsh-theme, namely ys, as follows:
3.1 Edit the .zshrc file
vim ~/.zshrc
3.2 Modify the theme
ZSH_THEME="ys"
3.3 Effective
source ~/.zshrc
You can also use the random theme
ZSH_THEME="random"
It means that every time you open the terminal, you will use a theme at random until you see which theme looks good that day. Use the echo command to output the name of the current theme, and then change it to the theme you like.
$ echo $ZSH_THEME
4. Plug-in configuration
Similar to the configuration topic above, modify .zshrc
the file, ~/.oh-my-zsh/plugins
find the plug-in you want to use from the directory, and configure the plug-in name to the value of .zshrc
key in the file . Multiple plugins can be configured in the following format:plugins
plugins=(plugin1 plugin2 plugin3)
4.1 Edit the .zshrc file
vim ~/.zshrc
4.2 Fill in the required plug-ins
plugins=(git zsh-autosuggestions zsh-syntax-highlighting web-search)
4.3 Entry into force
source ~/.zshrc
5. Extension plug-in
使用扩展的插件,需要把对应的插件下载到 ~/.oh-my-zsh/plugins文件夹中,然后修改.zshrc文件,把该插件名填入到plugins的位置;
5.1 Autocommand Prompt zsh-autosuggestions
- Function: When you enter a command in the terminal, the command you entered before will automatically appear. At this time, press the → key to complete the command.
This is not a plugin that comes with oh my zsh, it needs to be downloaded to the plugin directory (~/.oh-my-zsh/plugins) - Get the plugin:
git clone git://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
- Enable the plugin: modify the ~/.zshrc file, and add the name of the plugin after the value in plugins.
plugins=(省略之前的插件名称 zsh-autosuggestions)
5.2 Syntax highlighting zsh-syntax-highlighting
- Function: The input commands such as ls, cd will become highlighted color
- Get the plugin:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
- Enable the plugin: modify the ~/.zshrc file, and add the name of the plugin after the value in plugins.
plugins=(omit the previous plugin name zsh-syntax-highlighting)
5.3 Code completion zsh-completions
- Function:
- Get the plugin:
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
- Enable the plugin: modify the ~/.zshrc file, and add the name of the plugin after the value in plugins.
plugins=(omit the previous plugin name zsh-completions)