Windows Terminal 美化

以下美化的方案及主题信息是通过官方文档获取,此处作以记录。

Step 1.安装字体

GitHub字体
从上面的地址中下载字体并安装,使用该字体是因为Oh-My-Posh中的主题依赖该字体的特殊符号

Step 2.安装PowerShell Module

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

Step 3.编辑当前PowerShell配置文件

notepad $PROFILE

写入如下内容:

Import-Module posh-git
Import-Module oh-my-posh
# 可以先使用 Get-PoshThemes 命令挑选喜欢的主题,然后执行下面命令
#Set-PoshPrompt 后面的参数为主题名称
Set-PoshPrompt ys

Step 4.替换配置文件Settings.json

该文件可通过按Ctrl + , 弹出设置页面,点击该页面左下方打开Json文件按钮获得。
替换下面信息时着重注意List中的终端列表,如不存在下面配置中的终端可不替换。
相对来说补充比替换更符合操作语义,在编辑时把配置文件中不存在的内容全部补充上去即可。
更多的参数设置可点击上方官方的链接进行查看。

// This file was initially generated by Windows Terminal 1.10.2383.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// 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": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,
    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,
    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles": {
        "defaults": {
            // Put settings here that you want to apply to all profiles.
        },
        "list": [
            {
                // 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": "命令提示符",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "name": "PowerShell😘",
                "source": "Windows.Terminal.PowershellCore",
                "fontFace": "Cascadia Code PL",
                "colorScheme": "Frost",
                "acrylicOpacity": 0.7,
                "cursorColor": "#FF1493",
                "cursorShape": "vintage",
                "useAcrylic": true
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "name": "Ubuntu😁",
                "source": "Windows.Terminal.Wsl",
                "colorScheme": "Raspberry",
                "cursorColor": "#FFFFFF",
                "fontFace": "Cascadia Code PL",
                "padding": "5, 5, 5, 5",
                "suppressApplicationTitle": true
            }
        ]
    },
    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [
        {
            "name": "Retro",
            "background": "#000000",
            "black": "#00ff00",
            "blue": "#00ff00",
            "brightBlack": "#00ff00",
            "brightBlue": "#00ff00",
            "brightCyan": "#00ff00",
            "brightGreen": "#00ff00",
            "brightPurple": "#00ff00",
            "brightRed": "#00ff00",
            "brightWhite": "#00ff00",
            "brightYellow": "#00ff00",
            "cyan": "#00ff00",
            "foreground": "#00ff00",
            "green": "#00ff00",
            "purple": "#00ff00",
            "red": "#00ff00",
            "white": "#00ff00",
            "yellow": "#00ff00"
        },
        {
            "name": "Frost",
            "background": "#FFFFFF",
            "black": "#3C5712",
            "blue": "#17b2ff",
            "brightBlack": "#749B36",
            "brightBlue": "#27B2F6",
            "brightCyan": "#13A8C0",
            "brightGreen": "#89AF50",
            "brightPurple": "#F2A20A",
            "brightRed": "#F49B36",
            "brightWhite": "#741274",
            "brightYellow": "#991070",
            "cyan": "#3C96A6",
            "foreground": "#000000",
            "green": "#6AAE08",
            "purple": "#991070",
            "red": "#8D0C0C",
            "white": "#6E386E",
            "yellow": "#991070"
        },
        {
            "name": "Raspberry",
            "background": "#3C0315",
            "black": "#282A2E",
            "blue": "#0170C5",
            "brightBlack": "#676E7A",
            "brightBlue": "#80c8ff",
            "brightCyan": "#8ABEB7",
            "brightGreen": "#B5D680",
            "brightPurple": "#AC79BB",
            "brightRed": "#BD6D85",
            "brightWhite": "#FFFFFD",
            "brightYellow": "#FFFD76",
            "cyan": "#3F8D83",
            "foreground": "#FFFFFD",
            "green": "#76AB23",
            "purple": "#7D498F",
            "red": "#BD0940",
            "white": "#FFFFFD",
            "yellow": "#E0DE48"
        }
    ],
    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions": [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        {
            "command": {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        // Press Ctrl+Shift+F to open the search box
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        // Press Alt+Shift+D to open a new pane.
        // - "split": "auto" makes this pane open in the direction that provides the most surface area.
        // - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
        // To learn more about panes, visit https://aka.ms/terminal-panes
        {
            "command": {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ]
}

更多 - wt命令行

在实际使用中使用最多的可能是wt命令行的使用方法,例如打开新标签页、拆分标签页显示等。

下图是在执行wt -h后的帮助信息,可按照相关命令进行尝试。

wt 命令行

更直接的操作是使用Ctrl + Shift + p 调用命令窗口输入或选择命令:

posted @ 2021-09-28 12:07  门前有根大呲花  阅读(289)  评论(0编辑  收藏  举报