Windows Terminal 完全配置教程(主题以及启动设置)

墨蓝 2023-01-01 03:47 881阅读 0赞

一、安装Windows terminal

Microsoft Store搜索Windows terminal
watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70
第一个和第二个都可以!!

二、选择主题 Windows terminal提供了大量的主题可以选择,当然也可以像VScode文本编辑器一样自行配置。

登陆如下网址,选择一个你喜欢的主题复制主题代码
https://atomcorp.github.io/themes/

三、配置主题 打开Windows terminal" class="reference-link">watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 1 三、配置主题 打开Windows terminal

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 2

Win+R运行,输入wt

点击Windows terminal中的下拉箭头选择设置,打开配置Windows Terminal的Json文件。watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 3

将复制的主题代码粘贴到在list中,分别配置PowerShell的主题和cmd的主题,添加刚才获得代码即可应用对应的主题。name为标识,用于设置终端应用哪个主题。
watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 4

我的主题配置如下:

  1. // This file was initially generated by Windows Terminal Preview 1.5.3242.0
  2. // It should still be usable in newer versions, but newer versions might have additional
  3. // settings, help text, or changes that you will not see unless you clear this file
  4. // and let us generate a new one for you.
  5. // To view the default settings, hold "alt" while clicking on the "Settings" button.
  6. // For documentation on these settings, see: https://aka.ms/terminal-documentation
  7. {
  8. "$schema": "https://aka.ms/terminal-profiles-schema",
  9. "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
  10. // You can add more global application settings here.
  11. // To learn more about global settings, visit https://aka.ms/terminal-global-settings
  12. // If enabled, selections are automatically copied to your clipboard.
  13. "copyOnSelect": false,
  14. // If enabled, formatted data is also copied to your clipboard
  15. "copyFormatting": false,
  16. // A profile specifies a command to execute paired with information about how it should look and feel.
  17. // Each one of them will appear in the 'New Tab' dropdown,
  18. // and can be invoked from the commandline with `wt.exe -p xxx`
  19. // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
  20. "profiles": {
  21. "defaults": /*全局配置*/ {
  22. // Put settings here that you want to apply to all profiles
  23. // 默认打开的 Profile GUID(下面会详细介绍)
  24. "defaultProfile": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
  25. "startingDirectory": null,
  26. // 终端窗口默认大小
  27. "initialCols": 120,
  28. "initialRows": 30,
  29. // 亮色或暗色主题,可选值 "light", "dark", "system"
  30. "requestedTheme": "system",
  31. // 合并标题栏和标签栏
  32. "showTabsInTitlebar": true,
  33. // 如果 showTabsInTitlebar 与本值同为 false 时,自动隐藏标签栏
  34. "alwaysShowTabs": true,
  35. // 在标题栏上显示当前活动标签页的标题
  36. "showTerminalTitleInTitlebar": true,
  37. // 双击选择时用于分词的字符
  38. "wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
  39. // 选择时复制到剪贴板
  40. "copyOnSelect": true,
  41. // ...
  42. },
  43. "list": /*每种类型terminal的详细配置*/ [
  44. {
  45. // Make changes here to the cmd.exe profile 关于cmd的配置
  46. "guid": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
  47. /*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
  48. "name": "CMD",
  49. "commandline": "cmd.exe",
  50. /*程序位置*/
  51. "hidden": false,
  52. "tabTitle": "CMD", /*名称*/
  53. "foreground": "#DCDCDC", /*字体颜色*/
  54. "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
  55. "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
  56. "acrylicOpacity": 0.95,
  57. /*亚克力透明效果*/
  58. "backgroundImageOpacity": 0.70,
  59. /*背景透明度*/
  60. "backgroundImageStretchMode": "fill",
  61. "closeOnExit": true,
  62. "colorScheme": "Campbell",
  63. "cursorColor": "#FFFFFF",
  64. "cursorShape": "bar",
  65. "fontFace": "Consoles",
  66. "fontSize": 12,
  67. "historySize": 9001,
  68. "padding": "0, 0, 0, 0",
  69. "snapOnInput": true,
  70. "startingDirectory": "%USERPROFILE%",
  71. "useAcrylic": true
  72. },
  73. {
  74. // Make changes here to the powershell.exe profile
  75. "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
  76. "name": "Windows PowerShell",
  77. "commandline": "powershell.exe",
  78. "hidden": false,
  79. "tabTitle": "PowerShell",
  80. "foreground": "#DCDCDC",
  81. "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png",
  82. "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg",
  83. "acrylicOpacity": 0.95,
  84. /*亚克力透明效果*/
  85. "backgroundImageOpacity": 0.70,
  86. "backgroundImageStretchMode": "fill",
  87. "colorScheme": "Campbell",
  88. "cursorColor": "#FFFFFF",
  89. "cursorShape": "bar",
  90. "fontFace": "Consoles",
  91. "fontSize": 12,
  92. "historySize": 9001,
  93. "padding": "0, 0, 0, 0",
  94. "snapOnInput": true,
  95. "startingDirectory": "%USERPROFILE%",
  96. "useAcrylic": true
  97. },
  98. {
  99. // Make changes here to the Anaconda Prompt profile 关于anaconda的配置
  100. "guid": "{FCAD2812-51E4-4E55-96AF-2F2B75628FE0}",
  101. "name": "anaconda prompt",
  102. "commandline": "%windir%\\System32\\cmd.exe /K D:\\Users\\KuroNeko\\Anaconda3\\Scripts\\activate.bat",
  103. "hidden": false,
  104. "tabTitle": "Anaconda Prompt", /*名称*/
  105. "foreground": "#DCDCDC", /*字体颜色*/
  106. "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png", /*ICO图标*/
  107. "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg", /*终端背景图*/
  108. "acrylicOpacity": 0.75,
  109. "backgroundImageOpacity": 0.1,
  110. "backgroundImageStretchMode": "fill",
  111. "closeOnExit": true,
  112. "colorScheme": "Campbell",
  113. "cursorColor": "#FFFFFF",
  114. "cursorShape": "bar",
  115. "fontFace": "Consolas",
  116. "fontSize": 11,
  117. "historySize": 9001,
  118. "padding": "0, 0, 0, 0",
  119. "snapOnInput": true,
  120. "startingDirectory": "%USERPROFILE%",
  121. "useAcrylic": true
  122. },
  123. {
  124. // Make changes here to the Git Bash profile 关于Git bash的配置
  125. "guid": "{4B25BFD9-4962-49AE-8512-BBD336462BAB}",
  126. "name": "Git Bash",
  127. "commandline": "D:\\Program Files (x86)\\Git\\bin\\bash.exe",
  128. "hidden": false,
  129. "tabTitle": "Git Bash", /*名称*/
  130. "foreground": "#DCDCDC", /*字体颜色*/
  131. "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
  132. "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
  133. "acrylicOpacity": 0.75,
  134. "backgroundImageOpacity": 0.25,
  135. "backgroundImageStretchMode": "fill",
  136. "closeOnExit": true,
  137. "colorScheme": "Campbell",
  138. "cursorColor": "#FFFFFF",
  139. "cursorShape": "bar",
  140. "fontFace": "Consolas",
  141. "fontSize": 11,
  142. "historySize": 9001,
  143. "padding": "0, 0, 0, 0",
  144. "snapOnInput": true,
  145. "startingDirectory": "%USERPROFILE%",
  146. "useAcrylic": true
  147. },
  148. {
  149. "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
  150. "hidden": false,
  151. "name": "Azure Cloud Shell",
  152. "source": "Windows.Terminal.Azure"
  153. }
  154. ]
  155. },
  156. // Add custom color schemes to this array
  157. "schemes": [],
  158. // Add any keybinding overrides to this array.
  159. // To unbind a default keybinding, set the command to "unbound"
  160. // Add custom color schemes to this array.
  161. // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
  162. // Add custom actions and keybindings to this array.
  163. // To unbind a key combination from your defaults.json, set the command to "unbound".
  164. // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
  165. "actions": [
  166. // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
  167. // These two lines additionally bind them to Ctrl+C and Ctrl+V.
  168. // To learn more about selection, visit https://aka.ms/terminal-selection
  169. {
  170. "command": {
  171. "action": "copy",
  172. "singleLine": false
  173. },
  174. "keys": "ctrl+c"
  175. },
  176. {
  177. "command": "paste",
  178. "keys": "ctrl+v"
  179. },
  180. // Press Ctrl+Shift+F to open the search box
  181. {
  182. "command": "find",
  183. "keys": "ctrl+shift+f"
  184. },
  185. // Press Alt+Shift+D to open a new pane.
  186. // - "split": "auto" makes this pane open in the direction that provides the most surface area.
  187. // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
  188. // To learn more about panes, visit https://aka.ms/terminal-panes
  189. {
  190. "command": {
  191. "action": "splitPane",
  192. "split": "auto",
  193. "splitMode": "duplicate"
  194. },
  195. "keys": "alt+shift+d"
  196. }
  197. ]
  198. }

