Windows Terminal配置2023.3

重装系统

成品效果图

在这里插入图片描述

配置PowerShell步骤

PowerShell + oh-my-posh + posh-git+PSReadLine
  1. 应用商店Micorsoft Store 更新Windows Terminal(因为Win11 自带的可能不是最新的,功能不全)

  2. 在商店Micorsoft Store 顺便下载PowerShell
    Windows PowerShell 5.1 是在 .NET Framework v4.5 基础上构建的,PowerShell 成为基于 .NET Core 2.0 构建的开源项目,成为可跨平台的解决方案。 PowerShell 在 Windows、macOS 和 Linux 上运行
    在这里插入图片描述

  3. 安装美化插件OhMyPosh

    • 方式一:通过Micorsoft Store 应用商店下载(PS:这种方式简单,但有时无法安装成功)在这里插入图片描述
    • 方式二:通过PowerShell 执行命令 winget install JanDeDobbeleer.OhMyPosh -s winget(不要再使用以前教程中的Install-Module命令来安装了,官网中已经没有这种安装方法了)
    • 方式三:如果上述两种方式都无法安装,则通过第三种方式,下载软件包直接安装:
      Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('<https://ohmyposh.dev/install.ps1>'))
  4. 创建配置文件

if (!(Test-Path -Path `$PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
  1. 执行 notepad $PROFILE打开文件,并在文件内写入oh-my-posh init pwsh | Invoke-Expression
  2. Get-PoshThemes获取主题
  3. 修改主题oh-my-posh init pwsh --config 'C:\Users\{xxxxxx}\AppData\Local\Programs\oh-my-posh\themes\paradox.omp.json' | Invoke-Expression
    {xxxxxx}:是你计算机的用户名,替换成自己的即可
  4. 在PowerShell安装 posh-git通过PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
  5. 修改配置文件,引入posh-git模块更新PSReadLine
Import-Module posh-git #加载posh-git模块

oh-my-posh init pwsh  --config 'C:\Users\{XXXX}\AppData\Local\Programs\oh-my-posh\themes\paradox.omp.json' | Invoke-Expression #初始化主题

Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录
#{XXXX}:是计算机用户名

配置Windows PowerShell步骤

如果你不想用PowerShell,那就直接用Micorsoft PowerShell。需要额外更新PSReadLine

  1. 按照PowerShell配置的步骤,安装oh-my-posh + posh-git
  2. 更新PSReadLine, Windows PowerShell 5.1后内置了PSReadLine ,但不是最新版,需要更新
    PSReadLine Install-Module -Name PSReadLine -RequiredVersion 2.2.6
    PowerShell 7.3.0 内置 PSReadLine 2.2.6
    PowerShell 7.2.5 内置 PSReadLine 2.1.0
    PowerShell 7.0.11 内置 PSReadLine 2.0.4
    PowerShell 5.1 内置 PSReadLine 2.0.0
    PSReadLine参考链接
Import-Module posh-git #加载posh-git模块

oh-my-posh init pwsh  --config 'C:\Users\{XXXX}\AppData\Local\Programs\oh-my-posh\themes\paradox.omp.json' | Invoke-Expression #初始化主题

Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录
#{XXXX}:是计算机用户名

字体乱码配置

在这里插入图片描述

  1. 下载字体,链接

  2. 点击DownLoads

  3. 选择字体并下载DejaVuSansMono Nerd Font(尤其推荐这套)

  4. 下载后右键解压,然后全选,右键安装
    在这里插入图片描述

  5. 点击设置,选择“高级”选项卡,选择字体“DejaVuSansMono Nerd Font”在这里插入图片描述
    在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值