windowsTerminal集成配置[powershell][gitbash][解决乱码]

0.1 解决gitbash乱码:

在选项里设置文本为: zh_cn,utf-8
F:\Program Files (x86)\gitBash\Git\etc\bash.bashrc末尾添加:

sagar@DESKTOP-QM75KNS MINGW64 /f/prjs/cesium/cesiumEffects/fregata-cesium-web (master)
$ tail -n 15 /f/Program\ Files\ \(x86\)/gitBash/Git/etc/bash.bashrc
shopt -q login_shell || . /etc/profile.d/git-prompt.sh

# 让ls和dir命令显示中文和颜色
alias ls='ls --show-control-chars --color'
alias dir='dir -N --color'
# # 设置为中文环境,使提示成为中文
# export LANG="zh_CN"
# # 输出为中文编码
# export OUTPUT_CHARSET="utf-8"
export LC_ALL=en_US.UTF-8

# 可以输入中文
set meta-flag on
set output-meta on
set convert-meta off

windowsterminal里面的gitbash:

sagar@DESKTOP-QM75KNS MINGW64 /f/prjs/cesium/cesiumEffects/fregata-cesium-web (master)
$ git diff src/routes/index.ts
diff --git a/src/routes/index.ts b/src/routes/index.ts
index 1cb13a4..235460a 100644
--- a/src/routes/index.ts
+++ b/src/routes/index.ts
@@ -131,6 +131,12 @@ export const appRouter = {
    
    
                     path: "dynamicWire",
                     meta: {
    
     title: "动态线", icon: "ios-pin" },
                     component: () => import("@/views/app/case/dynamicWire")
+                },
+                {
    
    
+                    name: "warshipDefendAir",
+                    path: "warshipDefendAir",
+                    meta: {
    
     title: "舰船防空", icon: "ios-pin" },
+                    component: () => import("@/views/app/case/warshipDefendAirScence")
                 }
             ]
         }

0.2 解决powershell乱码

结果:
ps解决乱码
方法:
插入环境变量即可

0.3 windows terminal右键菜单以及pwsh安装

参考:

1 windows terminal配置

