简介
Windows Terminal 是一个现代化、多标签的终端应用程序,专为使用命令行工具设计。它提供了许多强大且灵活的功能,可以替代经典的命令提示符和 PowerShell 窗口。
主要特性:
- 多标签页支持
- 分屏功能
- 自定义主题
- 丰富的快捷键
- 支持多种 Shell(PowerShell、CMD、WSL 等)
安装
安装方式
Microsoft Store
- 直接安装
- 优点:自动更新,安装简单
GitHub 发布页
- 下载最新版本
- 优点:可以获取最新特性
包管理器安装(推荐)
1 2 3 4 5
# 使用 scoop 安装 scoop install windows-terminal # 使用 winget 安装 winget install Microsoft.WindowsTerminal
安装 PowerShell Core
Windows Terminal 推荐使用 PowerShell Core(跨平台版本)而不是系统自带的 PowerShell:
|
|
基础配置
常用快捷键
功能 | 快捷键 |
---|---|
新建标签页 | Ctrl + Shift + T |
切换标签页 | Ctrl + Tab |
右分屏 | Alt + Shift + + |
下分屏 | Alt + Shift + - |
打开设置 | Ctrl + , |
打开命令面板 | Ctrl + Shift + P |
自定义快捷键
在 settings.json 中配置自定义快捷键:
|
|
美化配置
1. 配置字体
下载等宽字体
- 推荐使用 Cascadia Code PL
- 其他选择:JetBrains Mono、Fira Code
配置字体设置
1 2 3 4 5 6 7 8
{ "defaults": { "font": { "face": "Cascadia Code PL", "size": 10.0 } } }
2. 配置 oh-my-posh
安装 oh-my-posh
|
|
更新 oh-my-posh
|
|
配置主题
下载主题
保存主题文件
1 2 3 4 5
# 创建主题目录 New-Item -ItemType Directory -Force -Path "D:\Tools\oh-my-posh\themes" # 下载主题文件 Invoke-WebRequest -Uri "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/powerlevel10k_lean.omp.json" -OutFile "D:\Tools\oh-my-posh\themes\powerlevel10k_lean.omp.json"
配置 PowerShell 配置文件
1 2 3 4 5
# 创建配置文件 if (!(Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force } # 编辑配置文件 code $PROFILE
添加配置内容
1 2 3 4 5 6 7 8 9 10
# 初始化 oh-my-posh oh-my-posh init pwsh --config D:\Tools\oh-my-posh\themes\powerlevel10k_lean.omp.json | Invoke-Expression # 配置命令补全 Import-Module PSReadLine Set-PSReadLineOption -PredictionSource History Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete # 清屏 cls
验证配置
1 2 3 4 5
# 重新加载配置文件 . $PROFILE # 检查 oh-my-posh 是否正确加载 $env:POSH_THEMES_PATH
实用功能
1. 代理管理
|
|
2. 快速打开文件夹
|
|
3. 环境变量管理
|
|