文件模板设置入口如下:
File->Setting->Editor->file and Code Templates直接选择想要的文件类型去配置模板内容,这里以Python为例:
#coding=utf-8
# author:${USER}
# creat_time: ${DATE} ${TIME}
# corrent_day: ${DATE} @ ${DAY} ${MONTH} ${YEAR}
# corrent_month: ${MONTH} @ ${MONTH_NAME_FULL} ${MONTH_NAME_SHORT}
// comment: ${MONTH_NAME_FULL}全称展示月份 ${MONTH_NAME_SHORT}简称展示月份(中文无差别)
# corrent_time: ${TIME} ${HOUR} ${MINUTE}
# file: ${NAME}.py
# others: ${PROJECT_NAME} ${PRODUCT_NAME} ${END} ${DS}
// comment: ${DS}代表美元符号
#set($CUSTOMER = "customer_info")
# customer: ${CUSTOMER}
// comment: 使用set可以自定义变量,注意set与井号之间无空格(区分备注,使用//,实际不可以)
配置完成后,应用,创建新文件——实际新建文件时的默认内容:
#coding=utf-8
# author:mauthor
# creat_time: 2019/1/7 11:45
# corrent_day: 2019/1/7 @ 07 01 2019
# corrent_month: 01 @ 一月 一月
# corrent_time: 11:45 11 45
# file: newPythonFile.py
# others: NewProject PyCharm $
# customer: customer_info
网友评论