Terminal
下载安装 Windows Terminal
下载安装字体 FiraCode NF,选择一个字体直接右键安装
下载安装powershell7
Windows Terminal配置
打开Windows Terminal
打开下拉图标
点击设置
点击左下角,打开json文件,替换为文末的settings.json的内容
修改commandline和icon的路径为powershell安装路径,font的face选项为安装的字体名称(可以搜索已安装的字体查看字体全名),background配置为背景图,如果不需要,可以删除这三项
ps1"backgroundImage": "D://software/\u58c1\u7eb8/6.jpg", "backgroundImageOpacity": 0.2, "backgroundImageStretchMode": "fill", "commandline": "D://software/powershell/7/pwsh.exe -nologo", "icon": "D://software/powershell/7/assets/Powershell_av_colors.ico", "font": { "face": "FiraCode NF", "size": 11 },
安装插件,管理员权限打开Terminal
Install-Module oh-my-posh -Scope CurrentUser
Install-Module PSReadLine -Scope CurrentUser
Install-Module posh-git -Scope CurrentUser
powershell配置(执行
notepad $Profile
创建并把下面的代码复制进去)ps1chcp 936 $env:LESSCHARSET='utf-8' Import-Module posh-git Import-Module oh-my-posh Set-PoshPrompt -Theme atomic # https://ohmyposh.dev/docs/themes 选择一个主题 # 设置 Tab 键补全 Set-PSReadlineKeyHandler -Key Tab -Function Complete # 设置 Ctrl+d 为菜单补全和 Intellisense Set-PSReadLineKeyHandler -Key "Tab" -Function MenuComplete # 设置 Ctrl+d 为退出 PowerShell Set-PSReadlineKeyHandler -Key "Ctrl+d" -Function ViExit # 设置 Ctrl+z 为撤销 Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo # 设置向上键为后向搜索历史记录 Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward # 设置向下键为前向搜索历史纪录 Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
添加到右键菜单
- 下载并双击打开软件ContextMenuManager.NET.4.0.exe
- 点击目录背景=>点击右边加号按钮,新建菜单
- 菜单名称打开Windows Terminal
- 菜单命令,
mshta vbscript:createobject("shell.application").shellexecute("C:\Users\自己的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe","","","",1)(close)
,点击确定 - 编辑更改图标,可以选择powershell图标
- 同样的方式新建管理员权限打开Terminal
- 命令,
mshta vbscript:createobject("shell.application").shellexecute("C:\Users\自己的用户名\AppData\Local\Microsoft\WindowsApps\wt.exe","","","runas",1)(close)
git操作添加到右键菜单(依赖下面的PSCustomTools模块)
- 点击左侧的文件
- 新建菜单,选择多级,菜单文本输入git操作,点击确定
- 点击编辑子菜单,同样的方式新建菜单
- 文件更改历史命令:
pwsh.exe /c "Get-GitLog -path ""%1"""
- 文件更改详情命令:
pwsh.exe /c "Write-Host '请输入Commit Id: ' -NoNewline;$commitid=[System.Console]::ReadLine();Get-GitDetail -sha $commitid -file ""%1"""
- 重复上述操作,添加文件夹的右键菜单
config.json
配置文件
json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions":
[
{
"command": "unbound",
"keys": "alt+shift+plus"
},
{
"command": "unbound",
"keys": "ctrl+shift+w"
},
{
"command":
{
"action": "splitPane",
"split": "vertical"
},
"keys": "ctrl+shift+plus"
},
{
"command":
{
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"
},
{
"command": "paste",
"keys": "ctrl+v"
},
{
"command": "find",
"keys": "ctrl+shift+f"
},
{
"command":
{
"action": "splitPane",
"split": "auto",
"splitMode": "duplicate"
},
"keys": "alt+shift+d"
},
{
"command": "closePane",
"keys": "ctrl+shift+minus"
}
],
"copyFormatting": "none",
"copyOnSelect": false,
"defaultProfile": "{56ac5b0e-4feb-44ac-8522-4c80f44d0d5a}",
"initialRows": 33,
"initialPosition": "400,100",
"alwaysShowTabs": true,
"tabWidthMode": "equal",
"confirmCloseAllTabs": false,
"profiles":
{
"defaults": {},
"list":
[
{
"commandline": "powershell.exe",
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"hidden": false,
"name": "Windows PowerShell"
},
{
"commandline": "cmd.exe",
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"hidden": false,
"name": "\u547d\u4ee4\u63d0\u793a\u7b26"
},
{
"acrylicOpacity": 0.6,
"backgroundImage": "D://software/\u58c1\u7eb8/6.jpg",
"backgroundImageOpacity": 0.2,
"backgroundImageStretchMode": "fill",
"colorScheme": "Homebrew",
"commandline": "D://software/powershell/7/pwsh.exe -nologo",
"cursorColor": "#ffffff",
"icon": "D://software/powershell/7/assets/Powershell_av_colors.ico",
"font":
{
"face": "FiraCode NF",
"size": 11
},
"guid": "{56ac5b0e-4feb-44ac-8522-4c80f44d0d5a}",
"historySize": 9001,
"name": "PowerShell",
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"useAcrylic": true,
"scrollbarState": "visible"
},
{
"guid": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
"name": "Debian",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{aabae64a-7cf7-5add-b5d6-744e54ab56d6}",
"name": "centos",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{d29017ae-d3fb-564b-a767-72f66b9035b7}",
"name": "debian",
"source": "Windows.Terminal.Wsl"
}
]
},
"schemes":
[
{
"background": "#000000",
"black": "#3C5712",
"blue": "#17B2FF",
"brightBlack": "#749B36",
"brightBlue": "#27B2F6",
"brightCyan": "#13A8C0",
"brightGreen": "#89AF50",
"brightPurple": "#F2A20A",
"brightRed": "#F49B36",
"brightWhite": "#E5E5E5",
"brightYellow": "#E5E500",
"cursorColor": "#FFFFFF",
"cyan": "#3C96A6",
"foreground": "#FFFFFF",
"green": "#6AAE08",
"name": "Frost",
"purple": "#E5E500",
"red": "#8D0C0C",
"selectionBackground": "#FFFFFF",
"white": "#AAAAAA",
"yellow": "#E5E500"
},
{
"background": "#283033",
"black": "#000000",
"blue": "#6666E9",
"brightBlack": "#999999",
"brightBlue": "#0000FF",
"brightCyan": "#00E5E5",
"brightGreen": "#00D900",
"brightPurple": "#E500E5",
"brightRed": "#E50000",
"brightWhite": "#E5E5E5",
"brightYellow": "#E5E500",
"cursorColor": "#FFFFFF",
"cyan": "#00A6B2",
"foreground": "#00FF00",
"green": "#00A600",
"name": "Homebrew",
"purple": "#B200B2",
"red": "#FC5275",
"selectionBackground": "#FFFFFF",
"white": "#BFBFBF",
"yellow": "#999900"
}
],
"theme": "light"
}
centos安装oh-my-zsh
安装
yum install -y zsh
chsh -s /bin/zsh
, 如果没有chsh
命令,则安装dnf install util-linux-user
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
修改主题
vim ~/.zshrc
- 修改
ZSH_THEME="wedisagree"
插件
- incr自动提示
sh
wget http://mimosa-pudica.net/src/incr-0.2.zsh
mkdir ~/.oh-my-zsh/plugins/incr
mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr/incr.plugin.zsh
echo 'source ~/.oh-my-zsh/plugins/incr/incr*.zsh' >> ~/.zshrc
source ~/.zshrc
starship配置
curl -sS https://starship.rs/install.sh | sh
在
~/.zshrc
文件添加eval "$(starship init zsh)"
touch ~/.config/starship.toml
配置
sh# 设置配置范例,开启编辑器的自动补全 # "$schema" = 'https://starship.rs/config-schema.json' # 在命令之间插入空行 # add_newline = true # 将提示符的“❯”替换为“➜” [character] # “character”是我们正在配置的组件 success_symbol = "[➜](bold green)" # 设置“success_symbol” 字段为绿色加粗的“➜” # 禁用 package 组件,完全隐藏它的提示符 # [package] # disabled = true [git_status] ahead = "⇡${count}" diverged = "⇕⇡${ahead_count}⇣${behind_count}" behind = "⇣${count}" conflicted = "🏳" up_to_date = "✓" untracked = "🤷" stashed = "📦" modified = "📝" staged = '[++\($count\)](green)' renamed = "👅" deleted = "🗑" [time] disabled = false format = '🕙[\[ $time \]]($style) ' time_format = "%T" [cmd_duration] min_time = 0 format = " [$duration](bold yellow)"