目录
- 效果图
- 下载 Windows Terminal
- 安装 oh-my-posh
- 设置 settings.json
- 配置 $Profile
- 右键菜单中添加 Windows Terminal (新版win中已有,无需再添加)
-
- 参考链接
效果图
下载 Windows Terminal
微软应用商店搜索 Windows Terminal
,第一个应该就是了。
安装 oh-my-posh
管理员权限打开 powershell
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
PS:类似于 oh-my-zsh
设置 settings.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"copyOnSelect": false,
"copyFormatting": false,
"theme":"dark",
"profiles":
{
"defaults":
{
"cursorShape": "filledBox",
"useAcrylic": true,
"acrylicOpacity": 1,
"colorScheme": "Dracula",
"fontFace": "Sarasa Term SC",
},
"list":
[
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "Command Prompt",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
}
]
},
"schemes": [
{
"name": "Dracula",
"cursorColor": "#F8F8F2",
"selectionBackground": "#44475A",
"background": "#282A36",
"foreground": "#F8F8F2",
"black": "#21222C",
"blue": "#BD93F9",
"cyan": "#8BE9FD",
"green": "#50FA7B",
"purple": "#FF79C6",
"red": "#FF5555",
"white": "#F8F8F2",
"yellow": "#F1FA8C",
"brightBlack": "#6272A4",
"brightBlue": "#D6ACFF",
"brightCyan": "#A4FFFF",
"brightGreen": "#69FF94",
"brightPurple": "#FF92DF",
"brightRed": "#FF6E6E",
"brightWhite": "#FFFFFF",
"brightYellow": "#FFFFA5"
}
],
"actions":
[
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
{ "command": "find", "keys": "ctrl+shift+f" },
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
配置 $Profile
notepad $Profile
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
Set-PSReadLineOption -PredictionSource History
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
右键菜单中添加 Windows Terminal (新版win中已有,无需再添加)
在文件管理器中的当前目录下鼠标右键打开 Windows Terminal。
图标
下载:https://github.com/yanglr/WindowsDevTools/blob/master/awosomeTerminal/icons/wt_32.ico
下载后新建 C:\\Users\\Lenovo\\AppData\\Local\\terminal\\
文件夹,将图标文件 wt_32.ico
放置到这个文件夹下。(Lenovo
是用户名,需替换)
利用注册表添加鼠标右键选项
新建一个注册表文件 terminal.reg
,写入如下内容。(Lenovo
是用户名,需替换)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows terminal here"
"Icon"="C:\\Users\\Lenovo\\AppData\\Local\\terminal\\wt_32.ico"
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\Lenovo\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
右键该文件 terminal.reg
,以管理员权限运行。
并在 settings.json 中 profiles
的 defaults
中添加 "startingDirectory": "./"
(上述 settings.json
文件中已添加(现已注释))。
"profiles":
{
"defaults":
{
"startingDirectory": "./"
},
}
参考链接
- 教程:在 Windows 终端中设置 Powerline
- Windows Terminal 美化实例
- Dark theme for Windows Terminal
- Windows Terminal美化教程
- win10是最好的“Linux发行版”(一)——子系统、终端、包管理器
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)