Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Vim for Perl developers

by TVSET (Chaplain)
on May 13, 2003 at 15:30 UTC ( #257782=perlmeditation: print w/ replies, xml ) Need Help??

Dear all,

I have just finished writing a small article, which describes how to configure Vim text editor to look, feel, and perform more like an Integrated Development Environment (IDE). I beleive that it will be interesting and helpful for some people, therefor I am posting a link here:

http://mamchenkov.net/blog/item/vim_for_perl_developers

Please, don't start any editor flame wars around it. :)

PS: Big thanks go to Limbic~Region and other CBers who were providing feedback while the article was in draft. :)

Leonid Mamtchenkov aka TVSET

Comment on Vim for Perl developers
Re: Vim for Perl developers
by jacques (Priest) on May 13, 2003 at 15:56 UTC
    That's great work. But I am wondering if you could help answer a vim question I have. How would I specify a Perl script to execute with the interpreter? I am not talking about doing:   <ESC>:! perl script.pl

    What I would like to do is access the Perl interpreter from within vim. With ruby, one can use the rubyfile command. From vim's command mode, you could type  :rubyfile example.rb to execute a ruby script. But how would you do this with Perl?

      That's great work.

      Thanks :)

      What I would like to do is access the Perl interpreter from within vim. With ruby, one can use the rubyfile command. From vim's command mode, you could type :rubyfile example.rb to execute a ruby script. But how would you do this with Perl?

      I've got rather limited experience in this area, but maybe :help perldo will help you. I guess you'll need to have Vim compiled with perl support.

      Leonid Mamtchenkov aka TVSET

        Thanks, but perldo is a range command, so that won't work.
      I wonder if you would find this useful. In .vimrc put:

      au BufWritePost *.pl,*.pm !perl -c %

      Every time you save a .pl or .pm file, it executes perl -c and shows you the output.

      ~~
      naChoZ

        Better would probably be something like:
        au BufWritePost *.pl,*.pm !perl -wcIlib %
        Warnings are important. -Ilib is probably also important, but maybe only I do editing in the root directory of my projects.

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: Vim for Perl developers
by djw (Vicar) on May 13, 2003 at 16:55 UTC
    What a great article, the best I've seen for configuring Vim for Perl. ++

    djw
Re: Vim for Perl developers
by gmax (Abbot) on May 13, 2003 at 16:56 UTC
      Wow, thanks! I didn't know that there is such a demand in the community. :) Now that I know, maybe I'll write a sequel or something. :) Thanks once again.

      Leonid Mamtchenkov aka TVSET

Re: Vim for Perl developers
by Ovid (Cardinal) on May 13, 2003 at 17:36 UTC
Re: Vim for Perl developers
by MrYoya (Monk) on May 13, 2003 at 18:59 UTC
    Great article, it has all kinds of little things I didn't know about. Thanks!
Re: Vim for Perl developers
by jplindstrom (Monsignor) on May 13, 2003 at 21:24 UTC
    While we're on the subject, I wonder if you gVim users on Windows out there would like to try out the gVim support in Perl Oasis (it is a Perl IDE, kind of. It is a code navigator; a POD/source/class/project browser). Reading the article, it sounds somewhat similar to the "Tag explorer".

    I implemented gVim support some time ago but thought I would support PFE completely before releasing it (the DDE support in Editor::Win32::PFE is somewhat shaky, so I'm not sure it'll work at all times). Then I got interested in other things :)

    The gVim stuff is done though, but since I don't use the editor myself I'm kind of curious how good it fits the way people actually use gVim. So, if you're interested in beta-testing the gVim stuff, I would be very happy to get your feedback.

    1. Download the beta, unzip
    2. Start gVim
    3. Start Perl Oasis
    4. In File | Preferences | Editor, chose gVim
    5. Check out Top Headings while you're in the preferences and go back there after trying it out
    6. Voila!

    /J

Re: Vim for Perl developers
by parv (Priest) on May 13, 2003 at 23:09 UTC
    I could not focus on the article as the screenshots are/were in rather small and fuzzy font w/ low constrast in background and foreground.
      I could not focus on the article as the screenshots are/were in rather small and fuzzy font w/ low constrast in background and foreground.

      Sorry, man. Originally, screenshots were about twice as big, but most of the people who did the preview of the draft suggested that they were too large.

      Anyway, I hope the article helped you to configure your Vim to behave in the similar way, so that you can enjoy bigger screens on your personal monitor now. :)

      And thanks for feedback...

      Leonid Mamtchenkov aka TVSET

Re: Vim for Perl developers
by lestrrat (Deacon) on May 13, 2003 at 23:10 UTC
Re: Vim for Perl developers
by parv (Priest) on May 14, 2003 at 00:37 UTC

    Thanks for highlighting taglist and BlockComment; i would not have (bothered to) found (find) them otherwise.

Re: Vim for Perl developers
by revdiablo (Prior) on May 14, 2003 at 04:35 UTC

    ++TVSET. Excellent article. I especially like bg=light and bg=dark. I have long wondered why vim uses different colors with different TERM settings... now I know why, and furthermore how to change the default behavior. Many thanks.

