Mac 终端美化显示

Linux 也可安装 Zsh 后使用此套配置。

1. 安装 Oh My Zsh

bash 复制代码
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

2. 更换主题,修改文件:~/.zshrc,原内容: ZSH_THEME="robbyrussell" 替换为: ZSH_THEME="agnoster"

3. 安装 Powerline 字体修正显示乱码

bash 复制代码
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd ..
rm -rf fonts

4. 修改 iTerm2 或者其他终端使用名称后缀带 Powerline 的字体,如: Source Code Pro for Powerline;Visual Studio Code 可保留原有字体配置,添加新字体即可,注意名称两边包上单引号

5. 修改文件:~/.zshrc,添加一行内容: export DEFAULT_USER=$USER,隐藏显示用户名和主机名

6. Oh My Zsh 安装命令高亮插件

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

7. Oh My Zsh 安装命令自动补全插件

bash 复制代码
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

8. Oh My Zsh 启用之前安装的2个插件,修改文件:~/.zshrc,原内容: plugins=(git) 替换为: plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

9. 修改 Vim 编辑器配置:~/.vimrc, 开启语法和搜索高亮及行号显示

text 复制代码
syntax on
set hlsearch
set number
相关推荐
掘金安东尼1 天前
VSCode V1.107 发布(2025 年 11 月)
前端·visual studio code
denggun123451 天前
卡顿监测原理
macos·ios·xcode
Sheffi661 天前
iOS 触摸事件完整传递链路:Hit-Test 全流程深度解析
macos·ios·cocoa
单身的人上天堂2 天前
开发中使用iconfont预览太麻烦?我开发了一款VSCode插件来提升效率
前端·javascript·visual studio code
ChineHe2 天前
Gin框架入门篇002_第一个Gin服务
macos·xcode·gin
Roc.Chang2 天前
解决 macOS 26.1 The application “xxxx” can’t be opened. 问题
macos
iCora2 天前
vim入门
linux·编辑器·vim
赶路人儿2 天前
从intel mac迁移到M3后软件的兼容性
macos
han_2 天前
手把手教你写一个VSCode插件,从开发到发布全流程
前端·javascript·visual studio code
颜淡慕潇2 天前
Podman 从0到1使用教程(macOS 系统):安装 MySQL、Redis 容器
mysql·macos·podman