常用Linux的朋友经常用到zsh代替默认的bash,并且安装o my zsh来实现增强的效果,那么Windows上是不是也能实现相同的效果呢?答案是的,先上图看看效果
1 安装Windows Terminal
建议安装Windows Terminal,这样显示效果会更好,可以直接在应用商店搜索Terminal,直接安装即可。
2 安装Oh My Posh
使用winget安装
winget install JanDeDobbeleer.OhMyPosh -s winget
使用scoop安装
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
Powershell命令安装
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
3 安装Nerd Fonts
Oh My Posh 旨在使用Nerd Fonts。Nerd Fonts 是流行的字体,经过修补以包含图标。我们推荐Meslo LGM NF,但任何 Nerd Font 都应该与标准主题兼容。
可以直接通过o my posh安装
oh-my-posh font install
4 设置默认主题
在Powershell中输入$env:POSH_THEMES_PATH,可以查看主题安装路劲,默认是
C:Users${user}AppDataLocalProgramsoh-my-posh hemes
输入notepad $PROFILE,默认会打开文件C:Users$userDocumentsPowerShellMicrosoft.PowerShell_profile.ps1,第一次提示创建,点击确定即可。
输入内容:
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATHjandedobbeleer.omp.json" | Invoke-Expression
保持即可。
5 Git for windows效果
同样的可以在git界面中配置,
编辑配置文件
vim ~/.bashrc
输入
eval "$(oh-my-posh --init --shell bash --config ~/jandedobbeleer.omp.json)"
#注意,这里输入绝对路劲
页面更新:2024-04-17
本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828
© CopyRight 2008-2024 All Rights Reserved. Powered By bs178.com 闽ICP备11008920号-3
闽公网安备35020302034844号