无 Root 配置 zsh 和 Oh-my-zsh
原文日期: 2017-06-19
来源: https://github.com/wlz0726/wlz0726.github.io
无 Root 权限安装 zsh
1. 下载源码
1 2 3
| wget https://sourceforge.net/projects/zsh/files/zsh/5.8/zsh-5.8.tar.xz tar xf zsh-5.8.tar.xz cd zsh-5.8
|
2. 编译安装到用户目录
1 2 3
| ./configure --prefix=$HOME/.local make make install
|
3. 添加到 PATH
1 2
| echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc source ~/.bashrc
|
安装 Oh-my-zsh
1 2 3 4 5 6 7 8
| export ZSH=$HOME/.oh-my-zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git $ZSH
cp $ZSH/templates/zshrc.zsh-template $HOME/.zshrc
|
编辑 ~/.zshrc
1 2 3 4 5 6 7 8 9 10 11
| ZSH_THEME="robbyrussell"
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
export ZSH=$HOME/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
|
安装插件
zsh-autosuggestions
1
| git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
|
zsh-syntax-highlighting
1
| git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
|
设置默认 shell
如果有 sudo 权限:
1 2 3 4 5
| cat /etc/shells
chsh -s $HOME/.local/bin/zsh
|
如果没有 sudo 权限,每次手动启动:
推荐主题
此文档为 GitHub 博客自动归档