非root用户安装

本教程会安装zsh,autojump,zsh-autosuggestions,zsh-syntax-highlighting等插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
cd ~ # 到用户目录
mkdir software # 创建目录,在该目录下安装zsh和其他插件
cd software
wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh --strip-components 1
cd zsh

./configure --prefix=$HOME/software
make
make install

# 将 安装路径放到PATH中
echo 'export PATH="$HOME/software/bin:$PATH"' >> ~/.bashrc

# 执行下面命令
source ~/.bashrc

cd ~/software # 回software目录,安装ohmyzsh,用于自动生成.zshrc文件
git clone https://github.com/ohmyzsh/ohmyzsh.git
cd ohmyzsh/tools/
./install.sh
# 这儿会让选择是否将zsh设置为默认的shell,选择n
echo "zsh" >> ~/.bashrc # 每次打开终端,在最后都让他去执行zsh

# 下载安装 zsh-autosuggestions (自动补全可能路径)
cd ~/software # 回到software目录,安装zsh-autosuggestions插件
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 下载 autojump (快速跳转)
git clone https://github.com/joelthelion/autojump.git
cd autojump
./install.py #如果这里提示没有安装 python,请自行安装python,可以考虑直接安装anaconda

echo "[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh" >> ~/.zshrc

cd ~/software # 回software目录,下载语法高亮插件
# 下载安装 zsh-syntax-highlighting (终端输入高亮 正确路径下划线)
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# 更新插件配置
vi ~/.zshrc
# plugins=(git autojump zsh-autosuggestions zsh-syntax-highlighting)
source .zshrc