Can i add date time for sublime snippet?

Tools > New Plugin Paste this: import datetime, getpass import sublime, sublime_plugin class AddDateCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.run_command(“insert_snippet”, { “contents”: “%s” % datetime.date.today().strftime(“%d %B %Y (%A)”) } ) class AddTimeCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.run_command(“insert_snippet”, { “contents”: “%s” % datetime.datetime.now().strftime(“%H:%M”) } ) Save it as ~/Library/Application Support/Sublime Text 2/Packages/User/add_date.py Then, in Preferences > Key Bindings – … Read more

How to use dollar signs/JQuery with Sublime Text 2 Snippets?

Did you try escaping the $ with a \? For instance in PHP, the $GLOBALS snippet is: <snippet> <content><![CDATA[\$GLOBALS[‘${1:variable}’]${2: = }${3:something}${4:;}$0]]></content> <tabTrigger>globals</tabTrigger> <scope>source.php</scope> <description>$GLOBALS[‘…’]</description> </snippet> As you can see in <content>, $GLOBALS is expressed as \$GLOBALS. This is because $ is a symbol used for fields like ${1:variable}.

Hotkey to end the line with a semicolon and jump to a new line in Sublime Text 2

Best solution for this is recording a macro on Sublime Text and then assigning it to a keyboard shortcut. Follow these steps: Create a line such as alert(‘hello’) and leave the cursor right after letter ‘o’. Then go to Tools > Record a Macro to start recording. Press Command+→ to go to the end of … Read more