前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Windows Terminal 完全配置教程(主题以及启动设置)

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

作者头像
风骨散人Chiam
发布2021-09-06 15:12:30
11K0
发布2021-09-06 15:12:30
举报
文章被收录于专栏:CSDN旧文CSDN旧文

一、安装Windows terminal

Microsoft Store搜索Windows terminal

第一个和第二个都可以!!

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

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

三、配置主题 打开Windows terminal

Win+R运行,输入wt

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

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

我的主题配置如下:

代码语言:javascript
复制
// This file was initially generated by Windows Terminal Preview 1.5.3242.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": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    // 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
            // 默认打开的 Profile GUID(下面会详细介绍)
            "defaultProfile": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
            "startingDirectory": null,
            // 终端窗口默认大小
            "initialCols": 120,
            "initialRows": 30,
            // 亮色或暗色主题,可选值 "light", "dark", "system"
            "requestedTheme": "system",
            // 合并标题栏和标签栏
            "showTabsInTitlebar": true,
            // 如果 showTabsInTitlebar 与本值同为 false 时,自动隐藏标签栏
            "alwaysShowTabs": true,
            // 在标题栏上显示当前活动标签页的标题
            "showTerminalTitleInTitlebar": true,
            // 双击选择时用于分词的字符
            "wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502",
            // 选择时复制到剪贴板
            "copyOnSelect": true,
            // ...
        },
        "list": /*每种类型terminal的详细配置*/ [
            {
                // Make changes here to the cmd.exe profile 关于cmd的配置
                "guid": "{97838c1f-307b-477a-b7fe-c9965c347e0b}",
                /*网页搜索guid生成可以获得每个程序唯一的guid,visual studio内的工具也有生成guid的功能*/
                "name": "CMD",
                "commandline": "cmd.exe",
                /*程序位置*/
                "hidden": false,
                "tabTitle": "CMD", /*名称*/
                "foreground": "#DCDCDC", /*字体颜色*/
                "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
                "acrylicOpacity": 0.95,
                /*亚克力透明效果*/
                "backgroundImageOpacity": 0.70,
                /*背景透明度*/
                "backgroundImageStretchMode": "fill",
                "closeOnExit": true,
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consoles",
                "fontSize": 12,
                "historySize": 9001,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": true
            },
            {
                // Make changes here to the powershell.exe profile
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false,
                "tabTitle": "PowerShell",
                "foreground": "#DCDCDC",
                "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png",
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg",
                "acrylicOpacity": 0.95,
                /*亚克力透明效果*/
                "backgroundImageOpacity": 0.70,

                "backgroundImageStretchMode": "fill",
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consoles",
                "fontSize": 12,
                "historySize": 9001,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": true
            },
            {
                // Make changes here to the Anaconda Prompt profile 关于anaconda的配置
                "guid": "{FCAD2812-51E4-4E55-96AF-2F2B75628FE0}",
                "name": "anaconda prompt",
                "commandline": "%windir%\\System32\\cmd.exe /K D:\\Users\\KuroNeko\\Anaconda3\\Scripts\\activate.bat",
                "hidden": false,
                "tabTitle": "Anaconda Prompt", /*名称*/
                "foreground": "#DCDCDC", /*字体颜色*/
                "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz2.png", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back2.jpeg", /*终端背景图*/
                "acrylicOpacity": 0.75,
                "backgroundImageOpacity": 0.1,
                "backgroundImageStretchMode": "fill",
                "closeOnExit": true,
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consolas",
                "fontSize": 11,
                "historySize": 9001,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": true
            },
            {
                // Make changes here to the Git Bash profile  关于Git bash的配置
                "guid": "{4B25BFD9-4962-49AE-8512-BBD336462BAB}",
                "name": "Git Bash",
                "commandline": "D:\\Program Files (x86)\\Git\\bin\\bash.exe",
                "hidden": false,
                "tabTitle": "Git Bash", /*名称*/
                "foreground": "#DCDCDC", /*字体颜色*/
                "icon": "C:/Users/ChiamZhang/Pictures/Saved Pictures/vz.jpeg", /*ICO图标*/
                "backgroundImage": "C:/Users/ChiamZhang/Pictures/Saved Pictures/back.jpg", /*终端背景图*/
                "acrylicOpacity": 0.75,
                "backgroundImageOpacity": 0.25,
                "backgroundImageStretchMode": "fill",
                "closeOnExit": true,
                "colorScheme": "Campbell",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "fontFace": "Consolas",
                "fontSize": 11,
                "historySize": 9001,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": true
            },
            
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },
    // Add custom color schemes to this array
    "schemes": [],
    // Add any keybinding overrides to this array.
    // To unbind a default keybinding, set the command to "unbound"
    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    // 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"
        }
    ]
}

配置启动Windows Terminal默认打开的终端,这样打开Windows Terminal默认启动的就是cmd终端了。

四、更高级的打开方式

通过地址栏启动

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

通过右键菜单启动

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

代码语言:javascript
复制
计算机\HKEY_CLASSES_ROOT\Directory\Background\shell

默认应该会有两个子项,cmd和powershell 右击shell新增项Windows Terminal

新增下图所示的四个字符串值及一个DWORD值

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

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

代码语言:javascript
复制
C:\Users\你的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe -d "%V"

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

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

Windows 终端中的配置文件设置

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-01-05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、安装Windows terminal
  • 二、选择主题 Windows terminal提供了大量的主题可以选择,当然也可以像VScode文本编辑器一样自行配置。
    • 我的主题配置如下:
    • 配置启动Windows Terminal默认打开的终端,这样打开Windows Terminal默认启动的就是cmd终端了。
      • 通过地址栏启动
        • 通过右键菜单启动
          • Windows 终端中的配置文件设置
      • 更多配置信息参考官方配置文档
      相关产品与服务
      命令行工具
      腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档