win终端美化

终端美化

1、下载oh-my-posh
winget install JanDeDobbeleer.OhMyPosh -s winget
2、打开终端配置文件
notepad $PROFILE
3、复制进去,97016换成自己的,保存重启终端
oh-my-posh init pwsh --config 'C:\Users\97016\AppData\Local\Programs\oh-my-posh\themes\montys.omp.json' | Invoke-Expression
or
oh-my-posh init pwsh --config 'C:\Users\97016\AppData\Local\Programs\oh-my-posh\themes\M365Princess.omp.json' | Invoke-Expression

字体下载

github下载 nerd-fonts 字体
点击 Release

image.png

点击 Show all 115 assets

image.png

点击 FiraCode.zip 进行下载

image.png

解压,安装字体

image.png

设置 WindowsTerminal 默认字体

image.png

VSCode可同步更改字体,设置->字体->终端,改为FiraCode Nerd Font Mono

image.png

命令提示

Install-Module -Name PSReadLine  -Scope CurrentUser -Force -SkipPublisherCheck

编辑配置文件notepad $Profile

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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容