標籤:vim 內容 default 識別 ike icons 亂碼 system last
VSCode-python 進階配置中文亂碼
中文亂碼,網上一堆解決方案,但是根本沒有有效起作用的。
在python指令碼的前面添加:
# -*- coding:utf-8 -*-
並不能在控制台輸出時是的print輸出中文不亂碼。但是此時os.system()的輸出卻是正常的,
如果使用調試進行輸出得到相反的結果:print輸出正常,但是終端輸出亂碼。
解決方案:盡量不要用中文
好吧,確實沒卵用!哪位小夥伴有解決方案,請不吝賜教。
自動添加文首注釋
此時需要安裝vscode-fileheader
安裝後需要進行相關配置:
檔案 ——> 喜好設定 ——> 設定
開啟setting.json,搜尋fileheader,找到以下設定:
// By default, create file username "fileheader.Author": "mikey.zhaopeng", // By default, common template. Do not modify it!!!!! "fileheader.tpl": "/*\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by: {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n */\r\n", // By default, update file username. "fileheader.LastModifiedBy": "mikey.zhaopeng",
然後變更:
// By default, create file username 此處更改為你的使用者名稱 "fileheader.Author": "Yanta", // By default, common template. Do not modify it!!!!! "fileheader.tpl": "#!/usr/bin/env python \r\n# -*- coding:utf-8 -*- \r\n‘‘‘\r\n * @Author: {author} \r\n * @Date: {createTime} \r\n * @Last Modified by: {lastModifiedBy} \r\n * @Last Modified time: {updateTime} \r\n * @Desc: \r\n‘‘‘\r\n", // By default, update file username. 此處更改為你的使用者名稱 "fileheader.LastModifiedBy": "Yanta", "workbench.iconTheme": "vscode-icons"
更改過上述配置之後需要重啟vscode,否則不會應用更改。
重啟後建立立檔案,按下快速鍵:Ctrl+Alt+i,就會在指令碼開頭自動填入注釋內容。
不足
file-header目前無法自動添加註釋部分,而且無法想vim一樣可以自動識別指令碼類型,然後自動插入對應的文首注釋。
注釋只能針對所有的指令檔一視同仁。
檔案表徵圖
增加檔案表徵圖外掛程式,實際上就是為了好看。
直接搜尋:vscode-icons安裝即可。
VSCode-python 進階配置