Mac终端美化

Mac终端的设置

1、安装包管理工具Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#若显示443,拒绝链接。直接打开链接地址,将install.sh下载到本地,然后再执行这个文件
/bin/bash -c install.sh

#git代理的设置
git config --global http.proxy http://127.0.0.1:xxxx
git config --global https.proxy https://127.0.0.1:xxxx

2、切换默认的shell

#查看当前使用的shell
echo $SHELL
#查看系统拥有的shell
cat /etc/shells
#切换默认的shell
chsh -s /bin/zsh

3、安装oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#443,和安装包管理工具一样
#或者使用wegt
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

#安装插件

#1、命令高亮zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#2、命令提示,可以提示你输入过的历史命令zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

#使插件生效
vim ~/.zshrc
source ~/.zshrc

#使用agnoster主题出现乱码问题,安装Powerline字体
git clone https://github.com/powerline/fonts
#进入目录
./install.sh
#在终端的偏好设置里面更改字体

4、安装更改终端主题

#在用户目录下下载主题
git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git
#terminal文件夹下的主题文件是为 macOS 原生终端 Terminal 准备的主题。这其中以 .terminal 结尾的文件就是终端的主题配置文件。

5、隐藏zsh终端前面的用户名和主机名

#修改根目录下的.zshrc文件,在文件底部添加
#隐藏用户名和主机名:
prompt_context() {}
#隐藏主机名,保留用户名
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}
#保留主机名,隐藏用户名
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    prompt_segment black default "%(!.%{%F{yellow}%}.)$HOST"
  fi
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值