Reference articles
Make terminal show Git branch on Ubuntu (OH-MY-ZSH)
Installation and basic configuration of oh-my-zsh
Install oh-my-zsh under Ubuntu
Objective
Before learning Laravel, often to switch git branch, but the existing shell does not show the branch state is always used git st
, git br -a
it is very troublesome, so to find the solution online:
The first to find is to modify the ~/.BASHRC file, but after the change is always the shell display will always appear such a small error, helpless under the search for other solutions, which let me find the big artifact:
Oh-my-zsh
Don't say much nonsense, get to the point
Installation
First of all, my system is ubuntu16.04lts.
Installing ZSH
sudo apt install zsh
Installing OH-MY-ZSH
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Minor changes
The default theme settings I have been very satisfied, the only drawback is that the theme of the Git branch color is a synthesis seems strange, feel like where there is a problem, so I changed a little bit
vi ~/.oh-my-zsh/themes/robbyrussell.zsh-theme
Line Four
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[green]%}"
Which is to change red to green, haha.
Theme Effects
Configuration
The above basic requirements have been achieved, but if more functionality is required, the ~/.ZSHRC file is also configured
Theme Settings
Subject modification
Concrete effect See link: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
Plugin modification
Common Plugins recommended:
Plugin Description: Https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
Last-working-dir
You can record the path where the last command line was exited, and automatically revert to the previous path the next time you start the command line.
Wd
Its role is to be able to quickly switch to a common directory.
Example: Access to the Nginx directory/usr/share/nginx/html/
Enter this directory to perform wd add www Map current directory to www each time only need to perform WD www can enter/usr/share/nginx/html/can also use WD RM to remove existing mappings using WD Show "To view the existing mappings
Catimg
He can output the contents of the picture to the command line catimg demo.jpg
Zsh-syntax-highlighting
Installation method:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Zsh-autosuggestions
It can record the input commands and give advice.
Installation method:
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Sudo
Double-click ESC to add or remove sudo two times
Extract
Powerful decompression plug-in
For example: need to decompress demo.tar.gz
Perform x demo.tar.gz
Ubuntu16.04 Show git branching status