- 安装zsh
bash
sudo apt install zsh git- 设置默认终端
bash
sudo chsh -s /bin/zsh $USER- 安装oh-my-zsh
- 正常安装
plain
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"- 国内网安装
bash
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh && \
sed -i 's|https://github.com|https://ghproxy.com/&|g' install.sh && \
chmod +x ./install.sh && \
./install.sh配置插件
- 安装语法高亮插件
- 正常安装
bash
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting- 国内网络安装
bash
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting- 安装自动补全插件
- 防止报错The unauthenticated git protocol on port 9418 is no longer supported.,则解决如下:
plain
git config --global url."https://".insteadOf git://- 正常安装
bash
git clone git://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions- 国内网安装
bash
git clone https://ghproxy.com/https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions- 替换主题并且使插件生效
bash
sed -i "s/robbyrussell/ys/g" ~/.zshrc
sed -i "s/(git)/(git zsh-syntax-highlighting zsh-autosuggestions)/g" ~/.zshrc
source ~/.zshrc- 解决git下面文件较多时,存在的卡顿问题。
bash
cat > ~/.oh-my-zsh/custom/disable_git_info.zsh <<EOF
function git_prompt_info() {
ref=\$(git symbolic-ref HEAD 2> /dev/null) || return
echo "\$ZSH_THEME_GIT_PROMPT_PREFIX\${ref#refs/heads/}\$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
EOF
``