Terminal终端美化
2025年2月23日约 446 字大约 1 分钟...
安装 Oh my zsh
Method | Command |
---|---|
curl | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
wget | sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
fetch | sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
安装 Powerlevel10k
双击每个文件,然后单击“安装”。这将使MesloLGS NF
字体可用于系统上的所有应用程序。
Apple终端:终端→首选项→配置文件→文本,单击字体下的更改 并选择MesloLGS NF
家族。
- 安装 Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
打开~/.zshrc
,找到设置ZSH_THEME
的行,然后将其值更改为"powerlevel10k/powerlevel10k"
。
主题
安装高亮插件
这是oh my zsh的一个插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
vi ~/.zshrc
这时我们再次打开zshrc文件进行编辑。找到plugins,此时plugins中应该已经有了git,我们需要把高亮插件也加上:
...
plugins=(
git
zsh-syntax-highlighting
)
...
请务必保证插件顺序,zsh-syntax-highlighting必须在最后一个。
然后在文件的最后一行添加:source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
按一下esc调出vi命令,输入:wq保存并退出vi模式。
执行命令使刚才的修改生效:
source ~/.zshrc
可选择、命令补全
跟代码高亮的安装方式一样,这也是一个zsh的插件,叫做zsh-autosuggestion
,用于命令建议和补全。
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc
找到plugins,加上这个插件即可:
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)