Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

VIM 6.0 filetype plugin for Perl

by bikeNomad (Priest)
on Jun 21, 2001 at 00:24 UTC ( #90172=snippet: print w/replies, xml ) Need Help??
Description: Save this as ftplugin/perl.vim below a directory in your Vim runtimepath (type :set runtimepath to find it). This will allow you to search through included modules, use tags easily, and use the define-searching capability ( [d etc) to find subroutine definitions.

I posted this snippet in a message some time earlier, then found that I had to use Super Search to find it. Anyway, I figured I'd put it here.

" Vim filetype plugin file
" Language: Perl
" Maintainer: Ned Konz <>
" Last change: $Date: 2001/06/20 20:23:37 $
" $Revision: 1.6 $

" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")

" Set this once, globally.
if !exists("perlpath")
  let perlpath = system('perl -e "print join(\",\",@INC)"')

" Don't load another plugin for this buffer
let b:did_ftplugin = 1

" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal fo-=t fo+=croql
setlocal include=\\<\\(use\\\|require\\)\\>
setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','','')
setlocal isfname=A-Z,a-z,:,48-57,_
setlocal keywordprg=perldoc
setlocal iskeyword=48-57,_,A-Z,a-z,: 
setlocal isident=48-57,_,A-Z,a-z
setlocal define=^\\s*sub
setlocal comments=:#
let &l:path=perlpath
setlocal makeprg=perl\ -Mstrict\ -wc\ %
setlocal errorformat+=%m\ at\ %f\ line\ %l.
setlocal grepprg=rgrep\ -n\ -R\ '*.p[ml]'\ $*
map <buffer> <C-]> :exec ":tag /".expand("<cword>")
Replies are listed 'Best First'.
Re: VIM 6.0 filetype plugin for Perl
by markjugg (Curate) on Feb 22, 2002 at 01:51 UTC
    I can explain what's happen with the makeprg and errorformat lines some more. They are helping Perl to work with Vim 6.0's quickfix mode. I explained this in more detail.


Re: VIM 6.0 filetype plugin for Perl
by Intrepid (Deacon) on Aug 18, 2003 at 10:44 UTC

    As all other comments have stated, this is an excellent contribution, Ned. I am really pleased to have belatedly discovered your presence on PM.

    I am interested in using the file you present but I do have a question on my mind: the Vim I use already has a $VIMRUNTIME/ftplugin/perl.vim file, and some of it is credited to you. It duplicates some but not all of the statements in your file. If you care to, could you discuss the differences in features or functionality achieved by using this script over what's now being distributed as part of Vim (for example, the latest version is canonically available at this url)?

    Thanks again!


    use PerlMonk::Tye qw(:wisely);
Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: snippet [id://90172]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2023-12-01 19:32 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (5 votes). Check out past polls.