Tuesday, June 16, 2009

Stealing from Padre for Vim

I'm sure the Padre developers weren't hoping to have their code absconded for those of us addicted to vim, but tsee's recent blog post on refactoring with Padre's lexical variable replace made me jealous--I want that for vim! So hack, hack, hack and voila:

This really is just leveraging the Padre code. At this point I actually use Padre::PPI but that has the downside of requiring Wx (which I personally like but it is quite a requirement). I only added a bit of code to make this into its own package and included some hints on vim scripting. The idea is to show how this could be abstracted into a standalone module then Padre, vim and any other reasonably powerful editor could use it. For now, I have packaged it as App::LexVarReplace with App::LexVarReplace::Vim pod. I would appreciate suggestions on the package layout and name, and any feedback from the Padre guys would be great. The git repository is available for your perusal. I must say that Padre seems very cool. I continue to check it out every once in a while, but I just can't seem to give up vim, gnu screen and a good old xterm. The developers have really done a great job leveraging modern Perl tools. You should check it out! I am only publishing this on github for now. I would like to speak with tsee or one of the Padre developers before this makes it debut on CPAN, but I'm a bit short on time at the moment.

thanks for the praise! For the most part, we tried to keep functionality that may be useful in other contexts separate from the main distribution (cf. Wx::Perl::DataWalker, etc.). However, with the refactoring tools, I was sometimes using the Wx STC methods quite heavily for the "output" portion of the code.

It's great to see these features adopted for other tools. There is no conceptual reason not to refactor them into standalone modules that can be used without the Wx dependency. I'll check out the work you've already done when I can. Since the refactoring code is still somewhat in flux, I'd prefer to have it live in the same VCS repository as Padre (but as a separate distribution). Why don't you drop by #padre on irc.perl.org to get a commit bit from Gabor? Alternatively, feel free to write a mail to the mailing list.

Cheers,Steffen

PS: While I use Padre more and more often for my Perl code, I'm still primarily a vim user, too. This isn't going to change either, as I mostly write C++.