天天看点

Windows Terminal安装和配置

参考:https://zhuanlan.zhihu.com/p/137595941(知乎)

           https://www.bilibili.com/video/BV11y4y147y4(B站)

           https://www.cnblogs.com/taylorshi/p/13265262.html(博客园)

1. 安装 Windows Terminal

去 Microsoft Store 搜索下载并默认安装位置。

2. 安装字体

Fira Code。该字体支持 ligature 连字功能,而且是一款专门为代码显示准备的字体。该字体开源,广受海内外程序员好评!

地址:https://github.com/ryanoasis/nerd-fonts

Windows Terminal安装和配置

3. 安装新款 Powershell Core

自带的 Powershell 错误提示冗长,颜值低,速度慢,总之就是不值得去用。在 https://github.com/PowerShell/PowerShell/releases 这个GitHub 链接里,有目前 Powershell 的最新版,我建议你从 release 里选个最新的 preview 版本。经过测试,这些预览版都相当稳定。

Windows Terminal安装和配置

 4. 安装 Powershell 插件

打开刚装好的新版 powershell,管理员打开然后逐行输入命令。

# 1. 安装 PSReadline 包,该插件可以让命令行很好用,类似 zsh
Install-Module -Name PSReadLine -AllowPrerelease -Force

# 2. 安装 posh-git 包,让你的 git 更好用
Install-Module posh-git -Scope CurrentUser

# 3. 安装 oh-my-posh 包,让你的命令行更酷炫、优雅
Install-Module oh-my-posh -Scope CurrentUser
           

如果有选择,则一律选择Y或者A

5. 配置 Windows Terminal

文档:https://download.csdn.net/download/zz2230633069/20350766

复制黏贴该文档内容到windows terminal   setting.json文件中

6. 添加右键菜单

https://link.zhihu.com/?target=https%3A//github.com/LittleNewton/windows_terminal_here

建议下载上述的脚本,然后在管理员模式的 powershell 7 里运行:

.\install.ps1
           

记住一定要以管理员身份在 powershell 7 里面运行该脚本。 

目前发现问题:该脚本会读取 Windows Terminal 的 profile,然后把其中的非隐藏项目添加到右键菜单(默认视图),这之后如果你修改了 profile,那么需要用

uninstall.ps1

脚本先清除右键菜单,然后重新 install 一遍。

7. 添加 Powershell 启动参数

在 powershell 中输入

notepad.exe $Profile
           

 如果没有配置(参考:https://www.cnblogs.com/taylorshi/p/13265262.html),先执行下面命令,再操作上面的

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
           

然后在弹出的文档中复制和粘贴下载的配置文档内容(下载该文档配置https://download.csdn.net/download/zz2230633069/20350757)到该文件中即可。

继续阅读