💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 插件 为了让 pwsh 更好用,我们需要安装一些 powershell的插件,运行下面命令进行安装: ``` Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Set-ExecutionPolicy remotesigned ``` ## PowerShell 的彩色文件列表 ``` Install-Module DirColors -Scope CurrentUser Install-Module -AllowClobber Get-ChildItemColor -Scope AllUsers ``` ## 增强 git 功能 ``` # 一个用于 Git 的 PowerShell 环境 Install-Module -Name posh-git -Scope AllUsers -AllowPrerelease -Force # working with SSH connections within PowerShell. Install-Module posh-sshell -Scope AllUsers # Oh My Zsh's Git aliases for PowerShell Install-Module -Name git-aliases -Scope AllUsers ``` ## 美化 powershell ``` Install-Module -Name oh-my-posh -Scope AllUsers ``` ## powershell 增强 ``` Install-Module -Name PSReadLine -AllowPrerelease -Scope AllUsers -Force -SkipPublisherCheck ``` ## 系统信息输出 ``` Install-Module windows-screenfetch -Scope AllUsers -AllowClobber Install-Module -Name InstallModuleFromGitHub -Scope AllUsers ``` ## windows-screenfetch ``` Install-Module -Name windows-screenfetch ``` ``` Install-Module TabExpansionPlusPlus -Scope AllUsers -AllowClobber ``` # 启动时加载插件 为了启动时加载插件,我们需要创建一个 `Microsoft.PowerShell\_profile.ps1`文件,放到 C:\\Users\\自己的用户名\\Documents\\PowerShell目录下,文件内容为: ``` #Get-PSReadLineOption # 显示所有可以配置的选项 #Get-PSReadLineKeyHandler # 显示所有可以配置的快捷键 Import-Module posh-git Import-Module posh-sshell Import-Module oh-my-posh Import-Module git-aliases -DisableNameChecking Import-Module PSReadLine Import-Module DirColors Import-Module InstallModuleFromGitHub Import-Module Get-ChildItemColor neofetch Set-PoshPrompt -Theme Material # 设置主题为 Material Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Tab 键补全 Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete # 设置 Ctrl+d 为菜单补全和 Intellisense Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置 Ctrl+z 为撤销 Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向上键为后向搜索历史记录 Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward # 设置向下键为前向搜索历史纪录 ```