Windows终端配置
oh-my-posh官方文档:Change your prompt
| Oh My Posh
oh-my-posh主题展示:Themes | Oh My
Posh
Windows Terminal配置
找到对应的Json文件,找到profile
选项的default
选项
背景半透明度
背景图片
1 2
| "backgroundImage": "D:/壁纸/b41b0ddcb4174ebdb36f3b1fb8017f73.jpg", "backgroundImageOpacity": 0.1
|
Powershell 7 配置
在Powershell中输入
1 2 3
| notepad $PROFILE 若报错请执行如下语句 New-Item -Path $PROFILE -Type File -Force
|
op-my-posh安装以及初始化
安装
1
| winget install oh-my-posh
|
在配置文件添加如下行
1 2
| oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/atomicBit.omp.json" | Invoke-Expression & ([ScriptBlock]::Create((oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomicBit.omp.json" --print) -join "`n"))
|
安装字体
添加如下配置
1 2 3 4
| "font": { "face": "JetBrainsMono Nerd Font Mono" }
|
上面是配置文件安装,当然也可以是GUI方式安装
更新Powershell
查看powershell版本
1
| Get-Host | Select-Object Version
|
打开powershell,输入来进行更新
1
| iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
|
配置Alias
1 2 3 4 5 6 7 8 9
| function connectKali{ ssh -i ~/.ssh/id_rsa root@192.168.126.128 } function connectUbuntu{ ssh -i ~/.ssh/id_rsa root@192.168.126.140 }
Set-Alias kk connectKali Set-Alias uu connectUbuntu
|
配置启动目录
1
| Set-location C:\Users\28185\Desktop
|
配置快捷键
安装PSReadline(可选,不明确是否有用,因为配置文件中未导入这个包也能用)
1
| Install-Module PSReadline -AllowPrerelease -Force
|
1 2 3 4 5 6 7 8
| Set-PSReadlineKeyHandler -Chord ctrl+w -Function BackwardDeleteWord
Set-PSReadlineKeyHandler -Chord ctrl+e -Function EndOfLine
Set-PSReadlineKeyHandler -Chord ctrl+a -Function BeginningOfLine
|
参考:https://gist.github.com/doggy8088/d3f3925452e2d7b923d01142f755d2ae
卸载Powershell
打开C:\28185.PowerShell_profile.ps1
将配置文件注释