1. 程式人生 > WINDOWS開發 >Windows Terminal配置填坑記

Windows Terminal配置填坑記

前言

浪哥最近一直在使用MobaXterm,感覺這款工具功能很多,而且還是經常用的功能,最近幾個月一直把它當作主要的ssh工具。可是最近連Kali Linux時,頻繁掉線,最快時竟然5秒鐘,就開始掉線了。索性在網上找解決方案,一搜不要緊,發現還真很多人遇到同樣的問題。嬸可忍,叔不能忍,二營長,你他孃的Windows terminal呢。

1.0 安裝Windows Terminal

其實去年微軟釋出預覽版時,浪哥就嚐鮮了。感受完後,並沒有納入後工,誰讓你不是正式的呢。Windows Terminal安裝很簡單,到Windows 商店,搜尋下載即可。啟動可以到開始選單中去找,也可以開始執行裡輸入wt。

2.0 安裝安裝 posh-git 和 oh-my-posh

oh-my-posh就是powershell上的oh-my-zsh,儘管我用的少,得裝裝麼。

Install-Module posh-git -Scope CurrentUser 

Install-Module posh-git -Scope CurrentUser 

3.0 修改或者新增配置檔案

# 如果之前沒有配置檔案,就新建一個 PowerShell 配置檔案
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }

# 用記事本開啟配置檔案
notepad $PROFILE

#################################################################################
Import-Module posh-git 
Import-Module oh-my-posh 

配置檔案裡新增,post-gi和oh-my-post,使啟動時可以載入這些工具。

4.0 安裝更沙黑體

可以在微軟商店裡安裝更沙黑體,安裝也比較簡單。

5.0 正式美化

"profiles": {
    "defaults": {
      // Put settings here that you want to apply to all profiles
      "acrylicOpacity": 0.8,//背景透明度
      "useAcrylic": true,// 啟用毛玻璃
      "backgroundImage": "D:\\OneDrive\\圖片\\stack.jpg",//背景圖片
      "backgroundImageOpacity": 0.5,//圖片透明度
      "backgroundImageStretchMode": "fill",//填充模式
      "icon": "ms-appx:///ProfileIcons/{9acb9455-ca41-5af7-950f-6bca1bc9722f}.png",//圖示
      "fontFace": "Sarasa Term SC",//字型
      "fontSize": 14,//文字大小
      "colorScheme": "Solarized Light",//主題
      "cursorColor": "#FFFFFF",//游標顏色
      "cursorShape": "bar",//游標形狀
      "startingDirectory":"D://Projects//" //起始目錄
    }
 }

最下邊貼入,主題內容,具體主題配置。

iTerm2-Color-Schemes 這裡面有各種colorScheme的JSON,找到配色的.json檔案,把裡面的配色複製到schemes下面,然後再修改colorScheme的值。

"schemes":[
 {
    "name": "cyberpunk","black": "#000000","red": "#ff7092","green": "#00fbac","yellow": "#fffa6a","blue": "#00bfff","purple": "#df95ff","cyan": "#86cbfe","white": "#ffffff","brightBlack": "#000000","brightRed": "#ff8aa4","brightGreen": "#21f6bc","brightYellow": "#fff787","brightBlue": "#1bccfd","brightPurple": "#e6aefe","brightCyan": "#99d6fc","brightWhite": "#ffffff","background": "#332a57","foreground": "#e5e5e5"
  },{
    "name": "Solarized Darcula","black": "#25292a","red": "#f24840","green": "#629655","yellow": "#b68800","blue": "#2075c7","purple": "#797fd4","cyan": "#15968d","white": "#d2d8d9","brightBlack": "#25292a","brightRed": "#f24840","brightGreen": "#629655","brightYellow": "#b68800","brightBlue": "#2075c7","brightPurple": "#797fd4","brightCyan": "#15968d","brightWhite": "#d2d8d9","background": "#3d3f41","foreground": "#d2d8d9"
  }
]