在 Mac 环境下配置:菜单栏 Code -> 首选项 -> 用户代码片段
自行按需添加如下文件
例如 Python 的头文件可设置为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| "PY_HEADER": { "prefix": "header", "body": [ "# -*- encoding: utf-8 -*-", "'''", "@File : $TM_FILENAME", "@Time : $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", "@Author : Zhang Wensong", "@Version : 1.0", "@Contact : zhang.wetts@163.com", "@Desc : $1", "'''", "", "# here put the import lib", "$0" ], }
|
Markdown 的头文件可设置为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| "MD_HEADER": { "prefix": "header", "body": [ "title: $TM_FILENAME", "date: $CURRENT_YEAR/$CURRENT_MONTH/$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND", "tags:", "- $1", "categories:", "- $2", "", "---", "", "$0" ], }
|
可能遇到的问题:在 Markdown 文件中无法使用代码片段
在 settings.json 中添加如下配置
1 2 3
| "[markdown]": { "editor.quickSuggestions": true }
|