Blog

Make it work, make it right, make it fast

Oct 1, 2021 - 1 minute read - 编程

Ubuntu常用zsh配置

一、Install Zsh

sudo apt install zsh

二、Install oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

如果提示网络问题可设置socks5代理:

export all_proxy=socks5://ip:port

安装oh-my-zsh示例

三、安装常用插件

当git无法clone项目时,可单独设置代理:

git config --global http.proxy http://ip:port  # 设置http全局代理
git config --global https.proxy http://ip:port # 设置https全局代理

git config --global --unset http.proxy  # 取消代理
git config --global --unset https.proxy

zsh-autosuggestions

  1. 克隆项目到 oh-my-zsh 的 plugins 目录:
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  1. 在 ~/.zshrc 中激活插件:
plugins=(git zsh-autosuggestions)
  1. 重载zsh:
source ~/.zshrc

键入命令时会自动补全历史记录。

zsh-autosuggestions示例

zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

同样在 .zshrc 中添加插件,重载后即可生效。