安装winget
一般power shell都自带了的,命令提示符下键入 winget
来运行 winget。若没安装可在微软商店搜索应用安装程序
进行安装。
JSON设置
打开JSON设置,定位到Defaults
里添加:
使用亚克力效果:
"useAcrylic": true,
"acrylicOpacity": 0.2
设置背景:
backgroundImage: URL,
backgroundImageOpacity: 0.4
修改字体:
"fontFace": "JetBrainsMono Nerd Font Mono",
"fontSize": 14
安装oh-my-posh
winget install JanDeDobbeleer.OhMyPosh -s winget
安装路径为 C:\Users\自己用户名\AppDataLocal\Programs\oh-my-posh\
或者微软商店可以直接下载安装安装完成后添加环境变量,在终端输入命令:
$env:Path += ";C:\Users\user\AppData\Local\Programs\oh-my-posh\bin""
初始化应用主题
code $PROFILE
打开配置脚本并输入
oh-my-posh init pwsh --config $env:POSH_THEMES_PATH\montys.omp.json | Invoke-Expression
预览全部主题
命令行键入可预览全部主题
Get-PoshThemes
就运行以下命令:
set-executionpolicy remotesigned
更换字体
主题生效后发现有很多乱码,更换一下字体即可解决
去掉提示语
打开JSON文件在power shell设置这里commandline
: “%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoLogo“,加上 -Nologo
就好了
Gitbash美化
添加 Git Bash 到 Windows Terminal 的配置文件,使其可用 Tab 页打开打开Terminal的配置文件,一般位于 C:\Users\用户名\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json
,在profiles的list中添加如下内容
"profiles":
{
"defaults": {},
"list":
[ # 找到此 list ,在里面添加如下
{
"guid": "{1cb09cbb-0365-91bf-c98f-d8d03c510274}",
"commandline": "%PROGRAMFILES%/git/usr/bin/bash.exe -i -l",
"icon": "%PROGRAMFILES%/Git/mingw64/share/git/git-for-windows.ico",
"name" : "Bash",
"startingDirectory" : "%USERPROFILE%",
"acrylicOpacity" : 0.75,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 12,
"historySize" : 9001,
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"useAcrylic" : true
},
设置主题
将主题文件复制到$HOME 目录下 使用 notepad $profile
添加命令,后执行 .$profile
刷新,重启终端即可生效。
eval "$(oh-my-posh --init --shell bash --config ~/jandedobbeleer.omp.json)"
乱码问题
安装 Meslo LGM NF 字体,避免乱码
安装图标库
Install-Module -Name Terminal-Icons -Repository PSGallery
在profile
里添加Import-Module -Name Terminal-Icons
,使用.$profile
加载 。
参考文章:
Introduction | Oh My PoshWindows 终端自定义提示符设置Terminal终端美化(Oh My Posh) – 掘金
暂无评论内容