目录和git分支效果
切换主题 多种风格选择
快捷菜单
快速打开常用项目和目录,还可配置服务器 ssh连接
安装和配置
Windows TerminalFira code字体(choco安装或直接自行下载安装)
posh-git和oh-my-posh主题
ColorTool
Windows Terminal 安装
在Microsoft Store 中下载 注意系统要求
Fira code 字体 安装
可通过 choco 安装 但受网络限制会失败(我是没成功,有兴趣的可以试试),建议直接去 github 下载
下载完后解压 把字体文件手动安装
安装 posh-git和oh-my-posh主题
通过在 PowerShell 中执行下面的命令安装, 以超级管理员运行 PowerShell
CurrentUser 是仅为当前用户安装模块
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
配置和切换主题
默认主题
输入
$PROFILE
C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
继续输入:
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
在打开的文件中添加: Set-Theme AgnosterPlus 是设置默认主题
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme AgnosterPlus
保存后关闭记事本, 在终端中输入以下命令生效(这里不要照抄 下面执行的 是 上文中$PROFILE的值)
C:\Users\Administrator\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
切换主题
Set-Theme 主题名字
其他可选主题有
Agnoster、Avit、Darkblood、Fish、Honukai、Paradox、Sorin、tehrob
Windows Terminal配置
打开配置文件 setting.json
加入以下参考配置,可自行修改,一定要符合json的内容格式,不然会报错,还有就是图片的的路径要与己系统对应
"profiles":
{
// 默认配置
"defaults":
{
"fontFace": "Fira Code", // oh-my-posh 主题原因,使用其他的字体可能会出现乱码
"backgroundImage": "C:\\bash-bg.jpg", // 背景图片地址
"backgroundImageOpacity": 0.5, // 透明度
"colorScheme" : "Andromeda", // 颜色方案
"acrylicOpacity": 0.7,
useAcrylic:true
},
// 下拉快捷菜单 list
// guid 唯一id 切记不要重复
// name 下拉菜单中展示的名字
// tabTitle tab标签中 展示的名字
// commandline 要加载的终端或命令
// startingDirectory 默认目录 不填则打开用户目录,
// icon 图标
// historySize历史记录大小
"list":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "rent-web",
"tabTitle": "rent-web",
"commandline": "powershell.exe",
"startingDirectory": "D:\\obj\\newObj\\Rents\\rent-web",
"icon": "D:\\obj\\newObj\\Rents\\rent-web\\src\\assets\\logo\\logo.png",
"hidden": false
},
{
// Make changes here to the powershell.exe profile.
"guid": "{55daf408-4c33-abb5-a9da-af3450acad44}",
"name": "Parts",
"tabTitle": "Parts",
"commandline": "powershell.exe",
"startingDirectory": "D:\\obj\\Parts",
"hidden": false,
"icon": "C:\\Users\\Administrator\\Pictures\\logo\\w.jpg"
},
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
"name": "myObj",
"tabTitle": "myObj",
"commandline": "powershell.exe",
"startingDirectory": "D:\\myObj",
"icon": "C:\\Users\\Administrator\\Pictures\\logo\\m.png",
"hidden": false
},
{
"guid": "{f323ab3c-9641-4904-a3a6-dc4e4992b6ae}",
"name": "Git Bash",
"commandline": "%programfiles%\\Git\\bin\\bash.exe --cd-to-home",
"hidden": false,
"fontSize": 12,
"historySize": 9001,
"tabTitle": "git bash",
"icon": "C:\\git-bash.png"
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{975b5e3c-f525-f0be-e609-1af5ae6ae013}",
"name": "我的服务器",
"commandline": "ssh [email protected]",
"hidden": false,
"historySize": 9001,
"tabTitle": "我的服务器",
"icon": "C:\\Users\\Administrator\\Pictures\\logo\\ubuntu.png"
}
]
},
// 配色方案
"schemes": [
{
"name": "Andromeda",
"black": "#000000",
"red": "#cd3131",
"green": "#05bc79",
"yellow": "#09da0f",
// "yellow": "#e5e512",
"blue": "#2472c8",
"purple": "#bc3fbc",
"cyan": "#0fa8cd",
"white": "#e5e5e5",
"brightBlack": "#666666",
"brightRed": "#cd3131",
"brightGreen": "#05bc79",
"brightYellow": "#09da0f",
// "brightYellow": "#e5e512",
"brightBlue": "#2472c8",
"brightPurple": "#bc3fbc",
"brightCyan": "#0fa8cd",
"brightWhite": "#e5e5e5",
"background": "#262a33",
"foreground": "#e5e5e5"
},
{
"name": "Campbell",
"foreground": "#F2F2F2",
"background": "#0C0C0C",
"colors": [
"#0C0C0C",
"#C50F1F",
"#13A10E",
"#C19C00",
"#0037DA",
"#881798",
"#3A96DD",
"#CCCCCC",
"#767676",
"#E74856",
"#16C60C",
"#F9F1A5",
"#3B78FF",
"#B4009E",
"#61D6D6",
"#F2F2F2"
]
},
{
"name": "Solarized Dark",
"foreground": "#FDF6E3",
"background": "#073642",
"colors": [
"#073642",
"#D30102",
"#859900",
"#B58900",
"#268BD2",
"#D33682",
"#2AA198",
"#EEE8D5",
"#002B36",
"#CB4B16",
"#586E75",
"#657B83",
"#839496",
"#6C71C4",
"#93A1A1",
"#FDF6E3"
]
}
],