四、更高级的打开方式" class="reference-link">配置启动Windows Terminal默认打开的终端,这样打开Windows Terminal默认启动的就是cmd终端了。 watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 5 四、更高级的打开方式

通过地址栏启动

在配置文件中添加如下代码,可以在地址栏输入WT即可以启动。

20201231104128576.png

通过右键菜单启动

添加右键菜单,在任意路径下右键选择Windows Terminal启动
注册表进入如下路径

  1. 计算机\HKEY_CLASSES_ROOT\Directory\Background\shell

默认应该会有两个子项,cmd和powershell
右击shell新增项Windows Terminal
watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 6
新增下图所示的四个字符串值及一个DWORD值

  1. (默认) 字符串 在此处打开Windows Terminal #这个值是在右键菜单中显示的值
  2. Extended 字符串 #这个值作用是仅支持在按住Shift+右键的时候才显示Windows Terminal选项,删掉则可以不用按住Shift也可以显示Windows Terminal选项
  3. Icon 字符串 C:\Users\xxxx\Pictures\terminal.ico #想要在右键菜单中显示的图标路径,图标需要单独下载
  4. NoWorkingDirectory 字符串
  5. ShowBasedOnVelocityId DWORD 639bc8(十六进制) #在菜单中显示或隐藏Windows Terminal选项

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 7

在Windows Terminal上右键新建项command
修改默认值为:

  1. C:\Users\你的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe -d "%V"

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 8

配置完成即可在任意文件夹内右键打开Windows Terminal

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA_size_16_color_FFFFFF_t_70 9

更多配置信息参考官方配置文档

Windows 终端中的配置文件设置

发表评论

表情:
评论列表 (有 0 条评论,881人围观)

还没有评论,来说两句吧...

相关阅读