安装Scoop

scoop > 在 Windows 系统中使用 Scoop

PSCompletions (psc) 是什么?1

PSCompletions 是一个补全管理器,为 PowerShell 带来更出色、更简便的 Tab 补全体验,基于 Rust + Lua 构建。

PSCompletions (psc) 安装配置与使用2

使用 abyss bucket (GitHubGitee)
添加 bucket,([GitHub](https://github.com/abgox/abyss) 或 [Gitee](https://gitee.com/abgox/abyss)) 根据网络情况任选其一。
scoop bucket add abyss https://github.com/abgox/abyss
scoop bucket add abyss https://gitee.com/abgox/abyss
 
安装 PSCompletions
scoop install abyss/abgox.PSCompletions
配置 PowerShell Profile3
New-Item -ItemType Directory -Path "$env:USERPROFILE\Documents\WindowsPowerShell" -Force
New-Item -ItemType File -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -Force
notepad "$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"

这会在 ~/Documents 里创建一个文件夹 WindowsPowerShell,并且在这个文件夹下创建 Microsoft.PowerShell_profile.ps1 文件。

然后在打开的文件中写入:

# 导入自动补全
Import-Module PSCompletions

之后重启终端,然后可以尝试添加 git 和 scoop 的命令补全:

psc add git scoop

Footnotes

  1. 参考来源:PSCompletions —> PowerShell 的命令补全管理器,更出色、更简便的 Tab 补全体验

  2. 参考来源:使用 Scoop + Mise 搭建统一的 Windows 开发环境

  3. 参考来源:Auto-load, please modify $Profile manually. If you want completion to work for allusers | allhosts, read Docs