Windows Terminal配置美化 + Git配置 + 管理员配置

最终效果(简洁美观,看着舒服即可,用了毛玻璃所以没设置壁纸)

在这里插入图片描述
在这里插入图片描述


参考文章

  1. 👏Windows Terminal 终极美化
  2. WindowsTerminal设置
  3. 👀 官方Windows Terminal
  4. WINDOWS TERMINAL 使用管理员身份创建标签页
  5. Windows Terminal + oh-my-posh模块美化官方教程集锦以及常见问题
  6. Windows Terminal配置Git

注意oh-my-posh设置主题

在 PowerShell 配置文件中,将以下内容添加到文件的末尾:

设置主题正确应该为 Set-PoshPrompt -Theme Paradox

Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme Paradox

注意:很多其他教程(包括官方教程)中最后一条语句是 Set-Theme Paradox ,但这条语句是oh-my-posh 旧版本中的语句,近期下载的新版oh-my-posh已经不支持词语法,会出现如“问题2”中的报错

现在,每个新实例启动时都会导入 Posh-Git 和 Oh-My-Posh,然后从 Oh-My-Posh 设置 Paradox 主题。此外,Oh-My-Posh 附带了若干🎨内置主题←这个链接和官方文档的不一样哦。


Windows Terminal的配置

Terminal中的配置文件 setting.json

