zoukankan      html  css  js  c++  java
  • 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键:
    这里写图片描述

  • 相关阅读:
    姐姐的vue(1)
    LeetCode 64. Minimum Path Sum 20170515
    LeetCode 56. 56. Merge Intervals 20170508
    LeetCode 26. Remove Duplicates from Sorted Array
    LeetCode 24. Swap Nodes in Pairs 20170424
    LeetCode 19. Remove Nth Node From End of List 20170417
    LeetCode No.9 Palindrome Number 20170410
    LeetCode No.8. String to Integer (atoi) 2017/4/10(补上一周)
    LeetCode No.7 Reverse Integer 2017/3/27
    LeetCode No.4 Median of Two Sorted Arrays 20170319
  • 原文地址:https://www.cnblogs.com/moyand/p/8520045.html
Copyright © 2011-2022 走看看