[心得] Sublime Text新增插入時間日期功能

1. tools –> new plugin

2.加入下列程式碼:

import sublime, sublime_plugin

import datetime
import sublime_plugin
class AddCurrentTimeCommand(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) 
            }
        )

3.存檔 Packages\User\addCurrentTime.py

4.設定快速鍵:

Preference → Key Bindings - User:

[
    {
        command: add_current_time,
        keys: [
            ctrl+alt+t
        ]
    }
]

5.在編輯文件時,按下 ctrl+alt+t 就可添加當前時間日期


ps:今天在wordpress新增的 Crayon Syntax Highlighter

可以在文章內插程式語法~kkk