打开Sublime Text
ctrl+shift+p 输入 install packages
输入 fileheader 下载完成后
设置-->package settings-->File Header-->settings-User
按照需求自己根据settings-Default修改标识
//file or setting or tmpl can ONLY edit in ASCII
{
"Default": {
"author":"TRIX",
"version":"Python 3.9.5",
}
}
自定义快捷键
设置-->package settings-->File Header-->key bindings-Default
[
{
"keys": ["ctrl+alt+n"],//new file
"command": "file_header_new_file",
"args":{
"paths": []
}
},
{
"keys": ["ctrl+alt+a"],//add head
"command": "file_header_add_header",
"args":{
"paths": []
}
}
]
修改模文件头板
以python.tmpl举例
打开 Sublime Text\Data\Packages\FileHeader\template\header\Python.tmpl
按照需求自己修改模板
# -*- coding: utf-8 -*-
# Version: Python 3.9.5
# Author: {{author}}
# Date: {{create_time}}
# Use:
from logging import basicConfig,DEBUG,debug,CRITICAL,disable # Import debugging module
#disable(CRITICAL)# Remove # when the program is completed
basicConfig(level=DEBUG, format='%(levelname)s: %(message)s. [%(lineno)d]%(filename)s <%(asctime)s>',filename='debug.log',filemode='w')# Set debugging mode. Replace print() with debug()
说明:
author, create_time对应 File Header-->settings-User 中的标识
logging模块是一个用于记录调试日志的模块