文件配置
自用文件配置 notepad $PROFILE
oh-my-posh init pwsh | Invoke-Expression
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\ys.omp.json" | Invoke-Expression
# 自动补全
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
日常使用
可以装一个chocolaty,类似于Ubuntu的apt,参考https://docs.chocolatey.org/en-us/choco/setup:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
然后可以把vim之类的也装上
choco install vim
如果要更新环境变量的话用 . $PROFILE
问题
遇到了这样的问题
Get-PSReadLineKeyHandler : 找不到与参数名称“Key”匹配的参数。
根据https://github.com/JanDeDobbeleer/oh-my-posh/issues/3136#issuecomment-1328544012提示,可以参考https://github.com/PowerShell/PSReadLine#install-from-powershellgallery-preferred升级PSReadLine