Created
November 1, 2012 13:53
-
-
Save saltnlight5/3993742 to your computer and use it in GitHub Desktop.
ZemianNameAndDate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// SublimeText user keymap | |
// Author: Zemian Deng, Date: 2012-11-01_09:55:03 | |
[ | |
{ "keys": ["ctrl+alt+f6"], "command": "reindent"}, | |
{ "keys": ["ctrl+alt+f5"], "command": "zemian_name_and_date"}, | |
{ "keys": ["ctrl+alt+n"], "command": "new_note_file"} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SublimeText command - Create a new file with time stamp as filename. | |
# Author: Zemian Deng, Date: 2012-11-01_09:54:10 | |
import sublime, sublime_plugin | |
import time, os.path | |
class NewNoteFile(sublime_plugin.WindowCommand): | |
def run(self): | |
tstamp = time.strftime('%Y%m%d-%H%M%S', time.localtime()) | |
v = self.window.new_file() | |
v.settings().set('default_dir', os.path.expanduser('~/notes')) | |
v.set_syntax_file('Packages/Markdown/Markdown.tmLanguage') | |
v.set_name(tstamp + '.md') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SublimeText command - Insert Author and Date string. | |
# Author: Zemian Deng, Date: 2012-11-01_09:50:49 | |
import sublime, sublime_plugin, time | |
class ZemianNameAndDate(sublime_plugin.TextCommand): | |
def run(self, edit): | |
tstamp = time.strftime('%Y-%m-%d_%H:%M:%S', time.localtime()) | |
sel = self.view.sel(); | |
for s in sel: | |
self.view.replace(edit, s, "Author: Zemian Deng, Date: " + tstamp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment