Mercurial > vim
annotate runtime/ftplugin/perl.vim @ 35324:7c7432a53a6c v9.1.0464
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Commit: https://github.com/vim/vim/commit/0a0830624a260660c7fa692ecb7e6e5de09114ba
Author: Riley Bruins <ribru17@hotmail.com>
Date: Mon Jun 3 20:40:45 2024 +0200
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Problem: no whitespace padding in commentstring option in ftplugins
Solution: Change default to include whitespace padding, update
existing filetype plugins with the new default value
(Riley Bruins)
closes: #14843
Signed-off-by: Riley Bruins <ribru17@hotmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 03 Jun 2024 21:00:04 +0200 |
parents | 8ae680be2a51 |
children |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
2 " Language: Perl |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
3 " Maintainer: vim-perl <vim-perl@googlegroups.com> |
20115 | 4 " Homepage: https://github.com/vim-perl/vim-perl |
5 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues | |
29150 | 6 " License: Vim License (see :help license) |
7 " Last Change: 2021 Nov 10 | |
33213
d84610677553
runtime(perl): Update ftplugin and indent files (#13052)
Christian Brabandt <cb@256bit.org>
parents:
33203
diff
changeset
|
8 " 2023 Sep 07 by Vim Project (safety check: don't execute perl |
d84610677553
runtime(perl): Update ftplugin and indent files (#13052)
Christian Brabandt <cb@256bit.org>
parents:
33203
diff
changeset
|
9 " from current directory) |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
10 " 2024 Jan 14 by Vim Project (browsefilter) |
35324
7c7432a53a6c
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Christian Brabandt <cb@256bit.org>
parents:
34134
diff
changeset
|
11 " 2024 May 24 by Riley Bruins <ribru17@gmail.com> ('commentstring') |
7 | 12 |
13 if exists("b:did_ftplugin") | finish | endif | |
14 let b:did_ftplugin = 1 | |
15 | |
16 " Make sure the continuation lines below do not cause problems in | |
17 " compatibility mode. | |
18 let s:save_cpo = &cpo | |
19 set cpo-=C | |
20 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
21 setlocal formatoptions-=t |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
22 setlocal formatoptions+=crqol |
1698 | 23 setlocal keywordprg=perldoc\ -f |
7 | 24 |
25 setlocal comments=:# | |
35324
7c7432a53a6c
patch 9.1.0464: no whitespace padding in commentstring option in ftplugins
Christian Brabandt <cb@256bit.org>
parents:
34134
diff
changeset
|
26 setlocal commentstring=#\ %s |
7 | 27 |
28 " Provided by Ned Konz <ned at bike-nomad dot com> | |
29 "--------------------------------------------- | |
603 | 30 setlocal include=\\<\\(use\\\|require\\)\\> |
29150 | 31 " '+' is removed to support plugins in Catalyst or DBIx::Class |
32 " where the leading plus indicates a fully-qualified module name. | |
33 setlocal includeexpr=substitute(substitute(substitute(substitute(v:fname,'+','',''),'::','/','g'),'->\*','',''),'$','.pm','') | |
7 | 34 setlocal define=[^A-Za-z_] |
12499 | 35 setlocal iskeyword+=: |
7 | 36 |
37 " The following line changes a global variable but is necessary to make | |
12499 | 38 " gf and similar commands work. Thanks to Andrew Pimlott for pointing |
29150 | 39 " out the problem. |
40 let s:old_isfname = &isfname | |
7 | 41 set isfname+=: |
29150 | 42 let s:new_isfname = &isfname |
43 | |
44 augroup perl_global_options | |
45 au! | |
46 exe "au BufEnter * if &filetype == 'perl' | let &isfname = '" . s:new_isfname . "' | endif" | |
47 exe "au BufLeave * if &filetype == 'perl' | let &isfname = '" . s:old_isfname . "' | endif" | |
48 augroup END | |
49 | |
50 " Undo the stuff we changed. | |
51 let b:undo_ftplugin = "setlocal fo< kp< com< cms< inc< inex< def< isk<" . | |
52 \ " | let &isfname = '" . s:old_isfname . "'" | |
53 | |
54 if get(g:, 'perl_fold', 0) | |
55 setlocal foldmethod=syntax | |
56 let b:undo_ftplugin .= " | setlocal fdm<" | |
57 endif | |
7 | 58 |
59 " Set this once, globally. | |
60 if !exists("perlpath") | |
33203
c3c347a71e05
runtime: don't execute external commands when loading ftplugins
Christian Brabandt <cb@256bit.org>
parents:
33196
diff
changeset
|
61 " safety check: don't execute perl binary by default |
33716
bd3ee5abdd7a
runtime(dist): centralize safe executable check and add vim library (#13413)
Christian Brabandt <cb@256bit.org>
parents:
33213
diff
changeset
|
62 if dist#vim#IsSafeExecutable('perl', 'perl') |
1621 | 63 try |
7 | 64 if &shellxquote != '"' |
65 let perlpath = system('perl -e "print join(q/,/,@INC)"') | |
66 else | |
67 let perlpath = system("perl -e 'print join(q/,/,@INC)'") | |
68 endif | |
69 let perlpath = substitute(perlpath,',.$',',,','') | |
1621 | 70 catch /E145:/ |
71 let perlpath = ".,," | |
72 endtry | |
7 | 73 else |
74 " If we can't call perl to get its path, just default to using the | |
75 " current directory and the directory of the current file. | |
76 let perlpath = ".,," | |
77 endif | |
78 endif | |
79 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
80 " Append perlpath to the existing path value, if it is set. Since we don't |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
81 " use += to do it because of the commas in perlpath, we have to handle the |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
82 " global / local settings, too. |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
83 if &l:path == "" |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
84 if &g:path == "" |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
85 let &l:path=perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
86 else |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
87 let &l:path=&g:path.",".perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
88 endif |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
89 else |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
90 let &l:path=&l:path.",".perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
91 endif |
29150 | 92 |
93 let b:undo_ftplugin .= " | setlocal pa<" | |
7 | 94 "--------------------------------------------- |
95 | |
29150 | 96 " Change the browse dialog to show mainly Perl-related files |
97 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |
98 let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . | |
99 \ "Perl Modules (*.pm)\t*.pm\n" . | |
34134
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
100 \ "Perl Documentation Files (*.pod)\t*.pod\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
101 if has("win32") |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
102 let b:browsefilter .= "All Files (*.*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
103 else |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
104 let b:browsefilter .= "All Files (*)\t*\n" |
8ae680be2a51
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents:
33716
diff
changeset
|
105 endif |
29150 | 106 let b:undo_ftplugin .= " | unlet! b:browsefilter" |
107 endif | |
7 | 108 |
29150 | 109 " Proper matching for matchit plugin |
110 if exists("loaded_matchit") && !exists("b:match_words") | |
111 let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField' | |
112 let b:match_words = '\<if\>:\<elsif\>:\<else\>' | |
113 let b:undo_ftplugin .= " | unlet! b:match_words b:match_skip" | |
114 endif | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
115 |
7 | 116 " Restore the saved compatibility options. |
117 let &cpo = s:save_cpo | |
29150 | 118 unlet s:save_cpo s:old_isfname s:new_isfname |