【lua学习笔记】——在sublime中配置Lua运行环境
一、让Sublime可以运行lua脚本
打开sublime
{
"cmd": ["lua", "$file"],
"file_regex": "^(?:lua:)?[\t ](...*?):([0-9]*):?([0-9]*)",
"selector": "source.lua"
}
保存,名称为lua,保存在默认位置
二、如何添加作者的信息---类似插件功能
Tools → New Plugin:
import datetime
import sublime_plugin
class AddInfoCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("insert_snippet",
{
"contents": "/**""\n"
" * @Author: name""\n"
" * @DateTime: " "%s" %datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") +"\n"
" * @Description: Description""\n"
" */"
}
)
保存为Sublime Text3\Packages\User\addAuthorInfo.py
三 如何创建快捷键
Preference → Key Bindings - User:
[
{
"command": "add_info",
"keys": [
"ctrl+shift+,"]
}
]