diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-06-15 09:20:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 09:20:32 +0200 |
commit | 504d7decbdef55d58e62217a0a54cbee2a0944cc (patch) | |
tree | 09922dd511d071bdde73df146eca5bda4741c759 /runtime/ftplugin/perl.vim | |
parent | 1493efdc141f0bc0a472b60f87927b3d5ab59f5e (diff) | |
download | rneovim-504d7decbdef55d58e62217a0a54cbee2a0944cc.tar.gz rneovim-504d7decbdef55d58e62217a0a54cbee2a0944cc.tar.bz2 rneovim-504d7decbdef55d58e62217a0a54cbee2a0944cc.zip |
vim-patch:8c1b8cb2e0b5 (#18966)
Update runtime files
https://github.com/vim/vim/commit/8c1b8cb2e0b52d0853f85c2096a2f22dbc57a788
Diffstat (limited to 'runtime/ftplugin/perl.vim')
-rw-r--r-- | runtime/ftplugin/perl.vim | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim index 603ba49502..d0bdbc0cfb 100644 --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -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 |