参考链接

补充

在第5步配置修改Windows Terminal配置文件时,有几个需要注意的点。

  • commandline 参数需要修改为自己的Powershell Core安装路径
  • 注释 source 参数,否则会有以下报错:在配置文件列表中找不到你的默认配置文件-使用第一个配置文件。请进行检查以确保 “defaultProfile” 与你的某个配置文件的 GUID 相匹配。具体参见GitHub issue:

    附上完整settings.json

    1. // This file was initially generated by Windows Terminal 1.4.3243.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. // 修改默认ShellPowershell Core
    10. // "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    11. "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    12. // You can add more global application settings here.
    13. // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    14. // If enabled, selections are automatically copied to your clipboard.
    15. "copyOnSelect": false,
    16. // If enabled, formatted data is also copied to your clipboard
    17. "copyFormatting": false,
    18. // A profile specifies a command to execute paired with information about how it should look and feel.
    19. // Each one of them will appear in the 'New Tab' dropdown,
    20. // and can be invoked from the commandline with `wt.exe -p xxx`
    21. // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    22. "profiles": {
    23. "defaults": {
    24. // Put settings here that you want to apply to all profiles.
    25. },
    26. "list": [
    27. {
    28. // Make changes here to the powershell.exe profile.
    29. "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    30. "name": "Windows PowerShell",
    31. "commandline": "powershell.exe",
    32. "hidden": false
    33. },
    34. {
    35. // Make changes here to the cmd.exe profile.
    36. "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
    37. "name": "Command Prompt",
    38. "commandline": "cmd.exe",
    39. "hidden": false
    40. },
    41. {
    42. "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
    43. "hidden": false,
    44. "name": "Azure Cloud Shell",
    45. "source": "Windows.Terminal.Azure"
    46. },
    47. {
    48. // Powershell 7.1.1 配置
    49. "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    50. "hidden": false,
    51. "name": "pwsh",
    52. // 换成自己的安装路径
    53. // 注意:一定要写上 -nologo,否则开启 powershll 会有一段话输出,很讨厌!
    54. "commandline": "D:/Software/PowerShell/7/pwsh.exe -nologo",
    55. // 在配置文件列表中找不到你的默认配置文件-使用第一个配置文件。请进行检查以确保 "defaultProfile" 与你的某个配置文件的 GUID 相匹配。
    56. // 注释source后解决上述报错
    57. // "source": "Windows.Terminal.PowershellCore",
    58. // 启动菜单一定要设置为 <.>,否则后面重要的一步将会无效!
    59. "startingDirectory": ".",
    60. // 字体
    61. "fontFace": "Consolas",
    62. "fontSize": 11,
    63. "historySize": 9001,
    64. "padding": "5, 5, 20, 25",
    65. "snapOnInput": true,
    66. "useAcrylic": false,
    67. // 颜色
    68. "colorScheme": "Homebrew"
    69. }
    70. ]
    71. },
    72. // Add custom color schemes to this array.
    73. // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    74. "schemes": [
    75. {
    76. "name": "Homebrew",
    77. "black": "#000000",
    78. "red": "#FC5275",
    79. "green": "#00a600",
    80. "yellow": "#999900",
    81. "blue": "#6666e9",
    82. "purple": "#b200b2",
    83. "cyan": "#00a6b2",
    84. "white": "#bfbfbf",
    85. "brightBlack": "#666666",
    86. "brightRed": "#e50000",
    87. "brightGreen": "#00d900",
    88. "brightYellow": "#e5e500",
    89. "brightBlue": "#0000ff",
    90. "brightPurple": "#e500e5",
    91. "brightCyan": "#00e5e5",
    92. "brightWhite": "#e5e5e5",
    93. "background": "#283033",
    94. "foreground": "#00ff00"
    95. }
    96. ],
    97. // Add custom actions and keybindings to this array.
    98. // To unbind a key combination from your defaults.json, set the command to "unbound".
    99. // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    100. "actions": [
    101. // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
    102. // These two lines additionally bind them to Ctrl+C and Ctrl+V.
    103. // To learn more about selection, visit https://aka.ms/terminal-selection
    104. {
    105. "command": {
    106. "action": "copy",
    107. "singleLine": false
    108. },
    109. "keys": "ctrl+c"
    110. },
    111. {
    112. "command": "paste",
    113. "keys": "ctrl+v"
    114. },
    115. // Press Ctrl+Shift+F to open the search box
    116. {
    117. "command": "find",
    118. "keys": "ctrl+shift+f"
    119. },
    120. // Press Alt+Shift+D to open a new pane.
    121. // - "split": "auto" makes this pane open in the direction that provides the most surface area.
    122. // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
    123. // To learn more about panes, visit https://aka.ms/terminal-panes
    124. {
    125. "command": {
    126. "action": "splitPane",
    127. "split": "auto",
    128. "splitMode": "duplicate"
    129. },
    130. "keys": "alt+shift+d"
    131. }
    132. ]
    133. }