Fryboyter

Insert date in Sublime Text

If you create an article with Hugo you have to enter the date in the markdown file in the form of 2019-04-27T22:18:13+0200. In contrast to Jörg this annoys me quite a bit.

So I thought about how I could automate the input. For my preferred editor Sublime Text there is the plugin InsertDate available. After the installation you choose the correct time zone. After that, it’s best to create a shortcut to insert the date. To do this, select “Key Bindings” from the “Preferences” menu. In the right window enter the following code between the square brackets and save the file.

{ "keys": ["shift+f5"], "command": "insert_date", "args": {"format": "%Y-%m-%dT%H:%M:%S%z"} },

Instead of shift+f5 you can also use another key combination. From now on you can insert the current date including time and the difference to UTC in ISO 8601 format with the defined shortcut.

OSBN | General