打造Win10完美终端体验(Windows Terminal + oh-my-zsh)+ 报错解决方案

简介: 打造Win10完美终端体验(Windows Terminal + oh-my-zsh)+ 报错解决方案

Preface



继上篇还在用虚拟机吗?通过WSL2在Win10下愉快的玩耍Linux ,本篇的目标是打造一个Win10下的完美终端体验,目标:好用而且舒适养眼。


image.png


Terminal



  1. 在微软商店搜索 Terminal,获取安装:


image.png

默认打开是 PoweShell ,我们可以在右边的下拉三角中修改默认打开 Ubuntu 终端:


image.png


oh-my-zsh 美化



虽然设置里字体样式大小,颜色主题都可以改,但对我们的要求好用舒适养眼还是有一段距离,这里我们安装一下 oh-my-zsh 美化一下我们的终端。


  1. 首先下载一下额外字体来支持特殊符号,打开 PowerShell ,依次执行以下命令:


git clone https://github.com/powerline/fonts.git
cd fonts
.\install.ps1


image.png


  • 如果出现图中问题需要更改一下 Win10 的执行策略,更改后再回到出错的那步重新进行,输入以下命令:


Set-ExecutionPolicy RemoteSigned
# 同意更改 输入Y
复制代码
  • 安装完字体后,在 Ubuntu 安装 zsh:


sudo apt update
sudo apt install git zsh -y
复制代码
  • 再安装 oh-my-zsh:


sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
复制代码
  • 很大可能会有这个报错,这是因为网络问题:


curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
复制代码
  • 解决方案:来到该网站复制这个 install.sh 的内容(我给你准备好了,网盘链接,提取码5fs6),新建一个文件粘贴保存:


# 新建文件,粘贴复制内容wq保存退出
vim 1.sh
# 加上可执行权限后执行
chmod +x 1.sh
./1.sh
复制代码


  • 安装成功:


image.png


  • 安装一个好看的 zsh 主题,编辑 ~/.zshrc 文件 :


git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
vim ~/.zshrc
# 修改 ZSH_THEME="powerlevel10k/powerlevel10k"
复制代码


  • 重启环境后,会有一个配置教程,跟着选择即可。
  • 主题官方推荐字体powerlevel10k/README.md,下载后能得到最佳体验:


image.png

最后修改 Windows Terminal 的设置,打开JSON文件:


image.png

如图在 defaults 处添加三行:


image.png



"defaults": {
    "useAcrylic": true,     // 亚克力效果
    "acrylicOpacity": 0.6,  // 透明度0~1
    "fontFace": "MesloLGS NF"   // 字体
},
复制代码


  • 终于,改完之后效果如下:


image.png

插件



  1. autojump:实现目录间快速跳转,想去哪个目录直接 j + 目录名 ,不用在频繁的 cd 了!!
  2. autosuggestion:输入命令时可提示自动补全(灰色部分),然后按键盘 → 即可补全。
  3. syntax-highlighting:日常用的命令会高亮显示,命令错误显示红色。


# 下载插件,如果网络不行可以在gitee上搜索项目替换地址
git clone git://github.com/joelthelion/autojump.git  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/autojump
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://gitee.com/mancuojie/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# 执行指令
cd $ZSH_CUSTOM/plugins/autojump
./install.py
复制代码
vim ~/.zshrc
# 修改以下部分
plugins=(zsh-autosuggestions
         git
         zsh-syntax-highlighting
         autojump
        )
# autojump
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh


image.png

目录
相关文章
|
8月前
|
SQL Apache Windows
Windows服务器80端口被占用的全面解决方案
在服务管理器中启动apache2服务,即可正常使用80端口。若系统中还安装了其他微软产品如sql等,也可尝试停止其服务进行测试,但请注意,SQL通常不会使用80端口,因此一般不会受到影响。以上就是关于80端口被system占用的详细解决方法,希望对你有所帮助。
|
6月前
|
安全 Linux iOS开发
Tenable Nessus 10.10 (macOS, Linux, Windows) - 漏洞评估解决方案
Tenable Nessus 10.10 (macOS, Linux, Windows) - 漏洞评估解决方案
404 0
Tenable Nessus 10.10 (macOS, Linux, Windows) - 漏洞评估解决方案
|
12月前
|
安全 Unix Linux
Veritas NetBackup 11 for Linux & Windows - 领先的企业备份和恢复解决方案
Veritas NetBackup 11 for Linux & Windows - 领先的企业备份和恢复解决方案
461 0
Veritas NetBackup 11 for Linux & Windows - 领先的企业备份和恢复解决方案
|
7月前
|
安全 Linux iOS开发
Tenable Nessus 10.9.3 (macOS, Linux, Windows) - 漏洞评估解决方案
Tenable Nessus 10.9.3 (macOS, Linux, Windows) - 漏洞评估解决方案
649 0
Tenable Nessus 10.9.3 (macOS, Linux, Windows) - 漏洞评估解决方案
|
8月前
|
监控 数据安全/隐私保护 Windows
Veeam Data Platform 12.3.2 (Windows) - 数据保护和管理解决方案
Veeam Data Platform 12.3.2 (Windows) - 数据保护和管理解决方案
163 1
|
10月前
|
Linux 网络安全 iOS开发
SecureCRT & SecureFX 9.6.3 for macOS, Linux, Windows - 跨平台的多协议终端仿真和文件传输
SecureCRT & SecureFX 9.6.3 for macOS, Linux, Windows - 跨平台的多协议终端仿真和文件传输
2107 4
SecureCRT & SecureFX 9.6.3 for macOS, Linux, Windows - 跨平台的多协议终端仿真和文件传输
|
iOS开发 MacOS Windows
Mac air使用Boot Camp安装win10 ,拷贝 Windows 文件时出错
Mac air使用Boot Camp安装win10 ,拷贝 Windows 文件时出错
|
11月前
|
存储 安全 Linux
Nexpose 8.4.1 for Linux & Windows - 领先的漏洞管理解决方案
Nexpose 8.4.1 for Linux & Windows - 领先的漏洞管理解决方案
235 0
Nexpose 8.4.1 for Linux & Windows - 领先的漏洞管理解决方案
|
数据库 数据安全/隐私保护 Windows
Windows远程桌面出现CredSSP加密数据修正问题解决方案
【10月更文挑战第30天】本文介绍了两种解决Windows系统凭据分配问题的方法。方案一是通过组策略编辑器(gpedit.msc)启用“加密数据库修正”并将其保护级别设为“易受攻击”。方案二是通过注册表编辑器(regedit)在指定路径下创建或修改名为“AllowEncryptionOracle”的DWORD值,并将其数值设为2。
11276 3
|
Shell Linux 开发工具
Windows Terminal——安装并配置主题
Windows Terminal——安装并配置主题
271 1
Windows Terminal——安装并配置主题