/*
 * 这是一个Windows Terminal的配置文件
 * 官方参考地址:https://docs.microsoft.com/zh-cn/windows/terminal/
 */
{
    "$schema": "https://aka.ms/terminal-profiles-schema",//不要修改
    "defaultProfile": "{60c54bbd-c2c6-5271-96e7-009a87ff44bf}",//默认配置文件,这里展示的是powershell7----------------必须
    "disabledProfileSources": [], //禁用动态配置文件
    "theme": "system", //深色or浅色主题
    "alwaysShowTabs": true, //始终显示选项卡
    "tabWidthMode": "equal", //选项卡宽度模式
    "confirmCloseAllTabs": true, // 隐藏关闭所有选项卡弹出窗口
    "startOnUserLogin": false, // 在计算机启动时启动
    "launchMode": "default", // 启动大小(窗口)
    "initialPosition": ",", // 启动位置(窗口)
    "initialCols": 120, // 首次启动时的列
    "initialRows": 30, // 首次启动时的行
    "showTabsInTitlebar": true, // 显示/隐藏标题栏
    "showTerminalTitleInTitlebar": true, // 设置标题栏中的文本
    "copyOnSelect": false, // 选择内容后复制
    "copyFormatting": false, // 复制格式
    //"wordDelimiters": "/\()"'-:,.;<>~!@#$%^&*|+=[]{}~?│", // 字分隔符
    "rowsToScroll": "system", // 滚动速度
    "snapToGridOnResize": true, // 窗口大小调整行为
    "experimental.rendering.forceFullRepaint": true, // 屏幕重绘
    "experimental.rendering.software": true, // 软件渲染
    //配置文件
    "profiles": {
        //适用所有配置文件的设置
        "defaults": {
            "startingDirectory": "%USERPROFILE%", //起始目录
            //"icon": "C:\\Users\\DustinWinFiles\\Pictures\\Java.png", // 图标,建议每一类在list中单独设置
            //"tabTitle": "XXX", //自定义选项卡标题,设置了所有的tab页都会是这个名字
            "suppressApplicationTitle": true, //禁止shell更改标题
            "fontFace": "Fira Code", //字体
            "fontSize": 12, //字体大小
            "fontWeight": "normal", // 字体粗细
            "padding": "8, 8, 8, 8", // 填充(内容距离界面的内部距离)
            "antialiasingMode": "cleartype", // 消除文本锯齿
            "cursorShape": "vintage", // 光标形状
            "cursorColor": "#11EE11", // 光标颜色
            "cursorHeight": 100, // 光标高度("cursorShape"设置为"vintage"时可用)
            "altGrAliasing": true, // AltGr别名
            //"colorScheme": "Ubuntu", // 配色方案  在单个中定义
            "colorScheme": "One Half Dark", // 配色方案
            //"selectionBackground": "#0000e6", //所选内容的背景色(选用"colorScheme"内的)
            "useAcrylic": true, //启用 acrylic(亚克力特效)
            "acrylicOpacity": 0.7, //Acrylic 不透明度
            //"backgroundImage": "C:\\Users\\DustinWinFiles\\Pictures\\colorful.jpg", //背景图像设置
            "backgroundImageStretchMode": "uniformToFill", // 背景图像拉伸模式
            "backgroundImageAlignment": "center", //背景图像对齐
            "backgroundImageOpacity": 0.5, //背景图像不透明度
            "scrollbarState": "visible", //滚动条可见性
            "snapOnInput": true, //键入时滚动到输入行
            "historySize": 9001, //历史记录大小
            "closeOnExit": "graceful", //退出时配置文件的关闭方式(输入exit退出命令窗口)
            //"experimental.retroTerminalEffect": false // 怀旧式终端效果
            "alwaysOnTop": true //始终处于顶部模式
        },
        //配置文件
        "list": [
            {
                "guid": "{41dd7a51-f0e1-4420-a2ec-1a7130b7e950}",
                "name": "Windows PowerShell Elevated",
                "commandline": "gsudo.exe powershell.exe",
                "hidden": false,
                "colorScheme": "Solarized Dark",
                "fontFace": "Fira Code",
                "icon" : "https://i.imgur.com/Giuj3FT.png"
            },

            // Git Bash
            {
                "name" : "Git Bash", //名称----------------必须
                "icon" : "D:\\Git\\mingw64\\share\\git\\git-for-windows.ico",
                "commandline" : "D:\\Git\\bin\\bash.exe", // git安装位置
                "hidden": false,//是否在下拉列表中隐藏
                "useAcrylic": true,
                "acrylicOpacity": 0.7,
                "colorScheme": "One Half Dark", // 配色方案
            },
            //PowerShell 7
            {
                "guid": "{60c54bbd-c2c6-5271-96e7-009a87ff44bf}",//唯一标识符,不可重复----------------必须
                "name": "PowerShellCore",//名称----------------必须
                "icon": "D:\\PowerShellCore\\icon\\powershellcore.png",//注意路径中不要有中文,否则可能不显示
                "commandline": "pwsh.exe --nologo",//命令行
                "hidden": false,//是否在下拉列表中隐藏
                "colorScheme": "One Half Dark", // 配色方案
            },
            //Azure 隐藏掉
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            //CMD 隐藏掉
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "CMD",
                "commandline": "cmd.exe",
                "hidden": true,
            },
            //WSL UBUNTU-18.4 显示
            {
                "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
                "hidden": false,
                "name": "Ubuntu-18.04",
                "source": "Windows.Terminal.Wsl",
                "colorScheme": "Ubuntu", // 配色方案
            },
            //WindowsPowerShell  隐藏掉
            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": true,
                "name": "WindowsPowerShell",
                "commandline": "powershell.exe",//命令行
            }
        ]
    },

    //定义配色方案,也可以直接使用官方提供的(直接根据名字使用即可)
    "schemes": 
    [
        {
        //   "name": "One Half Dark",
        //   "black": "#2e3436",
        //   "red": "#cc0000",
        //   "green": "#4e9a06",
        //   "yellow": "#c4a000",
        //   "blue": "#3465a4",
        //   "purple": "#75507b",
        //   "cyan": "#06989a",
        //   "white": "#d3d7cf",
        //   "brightBlack": "#555753",
        //   "brightRed": "#ef2929",
        //   "brightGreen": "#8ae234",
        //   "brightYellow": "#fce94f",
        //   "brightBlue": "#729fcf",
        //   "brightPurple": "#ad7fa8",
        //   "brightCyan": "#34e2e2",
        //   "brightWhite": "#eeeeec",
        //   // "background": "#300a24", //背景色
        //   "foreground": "#eeeeec" //前景色
        },
        {
            "name": "Solarized Dark",
            "black": "#002831",
            "red": "#d11c24",
            "green": "#738a05",
            "yellow": "#a57706",
            "blue": "#2176c7",
            "purple": "#c61c6f",
            "cyan": "#259286",
            "white": "#eae3cb",
            "brightBlack": "#475b62",
            "brightRed": "#bd3613",
            "brightGreen": "#475b62",
            "brightYellow": "#536870",
            "brightBlue": "#708284",
            "brightPurple": "#5956ba",
            "brightCyan": "#819090",
            "brightWhite": "#fcf4dc",
            "background": "#001e27",
            "foreground": "#708284"
        },
        {
            "name": "Solarized Darcula",
            "black": "#25292a",
            "red": "#f24840",
            "green": "#629655",
            "yellow": "#b68800",
            "blue": "#2075c7",
            "purple": "#797fd4",
            "cyan": "#15968d",
            "white": "#d2d8d9",
            "brightBlack": "#25292a",
            "brightRed": "#f24840",
            "brightGreen": "#629655",
            "brightYellow": "#b68800",
            "brightBlue": "#2075c7",
            "brightPurple": "#797fd4",
            "brightCyan": "#15968d",
            "brightWhite": "#d2d8d9",
            "background": "#3d3f41",
            "foreground": "#d2d8d9"
        }     
    ],
    
    // 按键绑定
    "keybindings":
    [
        { "command": "closeWindow", "keys": "alt+f4" }, // 关闭窗口
        { "command": "find", "keys": "ctrl+f" }, // 查找
        { "command": "openNewTabDropdown", "keys": "ctrl+shift+space" },// 打开下拉菜单
        { "command": "openSettings", "keys": "ctrl+," }, // 打开设置文件
        { "command": { "action": "openSettings", "target": "defaultsFile" }, "keys": "ctrl+alt+," }, // 打开设置文件
        { "command": "toggleFullscreen", "keys": "alt+enter" }, // 切换全屏
        { "command": "toggleFullscreen", "keys": "f11" }, // 切换全屏
        { "command": "toggleFocusMode", "keys": "shift+f11" }, // 对焦模式
        { "command": "toggleAlwaysOnTop", "keys": "alt+shift+tab" }, // 始终处于顶部模式
        { "command": { "action": "sendInput", "input": "\u001b[A" }, "keys": "" },//向shell发送任意文本输入
        { "command": "closeTab", "keys": "ctrl+alt+f4" }, // 关闭选项卡
        { "command": "closeOtherTabs" },//关闭其他标签
        { "command": "closeTabsAfter" },//关闭下一个标签
        { "command": "duplicateTab", "keys": "ctrl+shift+d" }, // 复制选项卡
        { "command": "newTab", "keys": "ctrl+shift+t" }, // 新建选项卡
        { "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": "nextTab", "keys": "ctrl+tab" }, // 打开下一个选项卡
        { "command": "prevTab", "keys": "ctrl+shift+tab" }, // 打开上一个选项卡        
        { "command": "tabSearch", "keys": ""},//选项卡搜索
        { "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" }, // 打开特定的选项卡
        { "command": "renameTab", "keys": "ctrl+c" }, // 重命名选项卡
        { "command": { "action": "renameTab", "title": null }, "keys": "" },//重置选项卡名称
        { "command": "openTabRenamer", "keys": "ctrl+alt+a" },//打开tab重命名
        { "command": { "action": "setTabColor", "color": "#ffffff" }, "keys": "ctrl+a" }, // 设置选项卡颜色
        { "command": { "action": "setTabColor", "color": null }, "keys": "" },//重置选项卡颜色
        { "command": "openTabColorPicker", "keys": "ctrl+b" }, // 打开选项卡颜色选取器
        { "command": "closePane", "keys": "ctrl+shift+w" }, // 关闭窗格
        { "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+down" }, // 移动窗格焦点
        { "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" }, // 移动窗格焦点
        { "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" }, // 移动窗格焦点
        { "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" }, // 移动窗格焦点        
        { "command": "togglePaneZoom" },//缩放到窗格
        { "command": { "action": "resizePane", "direction": "down" }, "keys": "alt+shift+down" }, // 调整窗格大小
        { "command": { "action": "resizePane", "direction": "left" }, "keys": "alt+shift+left" }, // 调整窗格大小
        { "command": { "action": "resizePane", "direction": "right" }, "keys": "alt+shift+right" }, // 调整窗格大小
        { "command": { "action": "resizePane", "direction": "up" }, "keys": "alt+shift+up" }, // 调整窗格大小        
        { "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }, // 拆分窗格
        { "command": { "action": "splitPane", "split": "horizontal"}, "keys": "alt+shift+-" }, // 拆分窗格
        { "command": { "action": "splitPane", "split": "vertical"}, "keys": "alt+shift+plus" }, // 拆分窗格        
        { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+c" }, // 复制
        { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+shift+c" }, // 复制
        { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+insert" }, // 复制
        { "command": "paste", "keys": "ctrl+v" }, // 粘贴
        { "command": "paste", "keys": "ctrl+shift+v" }, // 粘贴
        { "command": "paste", "keys": "shift+insert" }, // 粘贴
        { "command": "scrollUp", "keys": "ctrl+shift+up" }, // 向上滚动
        { "command": "scrollDown", "keys": "ctrl+shift+down" }, // 向下滚动
        { "command": "scrollUpPage", "keys": "ctrl+shift+pgup" }, // 向上滚动一整页
        { "command": "scrollDownPage", "keys": "ctrl+shift+pgdn" }, // 向下滚动一整页
        { "command": { "action": "adjustFontSize", "delta": 1 }, "keys": "ctrl+=" }, // 调整字号
        { "command": { "action": "adjustFontSize", "delta": -1 }, "keys": "ctrl+-" }, // 调整字号
        { "command": "resetFontSize", "keys": "ctrl+0" }, // 重置字号
        { "command": "toggleRetroEffect", "keys": "ctrl+d" }// 切换复古终端效果
        //{ "command": "unbound", "keys": "ctrl+q" } // 取消绑定键
    ]
}

Microsoft. PowerShell_profile.ps1

code $PROFILE 打开之后的配置

Import-Module DirColors
Import-Module posh-git
Import-Module oh-my-posh
Import-Module git-aliases -DisableNameChecking

Set-PoshPrompt -Theme Paradox
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值