Created
December 30, 2015 01:47
-
-
Save ktkr3d/71ec9f0343e0b32d95d2 to your computer and use it in GitHub Desktop.
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
# insert date & time in japanese | |
days = ["日", "月", "火", "水", "木", "金", "土"] | |
insertDateTime = () -> | |
d = new Date | |
year = d.getFullYear() | |
month = d.getMonth() + 1 | |
date = d.getDate() | |
hour = d.getHours() | |
min = d.getMinutes() | |
sec = d.getSeconds() | |
ms = d.getMilliseconds() | |
str = "[#{year}/#{month}/#{date}(" + days[d.getDay()] + ") #{hour}:#{min}]\n" | |
return unless editor = atom.workspace.getActiveTextEditor() | |
selection = editor.getLastSelection() | |
selection.insertText(str) | |
atom.commands.add 'atom-text-editor', 'ktkr3d:datetime', ->insertDateTime() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment