把快捷键写在前面以便查询:
- 插入文件头,按
两次
ctrl+alt+H
- 插入Change Log,按两次
ctrl+alt+c
注意mac也使用ctrl键而不是cmd键。
- 首先在扩展库中搜索
psioniq File Header
并点击安装。 - 在
设置-扩展
中找到psioniq File Header
- 点击在
settings.json
中编辑
,我的配置文件:
"psi-header.config": {
"forceToTop": true,
"blankLinesAfter": 3,
"license": "Custom"
},
"psi-header.changes-tracking": {
"isActive": true,
"modAuthor": "Modified By: ",
"modDate": "Last Modified: ",
"modDateFormat": "date",
"include": [],
"exclude": [
"markdown",
"json"
],
"excludeGlob": [
"out/**",
"src/**/*.xyz",
"components/**/*.mk",
],
"autoHeader": "manualSave"
},
"psi-header.license-text": [
"May the force be with you."
],
"psi-header.variables": [
["company", "SimonLiu Inc."],
["author", "Simon Liu"],
["authoremail", "xxxxx@gmail.com"],
["initials","S.L"],
],
"psi-header.lang-config": [
{
"language": "lua",
"begin": "--[[",
"prefix": "--",
"end": "--]]",
"blankLinesAfter": 0
},
{
"language": "python",
"begin": "###",
"prefix": "# ",
"end": "###",
"blankLinesAfter": 0,
"beforeHeader": [
"#!/usr/bin/env python",
"# -*- coding:utf-8 -*-"
]
},
{
"language": "javascript",
"begin": "/**",
"prefix": " * ",
"end": " */",
"blankLinesAfter": 2,
"forceToTop": false
},
{
"language": "typescript",
"mapTo": "javascript"
}
],
"psi-header.templates": [
{
"language": "c",
"template": [
"File: <<filepath>>",
"Project: <<projectpath>>",
"Created Date: <<filecreated('YYYY-MM-DD HH:mm:ss')>>",
"Author: <<author>>",
"-----",
"Last Modified: <<dateformat('YYYY-MM-DD HH:mm:ss')>>",
"Modified By: ",
"-----",
"Copyright (c) <<year>> <<company>>",
"",
"<<licensetext>>",
"-----",
"HISTORY:",
"Date \tBy\tComments",
"----------\t---\t----------------------------------------------------------"
],
"changeLogCaption": "HISTORY:",
"changeLogHeaderLineCount": 2,
"changeLogEntryTemplate": [
"<<dateformat('YYYY-MM-DD')>>\t<<initials>>\t"
]
},
{
"language": "javascript",
"template": [
"File: <<filepath>>",
"Project: <<projectpath>>",
"Created Date: <<filecreated('dddd, MMMM Do YYYY, h:mm:ss a')>>",
"Author: <<author>>",
"-----",
"Last Modified: ",
"Modified By: ",
"-----",
"Copyright (c) <<year>> <<company>>",
"------------------------------------",
"Javascript will save your soul!"
]
},
{
"language": "typescript",
"mapTo": "javascript"
}
]
- 效果如下