现在是时候制作一个新的Windows Terminal profile.json

我已经谈论了好几个月了,但是如果您没有听说,这里会有一个新的Windows Terminal 。 您可以从Windows Store下载并立即开始使用。 它是免费和开源的。

在撰写本文时,Windows Terminal的版本约为0.5。 它没有作为1.0正式发布,所以情况一直在变化。

这是您的工作-您之前安装过Windows Terminal吗? 您是否自定义了profile.json文件? 如果是这样,我希望您删除自己的profiles.json!



您的profiles.json类似于C:\ Users \ USERNAME \ AppData \ Local \ Packages \ Microsoft.WindowsTerminal_8wekyb3d8bbwe \ LocalState,但是您可以从Windows终端的下拉菜单中找到它:



当您点击“设置”时,Windows终端将启动任何已注册的应用程序来处理JSON文件。 就我而言,我正在使用Visual Studio Code。

我已经对profiles.json进行了很多自定义,因此在删除或“调零”我的profiles.json之前,我会将副本保存在某个地方。 你应该去!

您只需“ ctrl-a”并在打开时删除所有profile.json,Windows Terminal 0.5或更高版本将通过检测您拥有的外壳从头开始重新创建它。 记住, 控制台或终端不是Shell

请注意,新的profiles.json还包含另一个提示! 您可以按住ALT-并单击设置以查看默认设置! 这个新的profiles.json更易于阅读和理解,因为它具有继承的默认值。

// To view the default settings, hold "alt" while clicking on the "Settings" button. // For documentation on these settings, see: https://aka.ms/terminal-documentation  {     "$schema": "https://aka.ms/terminal-profiles-schema",      "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",      "profiles":     [         {             // 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": "cmd",             "commandline": "cmd.exe",             "hidden": false         },         {             "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",             "hidden": false,             "name": "PowerShell Core",             "source": "Windows.Terminal.PowershellCore"         }, ... 

您会注意到有一个新的$模式,它为您提供了Intellisense下拉菜单,因此您可以立即自动完成属性及其值! 在https://aka.ms/terminal-documentation上查看Windows终端文档,此处提供了您可以在profiles.json中完成的所有操作完整列表

我已经对Profile.json进行了这些更改。



我添加了“ requestedTheme”并将其更改为暗,以获得带有标签的黑色titleBar。



我还想测试新的(甚至没有完成)的分屏功能,该功能可以使您的tmux样式简化为窗格,而无需任何其他软件。

 // Add any keybinding overrides to this array. // To unbind a default keybinding, set the command to "unbound" "keybindings": [    { "command": "closeWindow", "keys": ["alt+f4"] },    { "command": "splitHorizontal", "keys": ["ctrl+-"]},    { "command": "splitVertical", "keys": ["ctrl+\\"]} ] 

然后,我添加了一个特定于Ubuntu的配色方案,名为UbuntuLegit。

 // Add custom color schemes to this array "schemes": [    {        "background" : "#2C001E",        "black" : "#4E9A06",        "blue" : "#3465A4",        "brightBlack" : "#555753",        "brightBlue" : "#729FCF",        "brightCyan" : "#34E2E2",        "brightGreen" : "#8AE234",        "brightPurple" : "#AD7FA8",        "brightRed" : "#EF2929",        "brightWhite" : "#EEEEEE",        "brightYellow" : "#FCE94F",        "cyan" : "#06989A",        "foreground" : "#EEEEEE",        "green" : "#300A24",        "name" : "UbuntuLegit",        "purple" : "#75507B",        "red" : "#CC0000",        "white" : "#D3D7CF",        "yellow" : "#C4A000"    } ], 

最后,我添加了一个运行Mono的x86开发人员提示符的自定义命令提示符。

 {    "guid": "{b463ae62-4e3d-5e58-b989-0a998ec441b8}",    "hidden": false,    "name": "Mono",    "fontFace": "DelugiaCode NF",    "fontSize": 16,    "commandline": "C://Windows//SysWOW64//cmd.exe /k \"C://Program Files (x86)//Mono//bin//setmonopath.bat\"",    "icon": "c://Users//scott//Dropbox//mono.png" } 

请注意,我使用的是正斜杠,双斜杠和双斜杠转义。

将您的profiles.json保存在某个地方,确保您的终端已更新,然后将其删除或清空,您很可能会获得一些新的“免费”外壳,终端会检测到这些外壳,然后您可以复制所需的一些自定义设置。

Source: https://habr.com/ru/post/zh-CN473150/


All Articles