gvim as a Perl IDE

kaare on 2008-06-14T15:02:26

I've decided to polish my gvim installation in order to have a more IDE like environment. Initially I wanted to find a replacement, but after looking at a lot of alternatives (trying some), amongst them eclipse, Geary, Kdevelop, Komodo, and more, I dedided to give (g)vim another chance.

Now, I've had perl-support [1] installed for some time now, and I find it quite impressive. I admit not having used all the features of this comprehensive package, but I'll definitely try out more features in the future.

So, today I've installed omniperl [2]. It seems to sorta work, but well... I can't even get the textbook example to work

my $now = DateTime->now; $now->^X^O

shows nothing.

DateTime::^X^O does give me a long list, but DateTime->^X^O just gives me a "pattern not found" error.

I guess that regular use will show if this is a useful package. Next, I wanted to see PelySense in action, so I dug up one of Ovid's old posts [3]. After some fiddling with the details (seems that pp and pg clash with perl-support definitions) it also kinda works. I get documentation for some - put far from all - methods. Noticeably, it can't find any Catalyst or dbic POD.

Again, I might be able to find better ways to use these features, so I'll keep them around at least for some time. Now this seems to cover the basic capabilities listed in gabor's post [4] and then some, but I miss one of the more important IDE requirements, the concept of a project (keeping together a set of related files). Now one could argue that if you do a standard project, all you have to do is find the files in ./lib, but I would like gvim to be smarter than that. And at least smarter than it is by default, listing all files in alphabetical order. I think I'll try out the vim project extension [5], unless someone warns me not to! Another more "projecty" way could be to use ack for searching through files. Guess I have to try out Ovid's ack integration sometime. Now if he just would release all his vim Perl enhancements in an easy to install way... ;-)

[1] perl-support: http://www.vim.org/scripts/script.php?script_id=556 [2] omniperl: http://www.vim.org/scripts/script.php?script_id=1924 [3] Ovid on PerlySense: http://use.perl.org/user/Ovid/journal/35574 [4] gabor's IDE blog: http://www.szabgab.com/blog/2008/05/1211438612.html [5] project: http://www.vim.org/scripts/script.php?script_id=69 [6] Ovid's ack integration: http://use.perl.org/user/Ovid/journal/36430


Vim + PerlySense = Anyone? Anyone? Bueller?

jplindstrom on 2008-06-14T20:56:55

I don't think Ovid's code works any more because it relies on an obsolete output format. I fixed up all output to work with the new format in order to support other editors.

Nowadays all output intended for editors is in the form of a deep data structure. Elisp for Emacs by default, and Vim hashes/collections (or whatever it's called) if you specify --io_type=editor_vim as an option to "perly_sense".

I neither use nor program Vim though, but anyone who wants to start writing a Vim integration layer would actually be able to get support for the simple things in PerlySense. Start by reading the source for bin/perly_sense and playing with it to see what comes out. (don't trust the sparse docs in that file)

Things that could work in Vim are basic things like navigating to modules, methods, navigating to base classes, getting docs, running programs (tests mostly) from the correct directory and with the correct @INC set, display the inheritance tree (well, graph), etc. Basic but very useful features.

Re: your comment about Projects. There is a Project concept, which is used for config and to e.g. determine where the to run things from. Still not for ack'ing and things like that though.

In spite of the name, PerlySense doesn't do intellisense yet. I'm still picking lower hanging fruit. And cooler fruit :)

Re:Vim + PerlySense = Anyone? Anyone? Bueller?

kaare on 2008-06-15T17:18:11

Thanks for your feedback. Now I know why it looks so strange :-)

I do hope someone will pick up the PerlySense vim ball but I don't program vim and I'm not likely to pick it up anytime soon. The syntax really looks awful :-(

Perhaps the temptation will be too big one day, but I hope someone familiar with vim programming will come around sooner :-)