Windows Terminal 终端美化
Windows Terminal
从 Windows 商店,搜索并安装 Windows Terminal。
安装 PowerShell
Windows Terminal默认的是系统自带的 Windows PowerShell,我们安装新版的 PowerShell Core 7
。
https://github.com/PowerShell/PowerShell/releases
下载安装对应的版本,通常我们选择 PowerShell-7.0.3-win-x64.msi
将 PowerShell 加入 Terminal
先生成一个GUID: https://www.guidgenerator.com/online-guid-generator.aspx
打开 Windows Terminal 的配置 Json 文件,在list里增加以下。
{
"guid": "{填入生成的GUID}",
"hidden": false,
"name": "PowerShell",
"commandline": "D:/Program Files/PowerShell/7/pwsh.exe -nologo" // 安装路径,nologo可以移除欢迎语
}
修改 defaultProfile
为刚才生成的GUID。这样默认打开的就是新的 PowerShell 7
了。
安装模块
弹出的提示输入Y
# 控制台高亮
Install-Module -Name PSReadLine -AllowPrerelease -Force
# 针对git的优化
Install-Module posh-git
# 让命令行更好用
Install-Module posh-git
创建配置文件:
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
用记事本打开配置文件
notepad $PROFILE
填入配置内容(终端启动后自动导入模块)
Import-Module posh-git
Import-Module oh-my-posh
# 查看目录 ls & ll
function ListDirectory {
(Get-ChildItem).Name
Write-Host("")
}
Set-Alias -Name ls -Value ListDirectory
Set-Alias -Name ll -Value Get-ChildItem
安装字体
推荐字体:Fira Code
https://github.com/tonsky/FiraCode
美化配置
修改在 profiles
下的 defaults
配置
"defaults":
{
// Put settings here that you want to apply to all profiles.
"useAcrylic": true, // 启用毛玻璃效果
"acrylicOpacity": 0.8, // 背景透明度
"backgroundImage": "C:\\Users\\Administrator\\Pictures\\1920.jpg", // 背景图片
"backgroundImageOpacity": 0.5, // 图片透明度
"backgroundImageStretchMode": "fill", // 填充模式
"fontFace": "Fira Code", // 字体
"fontSize": 14, // 文字大小
"colorScheme": "cyberpunk", // 主题
"cursorColor": "#FF6600", // 光标颜色
"cursorShape": "filledBox", // 光标形状
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"startingDirectory":"E://WWW//" // 起始目录
}
更多配置参考官方说明:
https://docs.microsoft.com/zh-cn/windows/terminal/customize-settings/profile-settings
1,724 total views, 4 views today
Revisions
- 2020年8月2日 @ 15:07:12 [当前版本] by Anson
- 2020年8月2日 @ 15:20:21 [自动保存] by Anson
- 2020年8月2日 @ 15:07:12 by Anson
- 2020年8月2日 @ 15:06:39 by Anson
- 2020年8月2日 @ 14:55:32 by Anson
Comments are closed.