热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用[powerlevel10k]美化你的WSL(Linux)

前言关于linux终端的美化,网上的教程有很多,但对于国内的用

前言

关于linux终端的美化,网上的教程有很多,但对于国内的用户来说,效果往往是这样的:

  • 教程中
    通过以下命令安装 oh-my-zsh

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    或者使用

    sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

  • 但结果往往是…
    在这里插入图片描述

这就是本文章的目的所在。在这片文章中,所有命令将采用国内可用的地址,方便广大折腾用户使用。

开始

1. 安装zsh

这个很简单,不用考虑源的问题,根据自己的系统自行安装即可。

2. 安装 oh-my-zsh

这里我使用了一下命令:

sh -c "$(wget -O- https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

原网址: https://gitee.com/mirrors/oh-my-zsh,感谢大佬的镜像。

尽管也不是很快,但至少不会curl: (7) Failed to connect to raw.githubusercontent.com port 443: 拒绝连接

3. 安装 powerlevel10k

oh-my-zsh 安装完成之后,使用以下命令安装powerlevel10k

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

clone完成之后,修改~/.zshrc:

nano ~/.zshrc

ZSH_THEME 修改为 powerlevel10k/powerlevel10k

4. 安装 Nerd 字体

仅仅安装 powerlevel10k 是不够的,你还需要一个能够满足它的字体,包括各种特殊字符和图标(如上图)等,网络中使用最多的是 Hack Nerd Font
字体官网链接:https://nerdfonts.com/
在这里插入图片描述
因为我使用的是wsl,只要在Windows Terminal中配置好字体就可以了。

5. 配置 powerlevel10k

使用以下命令应用~/.zshrc的修改:

source ~/.zshrc

回车后会开始 powerlevel10k 的配置,主要是样式的选择,这里不再赘述。

6. 安装 zsh 插件

# 补全提示
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

~/.zshrc 中添加:plugins=(git zsh-autosuggestions zsh-syntax-highlighting pip)

再使用 source ~/.zshrc 应用修改。

结束

文章就到这里了,有疑问可以在评论区留言。


推荐阅读
author-avatar
梦想不被束缚
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有