mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
@@ -3,7 +3,8 @@
|
||||
" Maintainer: vim-perl <vim-perl@googlegroups.com>
|
||||
" Homepage: https://github.com/vim-perl/vim-perl
|
||||
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
|
||||
" Last Change: 2020 Apr 15
|
||||
" License: Vim License (see :help license)
|
||||
" Last Change: 2021 Nov 10
|
||||
|
||||
if exists("b:did_ftplugin") | finish | endif
|
||||
let b:did_ftplugin = 1
|
||||
@@ -20,27 +21,36 @@ setlocal keywordprg=perldoc\ -f
|
||||
setlocal comments=:#
|
||||
setlocal commentstring=#%s
|
||||
|
||||
" Change the browse dialog on Win32 to show mainly Perl-related files
|
||||
if has("gui_win32")
|
||||
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
||||
\ "Perl Modules (*.pm)\t*.pm\n" .
|
||||
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
" Provided by Ned Konz <ned at bike-nomad dot com>
|
||||
"---------------------------------------------
|
||||
setlocal include=\\<\\(use\\\|require\\)\\>
|
||||
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
|
||||
" '+' is removed to support plugins in Catalyst or DBIx::Class
|
||||
" where the leading plus indicates a fully-qualified module name.
|
||||
setlocal includeexpr=substitute(substitute(substitute(substitute(v:fname,'+','',''),'::','/','g'),'->\*','',''),'$','.pm','')
|
||||
setlocal define=[^A-Za-z_]
|
||||
setlocal iskeyword+=:
|
||||
|
||||
" The following line changes a global variable but is necessary to make
|
||||
" gf and similar commands work. Thanks to Andrew Pimlott for pointing
|
||||
" out the problem. If this causes a problem for you, add an
|
||||
" after/ftplugin/perl.vim file that contains
|
||||
" set isfname-=:
|
||||
" out the problem.
|
||||
let s:old_isfname = &isfname
|
||||
set isfname+=:
|
||||
let s:new_isfname = &isfname
|
||||
|
||||
augroup perl_global_options
|
||||
au!
|
||||
exe "au BufEnter * if &filetype == 'perl' | let &isfname = '" . s:new_isfname . "' | endif"
|
||||
exe "au BufLeave * if &filetype == 'perl' | let &isfname = '" . s:old_isfname . "' | endif"
|
||||
augroup END
|
||||
|
||||
" Undo the stuff we changed.
|
||||
let b:undo_ftplugin = "setlocal fo< kp< com< cms< inc< inex< def< isk<" .
|
||||
\ " | let &isfname = '" . s:old_isfname . "'"
|
||||
|
||||
if get(g:, 'perl_fold', 0)
|
||||
setlocal foldmethod=syntax
|
||||
let b:undo_ftplugin .= " | setlocal fdm<"
|
||||
endif
|
||||
|
||||
" Set this once, globally.
|
||||
if !exists("perlpath")
|
||||
@@ -74,16 +84,26 @@ if &l:path == ""
|
||||
else
|
||||
let &l:path=&l:path.",".perlpath
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin .= " | setlocal pa<"
|
||||
"---------------------------------------------
|
||||
|
||||
" Undo the stuff we changed.
|
||||
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" .
|
||||
\ " | unlet! b:browsefilter"
|
||||
" Change the browse dialog to show mainly Perl-related files
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" .
|
||||
\ "Perl Modules (*.pm)\t*.pm\n" .
|
||||
\ "Perl Documentation Files (*.pod)\t*.pod\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
let b:undo_ftplugin .= " | unlet! b:browsefilter"
|
||||
endif
|
||||
|
||||
" proper matching for matchit plugin
|
||||
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
||||
let b:match_words = '\<if\>:\<elsif\>:\<else\>'
|
||||
" Proper matching for matchit plugin
|
||||
if exists("loaded_matchit") && !exists("b:match_words")
|
||||
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
|
||||
let b:match_words = '\<if\>:\<elsif\>:\<else\>'
|
||||
let b:undo_ftplugin .= " | unlet! b:match_words b:match_skip"
|
||||
endif
|
||||
|
||||
" Restore the saved compatibility options.
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
unlet s:save_cpo s:old_isfname s:new_isfname
|
||||
|
Reference in New Issue
Block a user