Windows Terminal v0.11 发布:重大更新,配置文件更改

Author Avatar
Lussac 5月2日 ; Views: 102
  • 在其它设备中阅读本文章

4 月 23 日消息,微软发布 Windows Terminal v0.11 预览版,迎来一些更新。据悉,这将是 Windows Terminal 1.0 正式版发布前的最后一次主要更新。并且,从现在到正式版发布,所有后续调整均是对本次主要更新的修订。

Windows Terminal 现在包括对非英语 UI 语言的支持,并且微软建议你将设置文件移出 app 文件夹,以使其生成新文件,然后再将设置复制回。

(以上内容复制自网络新闻)


参考资料

配置文件 settings.json

现在配置文件由 profiles.json 重命名为 settings.json 。为了迁移到新的配置文件,你可以复制备份一份原配置文件,删除 settings.json 后重新打开 Windows Terminal 。它会在原目录下重新生成一份新的 settings.json 。之后再根据自己的需要,将原配置文件中的一些修改复制过来。

下面摘要一些重点:

全局设置 globals

globals 对象取消,其中所有属性移出到根对象上,即与 $schema , profiles 等属性平级。

值得注意的是, defaultProfile 属性现在也在根对象上。

{
    "defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
    "initialCols": 200,
    "initialRows": 65,
    "copyOnSelect": false,
    "copyFormatting": false,

    // ......

    "keybindings": [
        // ......
    ],
    "profiles": {
        // ......
    }
}

快捷键绑定 keybindings

你可以根据 VSCode 的智能提示,改正一些错误的配置项。

例如 newTabswitchToTab 等修改了配置格式。

"keybindings":
    [
        { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        { "command": "paste", "keys": "ctrl+v" },
        { "command": "find", "keys": "ctrl+shift+f" },

        // ......

        { "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+shift+1" },
        { "command": { "action": "newTab", "index": 1 }, "keys": "ctrl+shift+2" },
        { "command": { "action": "newTab", "index": 2 }, "keys": "ctrl+shift+3" },
        { "command": { "action": "newTab", "index": 3 }, "keys": "ctrl+shift+4" },
        { "command": { "action": "newTab", "index": 4 }, "keys": "ctrl+shift+5" },
        { "command": { "action": "newTab", "index": 5 }, "keys": "ctrl+shift+6" },
        { "command": { "action": "newTab", "index": 6 }, "keys": "ctrl+shift+7" },
        { "command": { "action": "newTab", "index": 7 }, "keys": "ctrl+shift+8" },
        { "command": { "action": "newTab", "index": 8 }, "keys": "ctrl+shift+9" },

        { "command": { "action": "switchToTab", "index": 0 }, "keys": "ctrl+alt+1" },
        { "command": { "action": "switchToTab", "index": 1 }, "keys": "ctrl+alt+2" },
        { "command": { "action": "switchToTab", "index": 2 }, "keys": "ctrl+alt+3" },
        { "command": { "action": "switchToTab", "index": 3 }, "keys": "ctrl+alt+4" },
        { "command": { "action": "switchToTab", "index": 4 }, "keys": "ctrl+alt+5" },
        { "command": { "action": "switchToTab", "index": 5 }, "keys": "ctrl+alt+6" },
        { "command": { "action": "switchToTab", "index": 6 }, "keys": "ctrl+alt+7" },
        { "command": { "action": "switchToTab", "index": 7 }, "keys": "ctrl+alt+8" },
        { "command": { "action": "switchToTab", "index": 8 }, "keys": "ctrl+alt+9" }
    ]

参照:

配置分享

{
  "$schema": "https://aka.ms/terminal-profiles-schema",
  
  "defaultProfile": "{此处值为'profiles.list'中所需终端的guid}",
  "initialCols": 100,
  "initialRows": 25,
  "theme": "system",
  "showTabsInTitlebar": true,
  "showTerminalTitleInTitlebar": true,
  
  "copyOnSelect": false,
  "copyFormatting": false,
  
  "profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles.
      "colorScheme": "MaterialDark",
      "acrylicOpacity": 0.7,
      "background": "#222222",
      "backgroundImage": "F:\\MyPicture\\壁纸\\Wallpaper.png",
      "backgroundImageOpacity": 0.5,
      "backgroundImageStretchMode": "fill",
      "cursorColor": "#FFFFFF",
      "cursorShape": "bar",
      "fontFace": "JetBrains Mono",
      "fontSize": 11,
      "historySize": 9001,
      "padding": "3, 0, 3, 0",
      "snapOnInput": true,
      "useAcrylic": true
    },
    "list": [
      {
        // CMD
        // ...自定义...
      },
      {
        // PowerShell
        // ...自定义...
      },
      {
        // Ubuntu in WSL
        "guid": "{此处保持默认}",
        "hidden": false,
        "name": "WSL - Ubuntu",
        "source": "Windows.Terminal.Wsl",
        // https://www.ixiqin.com/2019/08/windows-terminal-wsl-configuration/
        // https://github.com/microsoft/terminal/issues/1183
        "commandline": "ubuntu",
        "startingDirectory": "~"
        // "startingDirectory": "//wsl$/Ubuntu/home/lussac",
      },
      {
        // Azure Cloud Shell
        // ...自定义...
      }
    ]
  },
  "schemes": [
      // 更多主题配色,另见:
      // https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/windowsterminal
      {
        "name": "Material",
        "black": "#212121",
        "red": "#b7141f",
        "green": "#457b24",
        "yellow": "#f6981e",
        "blue": "#134eb2",
        "purple": "#560088",
        "cyan": "#0e717c",
        "white": "#efefef",
        "brightBlack": "#424242",
        "brightRed": "#e83b3f",
        "brightGreen": "#7aba3a",
        "brightYellow": "#ffea2e",
        "brightBlue": "#54a4f3",
        "brightPurple": "#aa4dbc",
        "brightCyan": "#26bbd1",
        "brightWhite": "#d9d9d9",
        "background": "#eaeaea",
        "foreground": "#232322"
      },
      {
        "name": "MaterialDark",
        "black": "#212121",
        "red": "#b7141f",
        "green": "#457b24",
        "yellow": "#f6981e",
        "blue": "#134eb2",
        "purple": "#560088",
        "cyan": "#0e717c",
        "white": "#efefef",
        "brightBlack": "#424242",
        "brightRed": "#e83b3f",
        "brightGreen": "#7aba3a",
        "brightYellow": "#ffea2e",
        "brightBlue": "#54a4f3",
        "brightPurple": "#aa4dbc",
        "brightCyan": "#26bbd1",
        "brightWhite": "#d9d9d9",
        "background": "#232322",
        "foreground": "#e5e5e5"
      }
  ],
  "keybindings": [
    // ...自定义...
  ]
}

本文尚未编辑完成 ...