Re: Vim for Perl developers
by nefertari (Chaplain) on May 14, 2003 at 07:47 UTC

    I liked your article very much. But here at the university we have only version 5.6. So I have to try which of your tips work here.

    I also found a misprint:

    Vim support both vertical and horizontal window splitting. To split current window horizontally execute ":split" while in the normal mode. To split current window horizontally, use ":vsplit" instead.
    I think you mean vertically in the second sentence.

Re: Vim for Perl developers
by cciulla (Friar) on May 14, 2003 at 11:20 UTC

    ++TVSET.

    Regarding some of the screenshots -- you may want to consider using ":runtime! syntax/2html.vim". Granted, it would not show the results of ":split" or ":vsplit", and produces some rather... ugly html, but would address some of the issues that other monks have raised.

    C

      Yeah, well, I didn't know about ":runtime! syntax/2html.vim" thing until after I've posted the article. :) Everybody's learning. And I call that a Good Thing (tm). :)

      Leonid Mamtchenkov aka TVSET

Re: Vim for Perl developers
by weierophinney (Pilgrim) on May 14, 2003 at 17:15 UTC
    Excellent article! While I do or have tried many of the things you suggest, there were a few nuggets in there I'm looking forward to trying out (perldoc plugin, perl syntax compiler).

    Another plugin to look into is called Project , and allows you to define a hierarchy of files used in a project, macros specific to that project (including alternate highlighting schemes, etc.), and performing actions on groups of files. I've found it invaluable in a variety of coding projects.

Re: Vim for Perl developers
by YAFZ (Pilgrim) on May 15, 2003 at 11:18 UTC
    First of all thanks a lot for sharing such a lovely article with the fellow monks.

    What I liked most was "Embperl syntax highlighting", "Perl syntax compiler" and of course "Perldoc integration" (this one is really powerful and timesaving).

    I'm sure many VIMmers already knew majority of the tricks presented here, it is important that you put them in a concise and compact article that Ill share with my friends.

    Proposition: For any feature found in any text editor (excluding VIM) - be that a 1500$ closed source charismatic one with many menus or an open source alternative with a GUI and a lot of buzzwords - the same is already embedded in VIM, can be downloaded as a script from vim.org or programmed within VIM.

    Proof: Daily use of VIM ;-)
(z) Re: Vim for Perl developers
by zigdon (Deacon) on May 15, 2003 at 18:12 UTC
    Interesting article. Thanks for the pointer for tags - very cool.

    The only thing there I didn't see is the ability to switch to files and modules easily:

    set path+=/path/to/modules/** set suffixesadd=.pm,.pl set includeexpr=substitute(v:fname,'TMPLDIR','/path/to/tmpl/dir','')
    These lines give me the ability to move the cursor over 'DB' in a line like:
    use Peeron::DB;
    hit 'gf', and zoom - I'm editing the DB.pm file in /path/to/modules/Peeron/. Also allows to move the cursor over 'example.tmpl' in:
    my $tmpl = HTML::Template->New(Filename => "$Peeron::Conf::TMPLDIR/exa +mple.tmpl");
    hit 'gf', and get to /path/to/tmpl/dir/example.tmpl

    -- zigdon

Re: Vim for Perl developers
by bigj (Monk) on May 15, 2003 at 22:57 UTC
    Great article!

    When I used the suggestions, I found 2 things annoying me. I'm not sure whether other Perl programmers would also, but I suppose.

    I program with line numbering switched on, but the file/buffer browser has than also the line numbering. That's quite ugly, as I don't need it at these views and it is a simple waste of space. I fixed it with setting an autocmd that do set number only with specific files (like *.p?).

    The Perl syntax compiler is of course very useful, but it seems to be written in 2001 where perhaps an older Perl version was outsight. However, the compile command always starts with perl -Wc, so that in all part of the codes warnings are shown. Even in the { no warnings; ... } subparts. That's odd, as I suppose, nowadays with Perl 5.8, using use strict; use warnings; is the standard.
    I fixed it with a simple change in perl.vim, replacing setlocal makeprg=perl\ -Wc\ % with setlocal makeprg=perl\ -c\ %.

    Greetings,
    Janek

Awesome! One tweak on Perldoc though...
by cebrown (Pilgrim) on May 15, 2003 at 23:20 UTC
    Great post! Quick note: in order to make your Perldoc tip work, I needed to add <cword> as below:
    autocmd BufNewFile,BufRead *.p? map <F1> :Perldoc <cword><CR> +++++++
Re: Vim for Perl developers
by Crian (Chaplain) on Oct 14, 2004 at 13:46 UTC

    Very nice article!

    But I found two little errors or lazinesses:

    • In the section "text-folding" you wrote

      " Folding configuration set foldmethod=marker " Edit and uncomment next line if you want non-default marker "set foldmarker="[[[,]]]"

      I guess you deleted the wrong line and meant
      set foldmarker="{{{,}}}"
      instead of the last line?!

    • You used the comment
      " This is for winmanager
      more then once, even in the section "Tag explorer".

Re: Vim for Perl developers
by ddn123456 (Pilgrim) on Oct 07, 2008 at 18:18 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://257782]
Approved by broquaint
Front-paged by jeffa
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-07-26 04:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls