首页 > 系统相关 >【GiraKoo】PowerShell美化笔记

【GiraKoo】PowerShell美化笔记

时间:2024-09-26 12:13:13浏览次数:1  
标签:Function Set Ctrl PSReadLineKeyHandler GiraKoo Key PowerShell 美化

【GiraKoo】PowerShell美化笔记

oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/powerlevel10k_lean.omp.json" | Invoke-Expression

#------------------------------- ps-read-line -------------------------------
# 引入 ps-read-line
Import-Module PSReadLine

# 设置预测文本来源为历史记录
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
#------------------------------- ps-read-line -------------------------------

标签:Function,Set,Ctrl,PSReadLineKeyHandler,GiraKoo,Key,PowerShell,美化
From: https://www.cnblogs.com/girakoo/p/18433199

相关文章