Tags Perl
I use Scite for my editing on Windows (@work and home) - both for code (Perl, VHDL, C++) and simple text (.txt and anything else). It's a nice, light editor full of features.

Today I made a step forward, turning Scite into a real beast using Perl scripting.

Scite allows you to define 10 external commands for each file type which appear in the menu and can be called with Ctrl+N (N is 0 to 9). For each, you can specify the external program to call. The nice thing is that Scite can pass all the editing information into that program (via command line args) - file name, current line/column number, selection, etc. Additionally, Scite allows an option to refresh the file after running the command. This way, you can make your external program change the file - then Scite reloads it, and viola ! Naturally, this external program can be a Perl script...

For now I implemented template insertions in VHDL. For example - inserting a template for a process where the cursor is located.

It's so neat ! Using this feature, I can do arbitrarily complex things with my editing now. Perl is the best you can go about text manipulation, and Scite both passes it all the information it needs, and takes care to reload the file afterwards.

The only downside is that 10 commands limitation, which is quite dubious. I haven't had a problem with it yet, but if I will, Scite is open-source, so it shouldn't be hard to hack around it.


Comments

comments powered by Disqus