标签归档:Windows Terminal

Cmder + Windows Terminal + PhpStrom/PyCharm/IDEA

Cmder是一个可用于linux的便携式控制台虚拟器,可以让你在windows下使用linux命令。

Windows Terminal是Windows 10的控制台管理界面。

IDEA是广大开发人员的最爱。

本文介绍如何将Cmder整合到Windows Terminal和IDEA。

file

安装Cmder

可以去 https://cmder.net/ 下载最新的压缩文件,解压后点击Cmder.exe即可使用。如果已经安装了git for windows下载mini版本就可以了,否则可以下载包含git的full版本。

设置系统环境变量

以下d:\tools\Cmder是Cmder解压目录

CMDER_ROOT = d:\tools\Cmder

配置 Windows Terminal

生成guid

进入Power shell,输入New-Guid

PS C:\Users\Administrator> New-Guid

Guid
----
092f8948-9ea5-4928-bea7-a1f71938e717

修改 Windows Terminal 配置文件

点击Windows Terminal的下拉菜单,选择“配置”,会打开它的配置文件

增加

{
  "guid": "{092f8948-9ea5-4928-bea7-a1f71938e717}",
  "name": "Cmder",
  "commandline": "cmd.exe /k %CMDER_ROOT%\\vendor\\init.bat",
  "startingDirectory": "%USERPROFILE%",
  "icon": "%CMDER_ROOT%\\icons\\cmder.ico",
  "background": "#2e3436",
  "padding": "15",
  "fontFace": "Cascadia Code",
  "fontSize": 10
}

然后修改

"defaultProfile": "Cmder",

Windows Terminal 使用效果

点击Windows Terminal的加号,查看效果

file

配置 PhpStorm/IDEA/PyCharm

配置 PhpStorm

打开 PhpStrom 的设置,找到 Tools 下的 terminal 修改 Shell path"cmd" /k ""%CMDER_ROOT%\vendor\init.bat""

file

PhpStrom 配置后效果

file

Windows Terminal支持ssh,git-bash,wsl, msys

打开 profiles.json 配置文件

打开Windows Terminal,点击设置,可以看到,复制增加一组ssh配置,然后修改三个地方。

{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},

修改guid

利用powershell可以生成guid

powershell -Command "[guid]::NewGuid().ToString()"

修改名字

任意,可以是系统名字,IP,用户名等,如 username@aliyun-bj

修改commandline

ssh -i C:\user\username\id_rsa username@aliyun-bj

其中i参数后面为证书存放位置,如果试用密码登录可以不填

完整SSH支持(图标,配色等)

 {
     "acrylicOpacity" : 1,
     "closeOnExit" : true,
     "colorScheme" : "One Half Dark",
     "commandline" : "ssh username@aliyun-bj",
     "cursorColor" : "#FFFFFF",
     "cursorShape" : "bar",
     "fontFace" : "Consolas",
     "fontSize" : 14,
     "guid" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
     "historySize" : 9001,
     "icon" : "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",
     "name" : "username@aliyun-bj",
     "padding" : "0, 0, 0, 0",
     "snapOnInput" : true,
     "startingDirectory" : "",
     "useAcrylic" : false
 }

 支持Git-bash

{
            "guid": "{7f0152b2-c491-4bb6-8a87-610352d630c8}",
            "acrylicOpacity" :1,
            "closeOnExit" : true,
            "colorScheme" : "Campbell",
            "commandline" : "\"%PROGRAMFILES%\\Git\\Bin\\bash.exe\" -i -l",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 14,
            "historySize" : 9001,
            "icon" : "%PROGRAMFILES%\\Git\\mingw64\\share\\git\\git-for-windows.ico",
            "name" : "Git-bash",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : "%USERPROFILE%",
            "useAcrylic" : true
        }

WSL

        {
            "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
            "hidden": false,
            "name": "Ubuntu",
            "source": "Windows.Terminal.Wsl"
        },

msys2

 {
                "guid": "{17da3cac-b318-431e-8a3e-7fcdefe6d114}",
                "name": "MINGW64 / MSYS2",
                "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw64",
                "startingDirectory": "C:/msys64/home/%USERNAME%",
                "icon": "C:/msys64/mingw64.ico",
                "fontFace": "Lucida Console",
                "fontSize": 9
            },
            {
                "guid": "{2d51fdc4-a03b-4efe-81bc-722b7f6f3820}",
                "name": "MINGW32 / MSYS2",
                "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw32",
                "startingDirectory": "C:/msys64/home/%USERNAME%",
                "icon": "C:/msys64/mingw32.ico",
                "fontFace": "Lucida Console",
                "fontSize": 9
            },
            {
                "guid": "{71160544-14d8-4194-af25-d05feeac7233}",
                "name": "MSYS / MSYS2",
                "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -msys",
                "startingDirectory": "C:/msys64/home/%USERNAME%",
                "icon": "C:/msys64/msys2.ico",
                "fontFace": "Lucida Console",
                "fontSize": 9
            }

参考