Windows Terminal 配置指南

Windows Terminal 配置指南

打造现代化的 Windows 终端体验

📋 目录

🚀 软件安装

必需软件

bash 复制代码
# 安装 PowerShell 7
winget install Microsoft.PowerShell

# 安装 Starship 提示符
winget install --id Starship.Starship

# 安装系统信息工具
winget install fastfetch

# 安装 Neovim 编辑器
winget install Neovim.Neovim

可选软件

bash 复制代码
# 安装 Git
winget install Git.Git

# 安装 Node.js
winget install OpenJS.NodeJS

# 安装 Python
winget install Python.Python.3.11

⚙️ 基础配置

设置默认终端

  1. 打开 Windows Terminal
  2. Ctrl + , 打开设置
  3. 在左侧选择 "启动"
  4. 将默认配置文件设置为 "PowerShell"

启用 Tab 补全

参考官方文档:在 shell 中使用 Tab 键补全

🔧 PowerShell 配置

编辑配置文件

powershell 复制代码
# 打开 PowerShell 配置文件
nvim $PROFILE

# 或者使用记事本
notepad $PROFILE

基础配置示例

powershell 复制代码
# 初始化 Starship 提示符
Invoke-Expression (&starship init powershell)

# 设置别名
Set-Alias vi nvim
Set-Alias ll ls
Set-Alias g git

# 设置默认编码
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

# 启用历史记录
Set-PSReadLineOption -HistorySavePath "$env:USERPROFILE\.powershell_history"

# 启用预测文本
Set-PSReadLineOption -PredictionSource History

🎨 主题美化

Starship 配置

创建 ~/.config/starship.toml 文件:

toml 复制代码
# 获取配置架构
format = """
[┌─](bold green)$username$hostname$directory$git_branch$git_status
[└─](bold green)$character"""

[character]
success_symbol = "[➜](bold green)"
error_symbol = "[✗](bold red)"

[directory]
style = "blue bold"
truncation_length = 3
truncation_symbol = ".../"

[git_branch]
symbol = " "
style = "bold purple"

[git_status]
style = "bold red"
ahead = "⇡\${count}"
behind = "⇣\${count}"
diverged = "⇕⇡\${ahead_count}⇣\${behind_count}"
untracked = "?"
modified = "!"
staged = "+"
renamed = ">>"
deleted = "✘"

Windows Terminal 主题

推荐使用以下主题:

  • Dracula - 经典深色主题
  • One Dark Pro - 现代化主题
  • Material Theme - Material Design 风格

💡 实用技巧

快捷键

快捷键 功能
Ctrl + Shift + T 新建标签页
Ctrl + Shift + W 关闭标签页
Ctrl + Shift + D 垂直分割
Ctrl + Shift + E 水平分割
Alt + ←/→ 切换标签页
Ctrl + Shift + ←/→ 调整分割大小

常用命令

powershell 复制代码
# 查看系统信息
fastfetch

# 快速打开常用目录
function code { Set-Location "C:\Users\$env:USERNAME\Documents\code" }
function docs { Set-Location "C:\Users\$env:USERNAME\Documents" }

# Git 快捷命令
function gs { git status }
function ga { git add . }
function gc { git commit -m $args[0] }
function gp { git push }

📚 相关资源

官方文档

替代方案

实用链接

🔄 更新维护

定期更新

bash 复制代码
# 更新所有 winget 包
winget upgrade --all

# 更新 Starship
winget upgrade Starship.Starship

备份配置

建议定期备份以下文件:

  • $PROFILE - PowerShell 配置文件
  • ~/.config/starshell.toml - Starship 配置
  • Windows Terminal 设置文件
相关推荐
两万五千个小时21 小时前
DeepSeek Harness 上下文拼接:让 AI 准确行动
人工智能·程序员·架构
深海鱼在掘金1 天前
深入浅出RAG——第7章:基础篇实战:文档问答机器人
人工智能·typescript·命令行
leobertlan1 天前
【好玩系列】训练一个神经网络指导小孩玩游戏
android·机器学习·程序员
bytemaster1 天前
GPT-5.6 三模之争:Sol、Terra、Luna 加六档推理,到底该怎么选
人工智能·程序员
两万五千个小时1 天前
DeepSeek Harness 的动力引擎:Agent Loop 是怎么转起来的
人工智能·程序员·架构
安逸Ai1 天前
Batch Normalization 和 Layer Normalization 有什么用?
人工智能·机器学习·程序员
捡田螺的小男孩3 天前
什么是 Skill?手把手带你写一个简单有用的 Skill!
前端·后端·程序员
程序员小新7003 天前
浅聊大模型调用参数配置
程序员
newerp3 天前
Go net/http 标准库基础
后端·程序员·go
无我Code4 天前
开发者-2026年中总结
前端·面试·程序员