Windows Terminal
自定义
可以在win10商店中搜索或者
scoop install windows-terminal
Windows Terminal
下拉菜单中点击 Settings 进入配置(或使用快捷键 Ctrl + ,)
而配置文件是一个 JSON 格式的文件,包含以下几个部分:
- 全局配置
Globals
:在配置文件最外侧大括号内的内容,会影响整个窗口的配置。如亮/暗主题,默认打开终端等。 - 环境配置
Profiles
:profiles
内的内容,存放单个环境的配置。这里可以单独配置每个在 Windows Terminal 中打开的终端,如PowerShell,CMD,Git Bash
等。 - 色彩配置 Schemes:schemes 内的内容,放置终端的主题色彩配置。这些配置可以在环境 Profiles 中被单独调用。
- 快捷键配置 Keybindings:Keybindings 内的内容,适用于终端内的自定义快捷键配置
全局配置 Globals
"defaultProfile": "{1a7d2b9e-007f-11eb-adc1-0242ac120002}",//想要默认打开什么终端改为对应的id即可
"startingDirectory": "C:\\sync\\doc",//打开终端的位置
环境配置 Profiles
环境配置包含两大块 defaults 和 lists ,分别为所有环境的默认配置、单个环境的特殊配置
这里可以调整背景配置、字体相关、颜色配置(schemes
相关)、光标配置
在PowerShell
中输入new-guid
就可以新创建一个UUID(guid)
代码插入到 profiles 的 list中
"list":
[
{
"guid": "{1a7d2b9e-007f-11eb-adc1-0242ac120002}",
"name": "Git Bash",
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
"hidden": false, /* 菜单栏显示与否 */
"icon": "C:\\home\\bin\\win10icon\\02.ico", /* 图标位置 */
"backgroundImage": "C:\\home\\bin\\win10icon\\02.ico",//图片路径
"backgroundImageStretchMode": "uniformToFill",//伸缩模式
"backgroundImageOpacity": 0.1,//图片背景透明度
"useAcrylic": true, /* 背景配置开关 */
"acrylicOpacity": 0.6 /* 透明度 */
}
...
]
配色主题 Schemes
都在
shremes
在环境配置中对应环境添加 colorScheme
属性使方案生效
右键 -Windows Terminal 添加到右键菜单,下载terminal.ico,新建一个注册表文件
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt]
@="Windows Terminal here"
"Icon"="图标位置"
[HKEY_CLASSES_ROOT\Directory\Background\shell\wt\command]
@="C:\\Users\\name\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe"
powershell中执行
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck
notepad $PROFILE
# 在 PowerShell 配置文件中,将以下内容添加到文件的末尾:
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"fontFace": "Cascadia Code PL",
"hidden": false
},
WSL Ubuntu 中设置 Powerline
sudo apt install golang-go
go get -u github.com/justjanne/powerline-go
# 自定义 Ubuntu 提示符
nano ~/.bashrc
GOPATH=$HOME/go
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
demo
// This file was initially generated by Windows Terminal Preview 1.4.2652.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// 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": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", //WPS
"defaultProfile": "{c91c3170-5b92-4531-885b-9fa3923cb6f2}", //OMV
// 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,
// 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.
// 选择时复制到剪贴板
"copyOnSelect": true,
// 终端窗口默认大小
"initialCols": 120,
"initialRows": 30,
// "colorScheme": "Flat UI Palette v1 Modified",
"startingDirectory": "C:\\sync\\doc\\git\\git\\" //,
//"colorScheme": "Snazzy"// 颜色主题
// ,"colorScheme": "Campbell"
// ,"fontFace": "CascadiaCodePL"//字体
},
"list": [
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*----WPS----------------------------------------------------------------------------------------------------------------------------------------*/
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "WPS",
"commandline": "powershell.exe",
"hidden": false,
"useAcrylic": true, /* 背景配置开关 */
"acrylicOpacity": 0.5, /* 透明度 */
"colorScheme": "WildCherry",
"fontFace": "Cascadia Code PL"
// "cursorColor": "#000000",
// "backgroundImage": "C:\\sync\\doc\\ico\\WPS.png",
// "backgroundImageStretchMode": "uniformToFill",
// "backgroundImageOpacity": 0.4
// // {
// "acrylicOpacity": 0.7,
// "colorScheme": "Frost",
// "cursorColor": "#000000",
// "fontFace": "Cascadia Code PL",
// "useAcrylic": true
// }
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*---GIT---------------------------------------------------------------------------------------------------------------------------------------*/
{
"guid": "{1a7d2b9e-007f-11eb-adc1-0242ac120002}",
"name": "Git",
"commandline": "C:\\Program Files\\Git\\bin\\bash.exe",
"hidden": false, /* 菜单栏显示与否 */
"useAcrylic": true, /* 背景配置开关 */
"acrylicOpacity": 0.5, /* 透明度 */
"colorScheme": "WildCherry",
"fontFace": "Cascadia Code PL",
"cursorColor": "#000000",
"icon": "C:\\sync\\doc\\repo\\images\\ico\\git.ico" /* 图标位置 */
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*-----PVE--------------------------------------------------------------------------------------------------------------------------------------*/
{
"guid": "{957b369e-ca1d-447e-b565-8b0ce2629f50}",
"name": "PVE",
//指定起始目录 `-t `标志强制执行伪终端分配。 这可用于在远程计算机上执行任意基于屏幕的程序
// "commandline": "ssh -t root@10.1.1.1 \"cd /data/ && exec zsh -l\"",
"commandline": "ssh root@10.1.1.1",
"icon": "C:\\sync\\doc\\repo\\images\\ico\\omv.ico", /* 图标位置 */
"fontFace": "Cascadia Code PL",
"hidden": false,
"colorScheme": "WildCherry",
"useAcrylic": false,
"acrylicOpacity": 0.8,
"padding": "10,10,10,10"
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*-----WSL_DEBIAN--------------------------------------------------------------------------------------------------------------------------------------*/
{
"guid": "{20ea6bc1-0c2b-41b9-a747-5b8c4208bf1c}",
"name": "WSL_DEBIAN",
"commandline": "ssh root@127.0.0.1",
"icon": "C:\\sync\\doc\\repo\\images\\ico\\debian.ico", /* 图标位置 */
"hidden": false
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*-----WSL--------------------------------------------------------------------------------------------------------------------------------------*/
{
"guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
"hidden": false,
"name": "WSL",
"source": "Windows.Terminal.Wsl",
"fontFace": "Cascadia Code PL",
"colorScheme": "WildCherry",
"useAcrylic": false,
"acrylicOpacity": 0.8,
"padding": "10,10,10,10"
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/*------CMD-------------------------------------------------------------------------------------------------------------------------------------*/
{
// Make changes here to the cmd.exe profile.
//CMD
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "CMD",
"commandline": "cmd.exe",
"hidden": false
},
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": true,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
"hidden": false,
"name": "Debian",
"source": "Windows.Terminal.Wsl"
}
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes": [
{
"name": "qs",
"black": "#1e1e1e",
"red": "#ff453a",
"green": "#32d74b",
"yellow": "#ffd60a",
"blue": "#0a84ff",
"purple": "#bf5af2",
"cyan": "#5ac8fa",
"white": "#ffffff",
"brightBlack": "#1e1e1e",
"brightRed": "#ff453a",
"brightGreen": "#32d74b",
"brightYellow": "#ffd60a",
"brightBlue": "#0a84ff",
"brightPurple": "#bf5af2",
"brightCyan": "#5ac8fa",
"brightWhite": "#ffffff",
"background": "#1e1e1e",
"foreground": "#ffffff"
},
{
"name": "midnight-in-mojave",
"black": "#1e1e1e",
"red": "#ff453a",
"green": "#32d74b",
"yellow": "#ffd60a",
"blue": "#0a84ff",
"purple": "#bf5af2",
"cyan": "#5ac8fa",
"white": "#ffffff",
"brightBlack": "#1e1e1e",
"brightRed": "#ff453a",
"brightGreen": "#32d74b",
"brightYellow": "#ffd60a",
"brightBlue": "#0a84ff",
"brightPurple": "#bf5af2",
"brightCyan": "#5ac8fa",
"brightWhite": "#ffffff",
"background": "#1e1e1e",
"foreground": "#ffffff"
},
{
"name": "WildCherry",
"black": "#000507",
"red": "#d94085",
"green": "#2ab250",
"yellow": "#ffd16f",
"blue": "#883cdc",
"purple": "#ececec",
"cyan": "#c1b8b7",
"white": "#fff8de",
"brightBlack": "#009cc9",
"brightRed": "#da6bac",
"brightGreen": "#f4dca5",
"brightYellow": "#eac066",
"brightBlue": "#308cba",
"brightPurple": "#ae636b",
"brightCyan": "#ff919d",
"brightWhite": "#e4838d",
"background": "#1f1726",
"foreground": "#dafaff"
}
],
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions": [
// 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": "closePane",
"keys": "ctrl+w"
},
//copy
{
"command": {
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
//paste
{
"command": "paste",
"keys": "ctrl+v"
},
// 拆分窗格
// In settings.json
{
"command": {
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
},
// In defaults.json
{
"command": {
"action": "splitPane",
"split": "horizontal"
},
"keys": "alt+shift+-"
},
{
"command": {
"action": "splitPane",
"split": "vertical"
},
"keys": "alt+shift+plus"
}
/*----------------------------------------------------------------------------------------------------------------------------------------------------------*/
// Press Ctrl+Shift+F to open the search box
,
{
"command": "find",
"keys": "ctrl+shift+f"
// },
// // 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"
//
}
]
}