Posted on 2014-03-07 in editors
I've been using Notepad++ on my Windows machine at work. It's the best free editor for Windows that I'm aware of, and does pretty much everything I can think of, with one notable exception.
Any editor that calls itself a programmer's editor should be scriptable. While you can develop your own plugins for Notepad++, it's not at all a trivial affair. Something like inserting the current date and time in a specific format is a trivial task, and shouldn't require a compiled C++ project made up of a dozen files.
My specific need was to frequently insert the current date and time into the editor with the format YYYY-MM-DD HH-mm. The kitchen-sink TextFX plugin provides an Insert Date function, but only supports the standard "short" and "long" formats specified in your Windows system preferences.
Here's how I got it working.
import datetime now = datetime.datetime.now() editor.addText(now.strftime("%Y-%m-%d %H:%M "))
... and voila.
The scripts are created/saved in the
C:\Users\[user name]\AppData\Roaming\Notepad+\plugins\config\PythonScript\scripts folder.