ZSH终端优化--Oh my zsh

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值