注意将powershell还有其他用到exe 的地方加入到环境变量,避免出现找不到exe


    "$schema": "https://aka.ms/terminal-profiles-schema",

    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", //默认终端
    "alwaysShowTabs": true, //始终显示标签
    "initialCols": 120, //默认列数
    "initialRows": 30, //默认行数


    // 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,
    "requestedTheme": "system",//主题
    "showTabsInTitlebar": true,//在标题栏中显示终端窗口标签栏 
    "showTerminalTitleInTitlebar": true,//在标签栏中显示终端标签
    // 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.
            "useAcrylic": true,//使用不透明度
            "acrylicOpacity": 0.66,//不透明度
            "closeOnExit": true,//退出后关闭
            // 启动菜单一定要设置为 <.>,否则后面重要的一步将会无效!
            "startingDirectory": "C:\\Users\\sagar\\Desktop",
            // 字体
            "fontFace": "Consolas",
            "fontSize": 12,
            "historySize": 9001,
            "padding": "5, 5, 20, 25",
            "snapOnInput": true,
            // 颜色
            "colorScheme": "Solarized Dark Higher Contrast"
            // "colorScheme": "Git Flat UI"
            // "colorScheme": "One Half Dark"
        },
        "list":
        [
            {
    
    
                // Powershell 7.1.0-preview.2 配置
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "pwsh 7 (^ ~ ^)",
				"icon": "F:\\Program Files (x86)\\PowerShell7_1\\7\\assets\\Powershell_av_colors.ico",  //设置图标
                // 注意:一定要写上 -nologo,否则开启 powershll 会有一段话输出,很讨厌!
                "commandline": "pwsh.exe -nologo"
            },
            {
    
    
                // gitbash
                "guid": "{564e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "gitbash 7 (^ ~ ^)",
				"icon": "F:\\Program Files (x86)\\PowerShell7_1\\7\\assets\\Powershell_av_colors.ico",  //设置图标
                "startingDirectory": "F:\\prjs\\",
                // 注意:一定要写上 -nologo,否则开启 powershll 会有一段话输出,很讨厌!
                "commandline": "bin\\bash.exe"
            },
            {
    
    
                // 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": "cmd",
                "commandline": "cmd.exe",
                "hidden": false,
                "useAcrylic": true,//使用不透明度
                "acrylicOpacity": 0.75,//不透明度
                "closeOnExit": true,//退出后关闭
                "colorScheme": "Solarized Dark Higher Contrast",
                "cursorColor": "#FFFFFF",//光标颜色
                // 光标类型,可选值 "vintage" ( ▃ ), "bar" ( ┃ ), 
                // "underscore" ( ▁ ), "filledBox" ( █ ), "emptyBox" ( ▯ )
                "cursorShape": "bar",
                "fontFace": "Consolas",//字体
                "fontSize": 12,
                "historySize": 9001,//历史大小
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,//嗅探输入
                "startingDirectory": "%Workspaces%"//初始目录
            },
            {
    
    
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure",
                "useAcrylic": true,//使用不透明度
                "acrylicOpacity": 0.75,//不透明度
                "closeOnExit": true,//退出后关闭
                "colorScheme": "Solarized Dark Higher Contrast",
                "cursorColor": "#FFFFFF",//光标颜色
                // 光标类型,可选值 "vintage" ( ▃ ), "bar" ( ┃ ), 
                // "underscore" ( ▁ ), "filledBox" ( █ ), "emptyBox" ( ▯ )
                "cursorShape": "bar",
                "fontFace": "Consolas",//字体
                "fontSize": 12,
                "historySize": 9001,//历史大小
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,//嗅探输入
                "startingDirectory": "%Workspaces%"//初始目录
            }
            // {
    
    
            //     "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
            //     "hidden": false,
            //     "name": "Ubuntu-20.04",
            //     "source": "Windows.Terminal.Wsl",
            //     "useAcrylic": true,//使用不透明度
            //     "acrylicOpacity": 0.75,//不透明度
            //     "closeOnExit": true,//退出后关闭
            //     "colorScheme": "Solarized Dark Higher Contrast",
            //     "cursorColor": "#FFFFFF",//光标颜色
            //     // 光标类型,可选值 "vintage" ( ▃ ), "bar" ( ┃ ), 
            //     // "underscore" ( ▁ ), "filledBox" ( █ ), "emptyBox" ( ▯ )
            //     "cursorShape": "bar",
            //     "fontFace": "Consolas",//字体
            //     "fontSize": 12,
            //     "historySize": 9001,//历史大小
            //     "padding": "0, 0, 0, 0",
            //     "snapOnInput": true,//嗅探输入
            //     "startingDirectory": "%Workspaces%"//初始目录
            // }
        ]
    },

    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": 
    [
        {
    
    
            "name": "Homebrew",
            "black": "#000000",
            "red": "#FC5275",
            "green": "#00a600",
            "yellow": "#999900",
            "blue": "#6666e9",
            "purple": "#b200b2",
            "cyan": "#00a6b2",
            "white": "#bfbfbf",
            "brightBlack": "#666666",
            "brightRed": "#e50000",
            "brightGreen": "#00d900",
            "brightYellow": "#e5e500",
            "brightBlue": "#0000ff",
            "brightPurple": "#e500e5",
            "brightCyan": "#00e5e5",
            "brightWhite": "#e5e5e5",
            "background": "#283033",
            "foreground": "#00ff00"
        },
        {
    
    
            "name": "Solarized Dark Higher Contrast",
            "black": "#002831",
            "red": "#d11c24",
            "green": "#6cbe6c",
            "yellow": "#a57706",
            "blue": "#2176c7",
            "purple": "#c61c6f",
            "cyan": "#259286",
            "white": "#eae3cb",
            "brightBlack": "#006488",
            "brightRed": "#f5163b",
            "brightGreen": "#51ef84",
            "brightYellow": "#b27e28",
            "brightBlue": "#178ec8",
            "brightPurple": "#e24d8e",
            "brightCyan": "#00b39e",
            "brightWhite": "#fcf4dc",
            "background": "#001e27",
            "foreground": "#9cc2c3"
        },
        {
    
    
            "name": "Solarized Dark - Patched",
            "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": "Obsidian",
            "black": "#000000",
            "red": "#a60001",
            "green": "#00bb00",
            "yellow": "#fecd22",
            "blue": "#3a9bdb",
            "purple": "#bb00bb",
            "cyan": "#00bbbb",
            "white": "#bbbbbb",
            "brightBlack": "#555555",
            "brightRed": "#ff0003",
            "brightGreen": "#93c863",
            "brightYellow": "#fef874",
            "brightBlue": "#a1d7ff",
            "brightPurple": "#ff55ff",
            "brightCyan": "#55ffff",
            "brightWhite": "#ffffff",
            "background": "#283033",
            "foreground": "#cdcdcd"
        },
        {
    
    
            "name": "Campbell",
            "foreground": "#CCCCCC",
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cyan": "#3A96DD",
            "green": "#13A10E",
            "purple": "#881798",
            "red": "#C50F1F",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
    
    
            "name": "UbuntuLegit",
            "foreground": "#EEEEEE",
            "background": "#2C001E",
            "black" : "#4E9A06",
            "blue" : "#3465A4",
            "brightBlack" : "#555753",
            "brightBlue" : "#729FCF",
            "brightCyan" : "#34E2E2",
            "brightGreen" : "#8AE234",
            "brightPurple" : "#AD7FA8",
            "brightRed" : "#EF2929",
            "brightWhite" : "#EEEEEE",
            "brightYellow" : "#FCE94F",
            "cyan" : "#06989A",
            "green" : "#300A24",
            "purple" : "#75507B",
            "red" : "#CC0000",
            "white" : "#D3D7CF",
            "yellow" : "#C4A000"
        },
        {
    
    
            "name": "Dracula",
            "foreground": "#F8F8F2",
            "background": "#282A36",
            "black": "#21222C",
            "blue": "#F1FA8C",
            "brightBlack": "#6272A4",
            "brightBlue": "#D6ACFF",
            "brightCyan": "#A4FFFF",
            "brightGreen": "#69FF94",
            "brightPurple": "#FF92DF",
            "brightRed": "#FF6E6E",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFFA5",
            "cyan": "#8BE9FD",
            "green": "#50FA7B",
            "purple": "#BD93F9",
            "red": "#FF5555",
            "white": "#F8F8F2",
            "yellow": "#F1FA8C"
        },
        {
    
    
            "name" : "One Half Dark",
            "foreground" : "#DCDFE4",
            "background" : "#282C34",
            "black" : "#282C34",
            "blue" : "#008cff",
            "brightBlack" : "#008cff",
            "brightBlue" : "#008cff",
            "brightCyan" : "#56B6C2",
            "brightGreen" : "#98C379",
            "brightPurple" : "#C678DD",
            "brightRed" : "#E06C75",
            "brightWhite" : "#DCDFE4",
            "brightYellow" : "#E5C07B",
            "cyan" : "#56B6C2",
            "green" : "#98C379",
            "purple" : "#C678DD",
            "red" : "#E06C75",
            "white" : "#DCDFE4",
            "yellow" : "#E5C07B"
        },
        {
    
    
            "name": "Atom",
            "foreground": "#c5c8c6",
            "background": "#161719",
            "black": "#000000",
            "blue": "#85befd",
            "brightBlack": "#000000",
            "brightRed": "#fd5ff1",
            "brightGreen": "#94fa36",
            "brightYellow": "#f5ffa8",
            "brightBlue": "#96cbfe",
            "brightPurple": "#b9b6fc",
            "brightCyan": "#85befd",
            "brightWhite": "#e0e0e0",
            "cyan": "#85befd",
            "green": "#87c38a",
            "purple": "#b9b6fc",
            "red": "#fd5ff1",
            "white": "#e0e0e0",
            "yellow": "#ffd7b1"
        },
        {
    
    
            "name": "Git Flat UI",
            "foreground": "#DCDFE4",
            "background": "#1A1A1A",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#19A33A",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cyan": "#56B6C2",
            "green": "#19A33A",
            "purple": "#C678DD",
            "red": "#E06C75",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        }
    ],

    // Add custom keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about keybindings, visit https://aka.ms/terminal-keybindings
    "keybindings":
    [
        // 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" : "newTab", "keys" : ["ctrl+N"] },
        {
    
     "command" : "closeTab", "keys" : ["ctrl+w"] },
        {
    
     "command" : "closePane", "keys" : ["ctrl+w"]},
        {
    
     "command" : "copy", "keys" : ["ctrl+c"]},
        {
    
     "command" : "paste","keys" : ["ctrl+v"]},
        {
    
     "command" : "find","keys" : ["ctrl+f"]},//搜索框
        {
    
     "command" : "splitVertical", "keys": ["alt+-"]},//垂直方向分屏
        {
    
     "command" : "splitHorizontal", "keys": ["alt+="]},//水平方向分屏
        {
    
     "command" : "increaseFontSize", "keys": ["ctrl+]"]},//增大字体
        {
    
     "command" : "decreaseFontSize", "keys": ["ctrl+["]},//减小字体
        {
    
     "command" : "duplicateTab", "keys" : ["ctrl+shift+d"]},
        {
    
     "command" : "newTabProfile0","keys" : ["ctrl+shift+1"]},
        {
    
     "command" : "newTabProfile1","keys" : ["ctrl+shift+2"]},
        {
    
     "command" : "newTabProfile2","keys" : ["ctrl+shift+3"]},
        {
    
     "command" : "newTabProfile3","keys" : ["ctrl+shift+4"]},
        {
    
     "command" : "newTabProfile4", "keys" : ["ctrl+shift+5"]},
        {
    
     "command" : "newTabProfile5","keys" : ["ctrl+shift+6"]},
        {
    
     "command" : "newTabProfile6","keys" : ["ctrl+shift+7"]},
        {
    
     "command" : "newTabProfile7","keys" : ["ctrl+shift+8"]},
        {
    
     "command" : "newTabProfile8","keys" : ["ctrl+shift+9"]},        
        {
    
     "command" : "openNewTabDropdown","keys" : ["ctrl+shift+space"]},
        {
    
     "command" : "openSettings","keys" : ["ctrl+,"]},//打开配置文件
        {
    
     "command" : "nextTab","keys" : ["ctrl+tab"]},//上一个tab
        {
    
     "command" : "prevTab","keys" : ["ctrl+shift+tab"]},//下一个tab
        {
    
     "command" : "scrollDown","keys" : ["ctrl+shift+down" ]},//向下滚动        
        {
    
     "command" : "scrollUp","keys" : ["ctrl+shift+up"]},//向上滚动
        {
    
     "command" : "scrollUpPage","keys" : ["pgup"]},//向上翻页
        {
    
     "command" : "scrollDownPage","keys" : ["pgdn"]},//向下翻页
        {
    
     "command" : "switchToTab0","keys" : ["ctrl+alt+1"]},
        {
    
     "command" : "switchToTab1","keys" : ["ctrl+alt+2"]},
        {
    
     "command" : "switchToTab2","keys" : ["ctrl+alt+3"]},
        {
    
     "command" : "switchToTab3","keys" : ["ctrl+alt+4"]},
        {
    
     "command" : "switchToTab4","keys" : ["ctrl+alt+5"]},
        {
    
     "command" : "switchToTab5","keys" : ["ctrl+alt+6"]},
        {
    
     "command" : "switchToTab6","keys" : ["ctrl+alt+7"]},
        {
    
     "command" : "switchToTab7","keys" : ["ctrl+alt+8"]},
        {
    
     "command" : "switchToTab8","keys" : ["ctrl+alt+9"]},
        {
    
     "command": {
    
    "action": "copy", "singleLine": false }, "keys": "ctrl+c" },
        // Press Ctrl+Shift+F to open the search box
        // 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" }
    ]
}

猜你喜欢

转载自blog.csdn.net/cxy_hust/article/details/115348007