简单定制化PowerShell
美化Powershell,为其添加命令别名。
安装美化工具:
我系统里有cargo,直接一行命令装上了。
步骤我就不贴了,一定要注意换成 Nerd Font (opens new window)的字体,不然有些图标显示不出来,切换方法:


配置命令别名
输入echo $profile
1 | ❯ echo $profile |
打开后缀是ps1的文件,像我这样添加别名
1 | # 删除默认别名 |
这个文件会在Session
建立的时候执行,可以添加你想写的脚本
ni 是系统已经占用的了,所以我先把他删了后添加
效果:

添加历史记录提示
这种效果

PowerShell/PSReadLine: A bash inspired readline implementation for PowerShell (github.com)
配置步骤:
安装最新版PowerShellGet
(必装)
1 | Install-Module -Name PowerShellGet -Force |
安装提示插件
1 | Install-Module PSReadLine -AllowPrerelease -Force |
在之前Microsoft.PowerShell_profile.ps1
中,添加
1 | Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录 |
参考:
Comments
Comment plugin failed to load
Loading comment plugin