vscode 中使用新windows terminal 并修改主题

本文指导如何在Visual Studio Code (VSCode)中安装和配置Windows Terminal,包括修改配置文件、切换主题、安装字体,以及在VSCode中使用新终端。同时,文章提到了遇到的一些问题及其解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文链接: vscode 中使用新windows terminal 并修改主题

上一篇: vite2 引入 vectorize-text 不起作用的问题 [未解决]

下一篇: 修改 windows terminal 和powershell中git提示信息

目前没有找到能在vscode中使用的办法... 建议还是cmder吧, 不要瞎折腾了

还是gg好啊, 找了一会就找到了, 浪费我几个小时用bing和百度...

我单方面宣布, 这就是最好看的windows终端了

up-aa83a4227cc69d7ac66f3556afa6188ee5e.png

https://docs.microsoft.com/zh-cn/windows/terminal/

https://github.com/microsoft/terminal

https://iterm2colorschemes.com/

https://windowsterminalthemes.dev/

https://medium.com/analytics-vidhya/how-to-replace-external-terminal-in-visual-studio-code-with-the-new-windows-terminal-66e8460f2d31

cmder太慢了...所以想试试windows terminal

安装

直接在应用商店安装就行

up-43007ba6b5216164cb48dbbe91afac8429e.png

这个看着是触摸板和手写板的问题

up-3b5b9593116cdbb4c9309ce2370e78190eb.png

修改配置文件

~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\profiles.json

主题切换

https://github.com/Crawler995/wtcolor

报错 https://blog.csdn.net/hl971115/article/details/102078132

wtcolor : 无法加载文件 C:\Users\Ace\AppData\Roaming\npm\wtcolor.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 h
ttps:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。

up-b38be754b0f274f58845a2652e48ef34368.png

以管理员身份运行ps, 然后重新设置模式

up-484d8e55cb18a25111b0d72a3593bc3479e.png

报错, 原因是文件名修改了

× Open config file failed! Please check the given path.

C:\Users\Ace\AppData\Roaming\npm\node_modules\wtcolor

up-36b2cf6f6c91a9dbd26869dd468b9a67e82.png

安装git支持, powershell 管理员模式运行

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

创建配置文件, 使用$PROFILE可以看到文件位置

New-Item -ItemType file -Path $PROFILE  -Force

在配置文件中加入

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme PowerlinePlus

up-24b6cf95c2aaaaa1d0685e464f8e11672ac.png

up-fa2e7ed40cb7b49d39485663f884576d4cb.png

安装字体

选择ttf, 然后全部安装

https://github.com/microsoft/cascadia-code/releases

up-049bef65c419e120fed6e522627ae7628b7.png

up-cdccbc35f03ce4debaa75a085fffe267518.png

查看主题

Get-Theme

up-a8bd08e7d41696c21f7ed72df7673fc9f1c.png

加入右键菜单

添加注册表, Terminal是新建项, command也是新建项, Icon是新建字符串, command中的值是wt的位置, 图标用的cmder的

where wt
C:\Users\Ace\AppData\Local\Microsoft\WindowsApps\wt.exe

up-a6db29786400e91296d7ef12e8a1ed5e1af.png

up-8c20b354b8e6a595a57064be1e86325c21b.png

wt添加启动目录

up-b37880d9ed90047733970a2832aa8c9451e.png

up-dc6a1901c778398255dffda48fba5bf11a5.png

好像也慢了不少啊....

up-7ee066a101d6279a5bef1054cb437700e42.png

在vscode中使用

好像没有解决办法... 每次都会重新弹出来一个新窗口...

  "terminal.external.windowsExec": "wt -p cmd cmd",

up-1ffbc83c14d4f22cb7f56988fd5d75b0539.png

修改配置文件

  "profiles": {
    "defaults": {
      //   "startingDirectory": "./",
      "startingDirectory": "%__CD__%",
      "fontFace": "Fira Code",
      "fontSize": 16,
      "useAcrylic": true,
      "snapOnInput": true,
      "supportApplicationTitle": true
      // Put settings here that you want to apply to all profiles.
    },

用这种方式吧, ps也是一样的 , 并且可以去除开始的文字, 可以少加一个clear

  "terminal.integrated.shell.windows": "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe",
  "terminal.integrated.shellArgs.windows": ["-nologo"],

up-24f5546aaccfd14f93d07398bd9efe32b18.png

### 配置 VSCode 终端以优化代码执行 为了提升在 Visual Studio Code (VSCode) 中使用终端运行代码的体验,可以采取多种措施来增强效率和便利性。 #### 自定义终端配置文件 通过修改 `settings.json` 文件中的相关选项,能够自定义终端的行为。例如: - **集成终端路径**: 可指定特定版本的命令行工具作为默认终端[^1]。 ```json { "terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe" } ``` - **自动激活虚拟环境**: 如果经常处理 Python 项目,则可以在打开工作区时自动激活对应的虚拟环境。 ```bash # .vscode/settings.json 或者全局 user settings "python.terminal.activateEnvironment": true, ``` #### 使用任务(Task)简化操作流程 创建注册任务可以让开发者一键完成编译、构建以及测试等一系列动作。这不仅提高了工作效率还减少了手动输入指令的可能性错误。 - 定义 `.vscode/tasks.json` 来描述所需的任务逻辑;支持预设模板快速搭建常见编程语言的支持框架。 ```json { "version": "2.0.0", "tasks": [ { "label": "build and run", "command": "${workspaceFolder}/build.sh && python ${file}", "group": { "kind": "build", "isDefault": true }, "problemMatcher": [] } ] } ``` #### 扩展插件助力开发过程 安装合适的扩展程序有助于进一步改善用户体验。比如,“Code Runner” 插件允许直接右键点击源码文件内的任意位置选择 “Run Code”,它会自动检测当前编辑器的语言模式将相应解释器/编译器的结果输出至内置控制台窗口中显示出来[^2]。 ```json // 示例:启用 code runner 输出到内部终端而非专用面板 { "code-runner.runInTerminal": true } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值