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

本文介绍了如何解决GitBash和PowerShell显示乱码的问题,包括修改GitBash的bash.bashrc文件设置中文环境和在Windows Terminal中配置PowerShell的启动参数。同时,详细展示了Windows Terminal的配置文件,包括设置多个终端的启动目录、图标、颜色方案等,并提供了快捷键绑定的例子。

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":</
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值