windows terminal
下载地址 :https://github.com/PowerShell/PowerShell/releases
winget install JanDeDobbeleer.OhMyPosh -s winget
oh-my-posh install
环境变量
安装字体
oh-my-posh font install
Oh My Posh was designed to use Nerd Fonts. Nerd Fonts are popular fonts that are patched to include icons. We recommend Meslo LGM NF, but any Nerd Font should be compatible with the standard themes.
根据文档提示:选择Meslo字体安装
windows terminal设置字体
启动项设置
输入:notepad $profile
如果出现以下提示:
路径不存在
echo $profile
根据提示路径,创建同名文件
C:\Users\42159\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Microsoft.PowerShell_profile.ps1
再次编辑 notepad $profile
将下面代码贴入Microsoft.PowerShell_profile.ps1文件
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\aliens.omp.json" | Invoke-Expression
通过下面命令获取所有主题,选择自己喜欢的主题,notepad $profile
Get-PoshThemes
more theme
notepad $profile
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\aliens.omp.json" | Invoke-Expression
function Get-GitStatus { & git status $args }
New-Alias -Name gs -Value Get-GitStatus -Force -Option AllScope
function Get-GitCommit { & git commit -m $args }
New-Alias -Name gcm -Value Get-GitCommit -Force -Option AllScope
function Get-GitAdd { & git add . $args }
New-Alias -Name ga -Value Get-GitAdd -Force -Option AllScope
function Get-GitTree { & git log --graph --decorate $args }
New-Alias -Name gt -Value Get-GitTree -Force -Option AllScope
function Get-GitPush { & git push $args }
New-Alias -Name gp -Value Get-GitPush -Force -Option AllScope
function Get-GitPull { & git pull $args }
New-Alias -Name gl -Value Get-GitPull -Force -Option AllScope
function Get-GitCheckout { & git checkout $args }
New-Alias -Name gc -Value Get-GitCheckout -Force -Option AllScope
function Get-GitBranch { & git branch $args }
New-Alias -Name gb -Value Get-GitBranch -Force -Option AllScope
function Get-GitRemote { & git remote -v $args }
New-Alias -Name gr -Value Get-GitRemote -Force -Option AllScope
初始化一个git项目,看看效果吧,git init
git alias
https://docs.microsoft.com/zh-cn/windows/terminal/tutorials/custom-prompt-setup
https://ohmyposh.dev/docs/installation/windows
留言与评论(共有 0 条评论) “” |