zsh installation and configuration oh my zsh

Mac installation reference: http://www.cnblogs.com/EasonJim/p/6283247.html

The difference between zsh and oh-my-zsh: http://www.cnblogs.com/EasonJim/p/7863093.html

Note: zsh is not installed by default under Ubuntu, and zsh is installed by default under Mac.

Note: After installing oh-my-zsh, the environment variable entry will be changed from ./bashrc to ./zshrc. This is something to be careful when configuring environment variables. You can refer to the Mac configuration, basically the same: http://www.cnblogs.com/EasonJim/p/6283190.html

1. Installation:

1. Install zsh

sudo apt-get install zsh

2. Change the default Shell to zsh

chsh -s /bin/zsh

Note: Do not use sudo.

3. Configure the password file to solve the problem of chsh: PAM authentication failure

sudo vim /etc/passwd

Change the first line of /bin/bash to /bin/zsh, this is for the root user.

Change the last line of /bin/bash to /bin/zsh, this should be the login user name + computer name of each computer.

4. Install Git

sudo apt-get install git

5. Install oh-my-zsh

Why install it for quick configuration of zsh.

Official website: http://ohmyz.sh/

Offline version: (link: https://pan.baidu.com/s/1i5iqYhB password: v5c2), if you use the offline version, you need to modify it to executable permissions: sudo chmod +x *.sh

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

6. Restart the computer and check the effect

7, install autojump automatic jump plug-in

Official website: https://github.com/wting/autojump

installation:

sudo apt-get install autojump

Configuration tutorial: cat /usr/share/doc/autojump/README.Debian

Configuration:

vim .zshrc

Add in the last line, note that there is a space after the dot

. /usr/share/autojump/autojump.sh

Effective:

source ~/.zshrc

8. Install the zsh-syntax-highlighting syntax highlighting plugin

Official website: https://github.com/zsh-users/zsh-syntax-highlighting

installation:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.gitecho "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Effective:

source ~/.zshrc

9. Install the zsh-autosuggestions syntax history plugin

Official website: https://github.com/zsh-users/zsh-autosuggestions

installation:

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

Then you will find that the above sentence will not take effect. Popular science here: there are many plug-ins under ~/.oh-my-zsh/plugins, you can load the plug-ins directly by using commands like plugins=(ant mvn svn git).

After research, it is found that if you use plugins to execute the plug-in, you must first use the software after the machine has been installed. And this method does not support command execution under Ubuntu, it can only be used under the .zshrc file, and then use source ~/.zshrc to make it effective. This is the place where Ubuntu is relatively awkward.

So the above plugins should be placed in ~/.zshrc, and the specific modifications are as follows:

vim ~/.zshrc

Add plug-in:

Then add the execution file of zsh in the last line:

source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

Effective:

source ~/.zshrc
10. Configure the theme

Official theme reference: https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes

sudo vim ~/.zshrc

Find ZSH_THEME="robbyrussell" and modify it to: ZSH_THEME="ys";

Effective:

source ~/.zshrc
2. Uninstall:

carried out:

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

Change /etc/passwd back to bash:

/Bin/bash on the first line

/Bin/bash on the last line

In fact, it seems to be a very simple uninstallation, but in the end you will find that there are still many that have not been killed. You will find out slowly in use.

reference:

http://www.jianshu.com/p/9a5c4cb0452d

http://blog.csdn.net/shengzhu1/article/details/54590158

https://segmentfault.com/q/1010000000448027

https://wiki.archlinux.org/index.php/Zsh_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)

https://ehlxr.me/2016/09/24/Oh-My-Zsh-%E6%9B%BF%E6%8D%A2%E4%BD%A0%E7%9A%84-Bash-Shell/

http://macshuo.com/?p=676

http://wdxtub.com/2016/02/18/oh-my-zsh/

http://wulfric.me/2015/08/zsh/

https://www.zhihu.com/question/21418449

http://yijiebuyi.com/blog/b9b5e1ebb719f22475c38c4819ab8151.html

https://segmentfault.com/a/1190000002658335

http://www.linuxidc.com/Linux/2015-07/119879.htm

https://segmentfault.com/a/1190000004695131

http://www.cnblogs.com/memory4young/p/about-oh-my-zsh-plugin-sublime.html

Guess you like

Origin blog.csdn.net/qq_24649627/article/details/114642389
Recommended