Windows 全新终端体验 —— Windows Terminal 安装与美化
Windows Terminal安装及美化
1.下载Windows Terminal
直接去电脑自带的Microsoft Store搜索下载
2.下载字体
Fira Code | 一个程序员专用字体
Fira 是 Mozilla 主推的字体系列,Fira Code 是基于 Fira Mono 等宽字体的一个扩展,主要特点是加入了编程连字特性(ligatures)。
Fira Code 就是利用这个特性对编程中的常用符号进行优化,比如把输入的「!=」直接显示成「≠」或者把「>=」变成「≥ 」等等,以此来提高代码的可读性。
3.安装字体
把下载的压缩包,解压 进入ttf文件夹,全选右击为所有用户安装
[
4.安装PowerShell Core
PowerShell Core是跨平台的(Windows,Linux和macOS)自动化和配置工具/框架,可与您的现有工具配合使用,并针对处理结构化数据(例如JSON,CSV,XML等),REST API进行了优化。和对象模型。它包括命令行外壳,关联的脚本语言和用于处理cmdlet的框架。
这个PowerShell Core和你电脑自带的那个又丑又慢,提示还看不懂的Windows PowerShell不是同一个东西
下载传送门
5.配置终端
打开Windows Terminal , 进入设置 , 打开JSON文件
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
"source": "Windows.Terminal.PowershellCore",
"commandline": "C:/Program Files/PowerShell/7/pwsh.exe -nologo",
"startingDirectory": ".",
"fontFace": "Fira Code",
"fontSize": 11,
"historySize": 9001,
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"useAcrylic": true,
"acrylicOpacity" : 0.4,
"colorScheme": "AdventureTime",
"backgroundImageOpacity": 0.6,
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
"schemes": [
{
"name": "AdventureTime",
"black": "#050404",
"red": "#bd0013",
"green": "#4ab118",
// 时间的颜色
"yellow": "#d298e2",
// 目录的颜色
"blue": "#a2d7e2",
"purple": "#cec2ff",
"cyan": "#9ccabf",
"white": "#f8dcc0",
//参数的颜色
"brightBlack": "#c0d8f8",
"brightRed": "#fc5f5a",
// > 的颜色
"brightGreen": "#9eff6e",
//命令的颜色
"brightYellow": "#efc11a",
"brightBlue": "#1997c6",
"brightPurple": "#9b5953",
"brightCyan": "#c8faf4",
"brightWhite": "#f6f5fb",
"background": "#3a3a3a",
"foreground": "#dddddd"
}
],
每个人的审美都不同,会JSON的可以自己修改配色,不会赶紧去学🤓🤓🤓
6.安装PowerShell 插件
打开Windows Terminal , 执行以下命令
# 1. 安装 PSReadline 包,该插件可以让Windows Terminal执行linux命令
Install-Module -Name PSReadLine -AllowPrerelease -Force
# 2. 安装 posh-git 包,让你的 git 更好用
Install-Module posh-git -Scope CurrentUser
# 3. 安装 oh-my-posh 包,让你的命令行更酷炫、优雅
Install-Module oh-my-posh -Scope CurrentUser
最后两个包可能会被提示不受系统信任 , 如果提示输入Y回车即可
7.设置PowerShell 插件
打开Windows Terminal , 执行$Profile
得到一个路径
C:\Users\当前用户名\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
打开这个Microsoft.PowerShell_profile.ps1文件
# 引入 posh-git
Import-Module posh-git
# 引入 oh-my-posh
Import-Module oh-my-posh
# 设置 PowerShell 主题
Set-Theme Emodipt
主题文件存放在 C:\Users\当前用户名\Documents\PowerShell\Modules\oh-my-posh\2.0.440\Themes
8.完成安装
(ps:本文所要程序均为以管理员运行,若文章显示不正常,狂按F5😘)
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!