0. zsh安装
macOS
brew install zsh
ubuntu
sudo apt-get install zsh
windows
建议用powershell
查看系统支持shell类型
cat /etc/shells
更改默认shell为zsh
chsh -s /usr/bin/zsh
(需要重启)
1. 配置代理
# Porxy setting
function proxy_on() {
export http_proxy=http://127.0.0.1:7890;
export https_proxy=http://127.0.0.1:7890;
export no_proxy=localhost,127.0.0.1,localaddress,.localdomain.com;
echo -e "已开启代理"
}
function proxy_off() {
unset http_proxy;
unset https_proxy;
unset no_proxy;
echo -e "已关闭代理"
}
function proxy_status() {
echo $https_proxy
curl cip.cc
}
source ~/.zshrc (根据文件位置更改)
2. 安装
// 方式一:使用curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
方式二:使用wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
方式三:下载
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh // 克隆仓库到主目录
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc // 将 templates 目录下的配置文件拷贝至 .zshrc
3. 卸载
uninstall_oh_my_zsh
4. 安装 Pure 主题
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
修改.zshrc
ZSH_THEME=refined
source ~/.zshrc
5. 安装插件
语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-syntax-highlighting
命令提示
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-autosuggestions
修改.zshrc
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
source ~/.zshrc