Windows Terminal 配置(安装+主题+ssh+anaconda)

您所在的位置:网站首页 windows设置主题 Windows Terminal 配置(安装+主题+ssh+anaconda)

Windows Terminal 配置(安装+主题+ssh+anaconda)

2023-08-06 12:19| 来源: 网络整理| 查看: 265

Windows Terminal

发现一个很好用的windows shell 工具,简单写一下配置过程。主要内容有安装、主题配置、ssh、anaconda

先看一下效果

   

1 安装

两种方式,微软商店下载或者github上下载源码编译安装。我是通过微软商店安装,安装比较简单,不作赘述。

2 配置

ctrl+,或者点设置打开json配置文件。结构如下。

{    "$schema": "https://aka.ms/terminal-profiles-schema",    "defaultProfile": "{f079d4b3-332a-4fba-b8f7-1a9627c0dbf4}",    "profiles": [       {   },   ],        "schemes": [       { },           ],      "keybindings": [] }

defaultProfile标识默认打开的shell。

profiles定义shell的启动样式。

schemes样式主题

profiles:

"profiles": [       {           "background": "#000000",            "backgroundImage": "C://Users//liufeng02//Pictures//wallhaven-kweglm.jpg",            "backgroundImageOpacity": 0.4,            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",            "name": "Windows PowerShell",            "commandline": "powershell.exe",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false,            "tabTitle": "Powershell"       },   ],

background背景颜色

backgroundImage背景图片

backgroundImageOpacity背景图片透明度

guid启动标识,区分powershell、CMD、Azure...

将defalutProfile设置为该guid,则使用该项作为默认启动。

name名字,标题。自起

commandline启动命令。

powershell 为powershell.exe,其他的类似,比较灵活。

colorScheme设置主题,对应schemes

schemes:

简单的主题颜色设置,感兴趣的自己研究。后边会贴上自用的主题配色。

3 WT上ssh配置

过程比较简单,在profiles中新加一个项目,可以复制cmd的,然后改几个参数:

更换guid,从网上搜guid,在线生成一个复制到此处。"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}"

更换commandline,格式为"commandline": "ssh userid@ipaddr -p port"举例:"commandline": "ssh [email protected] -p 22"

更换name

保存一下即可。

{            // Make changes here to the cmd.exe profile            "background": "#000000",            "backgroundImage": "C://Users//adm//Pictures//wallhaven-ox83gp.jpg",            "backgroundImageOpacity": 0.5,            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",            "name": "cmd",           "commandline": "ssh [email protected] -p 22",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false }, 4 WT上配置anaconda Prompt

因为平时主要是写python,anaconda用的比较多,所以配置一个快速进入anaconda环境的shell。

原理比较简单,主要是参考了anaconda生成的快捷方式。找到anaconda的快捷方式,右键->属性。

 

复制“目标”,%windir%\System32\cmd.exe "/K" D:\ProgramData\Anaconda3\Scripts\activate.bat D:\ProgramData\Anaconda3 可以看到anaconda prompt实际是用了cmd的参数。cmd "/k"

复制目标内容到commandline,做一下简单修改。因为\在json中会被作为转义字符,将\修改为//,将"做一下转义改为\"。修改后:"commandline": "%windir%//System32//cmd.exe \"\/K\" D://ProgramData//Anaconda3//Scripts//activate.bat D://ProgramData//Anaconda3"

注意将D://ProgramData//Anaconda3//Scripts//activate.bat和D://ProgramData//Anaconda3改为你实际安装的anaconda地址。

如果anaconda配过环境变量,写法会更简单。例如打开base环境的conda prompt

"commandline": "cmd *\"\/*k*\"* activate base"。

5 配置右键快捷方式

修改配置文件,在"profiles":每个项目下,新加一行。

"startingDirectory": null

 

添加注册表

注意将目录修改为实际地址

Windows Registry Editor Version 5.00 ​ [HKEY_CLASSES_ROOT\Directory\Background\shell\wt] @="Windows Terminal here (&T)" "Icon"="C:\\Users\\adm\\AppData\\Loca\\WindowsTerminal\\terminal.ico" ​ [HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command] @="C:\\Users\\adm\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe" "Icon"="C:\\Users\\adm\\AppData\\Loca\\WindowsTerminal\\terminal.ico"

中的图标可以在https://raw.githubusercontent.com/microsoft/terminal/master/res/terminal.ico 下载

6 配置文件 // 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": "{f079d4b3-332a-4fba-b8f7-1a9627c0dbf4}",    "profiles": [       {            // Make changes here to the powershell.exe profile            "background": "#000000",            "backgroundImage": "C://Users//adm//Pictures//wallhaven-kweglm.jpg",            "backgroundImageOpacity": 0.4,            "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",            "name": "Windows PowerShell",            "commandline": "powershell.exe",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false,            "tabTitle": "Powershell"       },       {            "background": "#000000",            "backgroundImage": "C://Users//adm//Pictures//wallhaven-vg62gm.jpg",            "backgroundImageOpacity": 0.2,            "guid": "{f079d4b3-332a-4fba-b8f7-1a9627c0dbf4}",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false,            "name": "Anaconda Base",            "commandline": "cmd \"\/k\" activate base"            // "commandline": "%windir%//System32//cmd.exe \"\/K\" D://ProgramData//Anaconda3//Scripts//activate.bat D://ProgramData//Anaconda3"       },       {            // Make changes here to the cmd.exe profile            "background": "#000000",            "backgroundImage": "C://Users//adm//Pictures//wallhaven-ox83gp.jpg",            "backgroundImageOpacity": 0.5,            "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",            "name": "cmd",            "commandline": "cmd.exe",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false       },        // {        //     "background": "#000000",        //     "backgroundImage": "C://Users//adm//Pictures//Snipaste.png",        //     "backgroundImageOpacity": 0.6,        //     "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",        //     "colorScheme": "Solarized Darcula",        //     "useAcrylic": false,        //     "closeOnExit": true,        //     "acrylicOpacity": 0.25,        //     "cursorColor": "#FFFFFF",        //     "fontFace": "Delugia Nerd Font",        //     "hidden": false,        //     "name": "Azure Cloud Shell",        //     "source": "Windows.Terminal.Azure"        // },       {            "background": "#000000",            "backgroundImage": "C://Users//adm//Pictures//Snipaste.png",            "backgroundImageOpacity": 0.6,            "guid": "{0597088d-4547-442a-8ffe-0524d3433c32}",            "colorScheme": "Solarized Darcula",            "useAcrylic": false,            "closeOnExit": true,            "acrylicOpacity": 0.25,            "cursorColor": "#FFFFFF",            "fontFace": "Delugia Nerd Font",            "hidden": false,            "name": "SSH_HOME",            "commandline": "ssh [email protected] -p 22" ​       },         {            "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",            "hidden": false,            "name": "Azure Cloud Shell",            "source": "Windows.Terminal.Azure"       }   ],    // Add custom color schemes to this array    "schemes": [       {            "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"         } ,             {            "name": "AdventureTime",            "black": "#050404",            "red": "#bd0013",            "green": "#4ab118",            "yellow": "#e7741e",            "blue": "#0f4ac6",            "purple": "#665993",            "cyan": "#70a598",            "white": "#f8dcc0",            "brightBlack": "#4e7cbf",            "brightRed": "#fc5f5a",            "brightGreen": "#9eff6e",            "brightYellow": "#efc11a",            "brightBlue": "#1997c6",            "brightPurple": "#9b5953",            "brightCyan": "#c8faf4",            "brightWhite": "#f6f5fb",            "background": "#1f1d45",            "foreground": "#f8dcc0"       }   ],    // Add any keybinding overrides to this array.    // To unbind a default keybinding, set the command to "unbound"    "keybindings": [] }

 



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3