





















@mmddisa 使用本地的配置主题: C:\Users\$User\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 配置
#------------------------------- Import Modules BEGIN -------------------------------
# Import-Module posh-git
Import-Module PSReadLine
#------------------------------- Import Modules END -------------------------------
oh-my-posh init pwsh --config "C:\Users\think\Documents\PowerShell\.posh.json" | Invoke-Expression
#------------------------------- Set Hot-keys BEGIN -------------------------------
# 设置预测文本来源为历史记录
Set-PSReadLineOption -PredictionSource History
# 每次回溯输入历史,光标定位于输入内容末尾
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
# 设置 Tab 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Tab" -Function MenuComplete
# 设置 Ctrl+d 为退出 PowerShell
Set-PSReadlineKeyHandler -Key "Ctrl+d" -Function ViExit
# 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
# 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
# 设置向下键为前向搜索历史纪录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
#------------------------------- Set Hot-keys END -------------------------------
让后将 主题文件放置到 ps1 文件夹 重命名一下: .posh.json 就好了,主要问题还是国内的网络有问题。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。