blob: b3078005f99480f21df6b997edbe4661f90393a8 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: Perl
3" Maintainer: Dan Sharp <dwsharp at hotmail dot com>
Bram Moolenaar83c465c2005-12-16 21:53:56 +00004" Last Change: 2005 Dec 16
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin
6
7if exists("b:did_ftplugin") | finish | endif
8let b:did_ftplugin = 1
9
10" Make sure the continuation lines below do not cause problems in
11" compatibility mode.
12let s:save_cpo = &cpo
13set cpo-=C
14
15setlocal formatoptions+=crq
16
17setlocal comments=:#
18setlocal commentstring=#%s
19
20" Change the browse dialog on Win32 to show mainly Perl-related files
21if has("gui_win32")
22 let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
23 \ "Perl Modules (*.pm)\t*.pm\n" .
24 \ "Perl Documentation Files (*.pod)\t*.pod\n" .
25 \ "All Files (*.*)\t*.*\n"
26endif
27
28" Provided by Ned Konz <ned at bike-nomad dot com>
29"---------------------------------------------
Bram Moolenaar83c465c2005-12-16 21:53:56 +000030setlocal include=\\<\\(use\\\|require\\)\\>
Bram Moolenaar071d4272004-06-13 20:20:40 +000031setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
32setlocal define=[^A-Za-z_]
33
34" The following line changes a global variable but is necessary to make
35" gf and similar commands work. The change to iskeyword was incorrect.
36" Thanks to Andrew Pimlott for pointing out the problem. If this causes a
37" problem for you, add an after/ftplugin/perl.vim file that contains
38" set isfname-=:
39set isfname+=:
40"setlocal iskeyword=48-57,_,A-Z,a-z,:
41
42" Set this once, globally.
43if !exists("perlpath")
44 if executable("perl")
45 if &shellxquote != '"'
46 let perlpath = system('perl -e "print join(q/,/,@INC)"')
47 else
48 let perlpath = system("perl -e 'print join(q/,/,@INC)'")
49 endif
50 let perlpath = substitute(perlpath,',.$',',,','')
51 else
52 " If we can't call perl to get its path, just default to using the
53 " current directory and the directory of the current file.
54 let perlpath = ".,,"
55 endif
56endif
57
58let &l:path=perlpath
59"---------------------------------------------
60
61" Undo the stuff we changed.
62let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf<" .
63 \ " | unlet! b:browsefilter"
64
65" Restore the saved compatibility options.
66let &cpo = s:save_cpo