Merged from the latest developing branch.
[MacVim/jjgod.git] / runtime / ftplugin / perl.vim
blobb3078005f99480f21df6b997edbe4661f90393a8
1 " Vim filetype plugin file
2 " Language:     Perl
3 " Maintainer:   Dan Sharp <dwsharp at hotmail dot com>
4 " Last Change:  2005 Dec 16
5 " URL:          http://mywebpage.netscape.com/sharppeople/vim/ftplugin
7 if exists("b:did_ftplugin") | finish | endif
8 let b:did_ftplugin = 1
10 " Make sure the continuation lines below do not cause problems in
11 " compatibility mode.
12 let s:save_cpo = &cpo
13 set cpo-=C
15 setlocal formatoptions+=crq
17 setlocal comments=:#
18 setlocal commentstring=#%s
20 " Change the browse dialog on Win32 to show mainly Perl-related files
21 if 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"
26 endif
28 " Provided by Ned Konz <ned at bike-nomad dot com>
29 "---------------------------------------------
30 setlocal include=\\<\\(use\\\|require\\)\\>
31 setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
32 setlocal define=[^A-Za-z_]
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-=:
39 set isfname+=:
40 "setlocal iskeyword=48-57,_,A-Z,a-z,:
42 " Set this once, globally.
43 if !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
56 endif
58 let &l:path=perlpath
59 "---------------------------------------------
61 " Undo the stuff we changed.
62 let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf<" .
63             \         " | unlet! b:browsefilter"
65 " Restore the saved compatibility options.
66 let &cpo = s:save_cpo