尧图建网站 尧图建网站 YAOTU WEB BUILD 免费咨询
ARTICLE DETAIL

资讯详情

深耕网站建设与建站编程的一线实战洞察。

【PW】win10 Powershell字体美化

【PW】win10 Powershell字体美化 效果图如下powershell 7方案git bash方案1升级安装 PowerShell 7下载地址https://github.com/PowerShell/PowerShell/releaseswin10 1809装不了Windows terminal 本人试过了提示不兼容其他git bash方案的话下载安装git即可2安装字体NerdFonts下载地址https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFontsTips 除了NerdFonts还有很多程序员爱用的字体例如JetBrainsMonoNerdFont-Regular但是win10 PowerShell 7似乎只能识别NerdFonts字体其他字体没试成功如果用Windows terminal就可以换更多字体。如果是vscode使用需要设置字体3安装Oh My Poshwingetinstalloh-my-posh注意 windows update 要打开。如果离线安装还可能会用上“Add-AppxPackage”命令还要打开win10自己可选功能有点麻烦最好还是有微软商店直接安装如果好久没打开过更新可能还要用DISM /Online /Cleanup-image /Restorehealth来修复Add-AppxPackage部署失败原因是 0x80073CF3本人由于系统老旧在这个问题上困扰了好久一直没装winget、也装不回来微软商店…4下载主题文件下载地址https://ohmyposh.dev/docs/themes5配置主题文件进Powershellnotepad$Profile填入oh-my-posh--init--shellpwsh--config替换为你自己存放主题的目录\M365Princess.omp.json|Invoke-ExpressionC:\Users\Administrator\AppData\Local\Programs\oh-my-posh\themes\catppuccin_latte.omp.jsonM365Princess.omp.json 这是我的主题文件重启Powershell搞定附网上也有其他环境配置环境变量$env:POSH_THEMES_PATH/、用命令Get-PoshThemes来查主题个人觉得没必要就不折腾了。但很多皮肤对vscode的pw不友好就是莫名其妙的或缩进输入的位置多了几个空格很不习惯但是在vscode外面的pw又是正常的下面做个笔记为数不多显示正常的皮肤——比原版有颜色标记就行。“emodipt-extend.omp.json”6方案2-配置主题文件进git bash找到git的配置文件记事本打开路径如下notepadC:\Program Files\Git\etc\bash.bashrc最后一行添加以下代码eval$(oh-my-posh--init--shellbash--config替换为你自己存放主题的目录\M365Princess.omp.json)C:\Users\Administrator\AppData\Local\Programs\oh-my-posh\themes\catppuccin_latte.omp.json重启Git bash搞定其他可以自己修改主题文件最后自己可以在主题文件里面找到主题文件复制代码给 GPT让他帮忙按自己的想法改一下。比如说现在这个我让他把虚拟环境如果有的话也显示出来。{$schema:https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json,blocks:[{alignment:left,newline:true,segments:[{foreground:#E5C07B,options:{time_format:15:04},style:plain,template:[{{ .CurrentDate | date .Format }}],type:time},{type:shell,style:plain,foreground:#E06C75,options:{mapped_shell_names:{pwsh:Shell,powershell:Shell,cmd:Cmd,bash:Bash}},template: \ue795 {{ .Name }}},{type:python,style:plain,foreground:#98C379,template: ({{ .Venv }})},{type:executiontime,style:plain,foreground:#b8ff75,foreground_templates:[{{ if gt .Code 0 }}#E06C75{{ end }}],template: {{ .FormattedMs }},properties:{threshold:500}},{foreground:#F3C267,foreground_templates:[{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }},{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }},{{ if gt .Ahead 0 }}#B388FF{{ end }},{{ if gt .Behind 0 }}#B388FF{{ end }}],options:{branch_template:{{ trunc 25 .Branch }},fetch_status:true,fetch_upstream_icon:true},style:plain,template: {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ,type:git}],type:prompt},{alignment:right,segments:[{type:status,style:plain,foreground:#b8ff75,foreground_templates:[{{ if gt .Code 0 }}#E06C75{{ end }}],template: x{{ reason .Code }}}],type:prompt},{alignment:left,newline:true,segments:[{foreground:#61AFEF,options:{style:full},style:plain,template:\ue5ff {{ .Path }},type:path}],type:prompt},{alignment:left,newline:true,segments:[{foreground:#E06C75,style:plain,template:\u0021,type:root},{foreground:#E06C75,style:plain,template:\u276f,type:text}],type:prompt}],final_space:true,version:4}
返回列表