idea terminal中文乱码_Terminal优雅的办公带来超高的效率
貼個圖
眾所周知,Windows Terminal沒有美化后那個傻大藍(lán),沉默黑簡直不忍直視。沒有像官方演示的那么美觀(所以得自己捯飭捯飭好看的樣子)
美化開始
第一步安裝相關(guān)的模塊和PowerLine主題
Install-Module posh-git -Scope CurrentUserInstall-Module oh-my-posh -Scope CurrentUser
如果你使用管理員權(quán)限打開PowerShell并且想把oh-my-posh安裝到所有用戶,則輸入
Install-Module posh-gitInstall-Module oh-my-posh
安裝完成后,輸入
Import-Module posh-gitImport-Module oh-my-posh
Set-Theme PowerLine
但是這次使用Import-Module的指令,再次啟動PowerShell就會發(fā)現(xiàn)沒有效果,這是因?yàn)檫@些指令僅限于本次會話的PowerShell有效,因此,若要使這一效果在每次啟動的時候都有效,那就要將其添加到啟動腳本中。打開~\Documents\WindowsPowerShell新建文本文檔,命名為Microsoft.PowerShell_profile.ps1,輸入以下內(nèi)容,保存
Import-Module posh-gitImport-Module oh-my-posh
Set-Theme PowerLine
這樣,在每次PoweShell打開的時候都會加載自定義的文件并啟用PowerLine主題。
第二步注冊字體
這里使用的是更紗等距黑體,即Sarasa Term SC 這個名稱配置windows Terminal 字體時要用到(記得有這回事)要不然小圖標(biāo)還是亂碼。這款字體是開源字體,可以美觀地顯示中文,而且是等寬字體,也就說在終端中不會出現(xiàn)排版錯誤,
下載地址:
https://github.com/be5invis/Sarasa-Gothic/releases
下載完畢之后,直接解壓,把里面的文件直接安裝到C:\Windows\Fonts這個路徑之中
第三步改造終端的配置文件
Windows Terminal的配置文件儲存在~\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json這個json文件中,在代碼編輯器中打開并編輯(比如VS Code)。不過一般很難打開,要設(shè)置管理員各種權(quán)限,簡單點(diǎn)的話,點(diǎn)擊設(shè)置就可以了
接下來就新增一些配置進(jìn)去來美化界面。我的配置貼出來參考(前面帶有//的是注釋的意思,可以刪掉。另外,我僅僅更改的powershell的別的還沒有改)
// This file was initially generated by Windows Terminal Preview 1.1.1812.0// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
//"colorScheme": "One Half Dark",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
//"hidden": false //這里必須注釋掉,否則會和 "closeOnExit" : true, 沖突
"closeOnExit" : true,
"colorScheme" : "Ubuntu", //顏色主題名稱,就是schemes下面的每個實(shí)例的 name 值
"cursorColor" : "#ffffff", //光標(biāo)顏色
"cursorShape" : "filledBox", //光標(biāo)類型 可選 bar empytBox filledBox vintage
"fontFace" : "Sarasa Term SC", //字體名稱 安裝字體時的字體名稱
"fontSize" : 12, //字體大小
"historySize" : 8001,
"icon" : "D:\\1others\\pictures\\圖標(biāo)\\wonder logo .png", //程序的小圖標(biāo),也就是在標(biāo)題欄和新建中顯示的圖標(biāo)地址
"backgroundImage": "D:\\1others\\pictures\\wallaper\\terminal.jpg", //配置背景圖片地址
"acrylicOpacity" : 0.75, //不透明度,值越大,背景就越濃,否則就越淡
"backgroundImageOpacity": 0.25, //背景圖片的透明度
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true, //是否開啟毛玻璃特效,值為false的時候就沒有毛玻璃特效
"tabTitle" : "wonder" //標(biāo)簽名稱
},
{
// Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "命令提示符",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
"hidden": false,
"name": "Ubuntu",
"source": "Windows.Terminal.Wsl"
},
//{
// "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
// "hidden": false,
// "name": "Azure Cloud Shell",
// "source": "Windows.Terminal.Azure"
//},
{
"guid": "{46ca431a-3a87-5fb3-83cd-11ececc031d2}",
"hidden": false,
"name": "kali-linux",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{bca8e596-e7e9-591d-a845-194064478442}",
"hidden": false,
"name": "kali",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{fc92b12d-5e99-527f-af52-87b60adc0f71}",
"hidden": false,
"name": "centos7",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
]
},
// Add custom color schemes to this array.
// To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
"schemes":
//自定義的主題
[
{
"name" : "One Half Dark",
"background" : "#696969",
"black" : "#282C34",
"blue" : "#7B68EE",
"brightBlack" : "#5A6374",
"brightBlue" : "#729fcf",
"brightCyan" : "#56B6C2",
"brightGreen" : "#98C379",
"brightPurple" : "#C678DD",
"brightRed" : "#E06C75",
"brightWhite" : "#DCDFE4",
"brightYellow" : "#E5C07B",
"cyan" : "#56B6C2",
"foreground" : "#DCDFE4",
"green" : "#7FFF00",
"purple" : "#BA55D3",
"red" : "#E06C75",
"white" : "#DCDFE4",
"yellow" : "#FFD700",
},
{
"name": "Ubuntu",
"black": "#2e3436",
"red": "#cc0000",
"green": "#4e9a06",
"yellow": "#c4a000",
"blue": "#3465a4",
"purple": "#75507b",
"cyan": "#06989a",
"white": "#d3d7cf",
"brightBlack": "#555753",
"brightRed": "#ef2929",
"brightGreen": "#8ae234",
"brightYellow": "#fce94f",
"brightBlue": "#729fcf",
"brightPurple": "#ad7fa8",
"brightCyan": "#34e2e2",
"brightWhite": "#eeeeec",
"background": "#300a24",
"foreground": "#eeeeec"
},
{
"name": "AdventureTime",
"black": "#050404",
"red": "#bd0013",
"green": "#4ab118",
"yellow": "#e7741e",
"blue": "#0f4ac6",
"purple": "#665993",
"cyan": "#70a598",
"white": "#f8dcc0",
"brightBlack": "#4e7cbf",
"brightRed": "#fc5f5a",
"brightGreen": "#9eff6e",
"brightYellow": "#efc11a",
"brightBlue": "#1997c6",
"brightPurple": "#9b5953",
"brightCyan": "#c8faf4",
"brightWhite": "#f6f5fb",
"background": "#1f1d45",
"foreground": "#f8dcc0"
}
],
// Add custom keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about keybindings, visit https://aka.ms/terminal-keybindings
"keybindings":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" },
{ "command": "paste", "keys": "ctrl+v" },
// Press Ctrl+Shift+F to open the search box
{ "command": "find", "keys": "ctrl+shift+f" },
// Press Alt+Shift+D to open a new pane.
// - "split": "auto" makes this pane open in the direction that provides the most surface area.
// - "splitMode": "duplicate" makes the new pane use the focused pane's profile.
// To learn more about panes, visit https://aka.ms/terminal-panes
{ "command": { "action": "splitPane", "split": "auto", "splitMode": "duplicate" }, "keys": "alt+shift+d" }
]
}
設(shè)置顏色主題
顏色主題就是”schemes”:字段里面的
可以到
https://github.com/mbadolato/iTerm2-Color-Schemes
這里面選擇自己喜歡的,選擇好之后,把里面的配置直接粘貼到”schemes”:字段之中即可。
總結(jié)
以上是生活随笔為你收集整理的idea terminal中文乱码_Terminal优雅的办公带来超高的效率的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python scale()函数_【Py
- 下一篇: .jar中没有主清单属性_如何在spri