• jQuery火箭图标返回顶部代码


    1.tool->new snippet(工具->新代码段) 创建一个新的snippet,并保存为author.sublime-snippet(最好在该目录(User)下再创建一个MySnippet目录):
    其内容:

    <snippet>
    <content><![CDATA[
    /**
     * ============================
     * @Author:   XX
     * @Version:  1.0 
     * @DateTime: ${1:ctrl+alt+shift+d}
     * ============================
     */
    ]]></content>
        <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
        <tabTrigger>author</tabTrigger>
        <!-- Optional: Set a scope to limit where the snippet will trigger -->
        <!-- <scope>source.python</scope> -->
    </snippet>

    2.Tools → New Plugin(工具->新插件)。创建时间插件,保存在User目录,命名为addCurrentTime.py:
    其内容为:

    import datetime, getpass
    import sublime, sublime_plugin
    class AddDateTimeStampCommand(sublime_plugin.TextCommand):
        def run(self, edit):
            self.view.run_command("insert_snippet", { "contents": "%s" %  datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") } )
    class AddDateStampCommand(sublime_plugin.TextCommand):
        def run(self, edit):
            self.view.run_command("insert_snippet", { "contents": "%s" %  datetime.datetime.now().strftime("%Y-%m-%d") } )
    class AddTimeStampCommand(sublime_plugin.TextCommand):
        def run(self, edit):
            self.view.run_command("insert_snippet", { "contents": "%s" %  datetime.datetime.now().strftime("%H:%M:%S") } )

    3.虽然创建了plugin,但是还需要在sublime编辑器 用户按键–key bindings user(按键绑定-用户)文件里面编辑触发插件的快捷键代码:

    [
        {"keys": ["ctrl+alt+shift+d"], "command": "add_date_time_stamp" },
        {"keys": ["ctrl+alt+d"], "command": "add_date_stamp" },
        {"keys": ["ctrl+alt+t"], "command": "add_time_stamp" }
    ]

    4.验证。
    在sublime Text3中新建一个文件,在文中输入author,然后按Tab键,便可出现信息头,但是时间没有显示,不急,这时候按时间绑定快捷键(ctrl+alt+shift+d)or(ctrl+alt+d)or(ctrl+alt+t),出现不同的日期显示.大功告成!

    截图:
    这里写图片描述
    输入author,然后按Tab键:
    这里写图片描述

  • 相关阅读:
    Linux内核架构读书笔记
    Linux内核container_of 宏
    Linux内核架构读书笔记
    Linux内核架构读书笔记
    Linux内核架构读书笔记
    Linux内核架构读书笔记- 2.4.1 进程复制
    作业07:字符串索引与切片
    作业06:数字类型
    作业04:逻辑运算
    作业05:用户登录(三次机会)且每次输入错误显示剩余次数
  • 原文地址:https://www.cnblogs.com/moyand/p/8520045.html
Copyright © 2020-2023  润新知