安装方式
在windows商城里搜索 windows terminal
window cmd
默认情况针对于windows terminal的快捷键为:【可以修改】
SHIFT + ALT + ‘-’ :水平分割
SHIFT + ALT + ‘+’ :垂直分割
CTRL + SHIFT + ‘W’ :关闭此时所处的窗口
修改打开powershell
选中后,打开右边操作,里面有一个快捷方式打开JSON文件
因为这些都是我在ubuntu的快捷方式 所以我就改成一样的 这样下意识好弄些 hhh
安装git posh等
Install-Module -Name PSReadLine -AllowPrerelease -Force # PSReadLine
Install-Module posh-git -Scope CurrentUser # posh-git
Install-Module oh-my-posh -Scope CurrentUser # oh-my-posh
设置posh autosuggestions之类的
notepad.exe $Profile
在里面添加:
Import-Module posh-git # 引入 posh-git
Import-Module oh-my-posh # 引入 oh-my-posh
Set-Theme Paradox # 设置主题为 Paradox
Set-PSReadLineOption -PredictionSource History # 设置预测文本来源为历史记录
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 # 设置向下键为前向搜索历史纪录
临时设置主题的话:
Set-PoshPrompt -Theme Paradox
无法识别安装时
问题示例:Install-Module : 找不到与参数名称“AllowPrerelease”匹配的参数。
Did you complete the steps prior to this one? Specifically:
Install-Module -Name PackageManagement -Repository PSGallery -Force
Install-Module -Name PowerShellGet -Repository PSGallery -Force
Then restart shell, Then enter
Install-Module -Name Az.StorageSync -AllowPrerelease -AllowClobber -Force
设置conda环境
conda init powershell
然后这里还需要在主题里进行修改以便他能显示我切换了的环境名如下:
主要是要添加东西在你的主题设置文件而不是setting.json,原谅我第一次用真的不知道,但是github上开发这个作者实在是太好了!!!简直太耐心了(现在回看我的问题真的是… 有点傻傻的 hhh)此处贴上Github我在issue上问的地址:https://github.com/JanDeDobbeleer/oh-my-posh/issues/731
首先我用的主题是robbyrussel,主要是ubuntu zsh那边的默认用惯了,然后我没有按照开发者说的建一个自己的主题文件,而是直接修改了原主题文件的设置,这是我的路径:C:\Users\zhangkin\Documents\WindowsPowerShell\Modules\oh-my-posh\3.153.1\themes,建议直接everything搜索:robbyrussel
然后我的修改后的配置是这样的:
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "python",
"style": "plain",
"foreground": "#E5E4E2",
"properties": {
"prefix": "(",
"postfix":") ",
"display_virtual_env": true,
"display_default": true,
"display_version": false,
"display_mode": "always"
}
},
{
"type": "text",
"style": "plain",
"foreground": "#98C379",
"properties": {
"prefix": "",
"text": "\u279C",
"postfix": ""
}
},
{
"type": "path",
"style": "plain",
"foreground": "#56B6C2",
"properties": {
"style": "folder"
}
},
{
"type": "git",
"style": "plain",
"foreground": "#D0666F",
"properties": {
"branch_icon": "",
"display_status": false,
"prefix": "<#5FAAE8>git:(</>",
"postfix": "<#5FAAE8>)</>"
}
},
{
"type": "exit",
"style": "plain",
"foreground": "#DCB977",
"properties": {
"prefix": "\u2717",
"display_exit_code": false
}
}
]
}
],
"final_space": true
}
整体示意
有高亮、有历史信息、有TAB功能等,主题选的和ubuntu的一样 hhh zsh那边的