Skip to content

Commit 4e554d2

Browse files
authored
runtime(perl): Update ftplugin and indent files (#13052)
Signed-off-by: Christian Brabandt <[email protected]>
1 parent cc0bcf4 commit 4e554d2

3 files changed

Lines changed: 22 additions & 20 deletions

File tree

runtime/ftplugin/perl.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
66
" License: Vim License (see :help license)
77
" Last Change: 2021 Nov 10
8+
" 2023 Sep 07 by Vim Project (safety check: don't execute perl
9+
" from current directory)
810

911
if exists("b:did_ftplugin") | finish | endif
1012
let b:did_ftplugin = 1

runtime/ftplugin/pod.vim

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
" Homepage: https://github.com/vim-perl/vim-perl
66
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
77
" License: Vim License (see :help license)
8-
" Last Change: 2021 Oct 19
8+
" Last Change: 2023 Jul 05
99

1010
if exists("b:did_ftplugin")
11-
finish
11+
finish
1212
endif
13+
let b:did_ftplugin = 1
1314

1415
let s:save_cpo = &cpo
1516
set cpo-=C
@@ -37,32 +38,30 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
3738
let b:undo_ftplugin .= " | unlet! b:browsefilter"
3839
endif
3940

40-
function! s:jumpToSection(backwards)
41-
let flags = a:backwards ? 'bsWz' : 'sWz'
42-
if has('syntax_items')
41+
function s:jumpToSection(direction)
42+
let flags = a:direction == "backward" ? "bsWz" : "sWz"
43+
if has("syntax_items")
4344
let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'"
4445
else
45-
let skip = ''
46+
let skip = ""
4647
endif
4748
for i in range(v:count1)
4849
call search('^=\a', flags, 0, 0, skip)
4950
endfor
5051
endfunction
5152

5253
if !exists("no_plugin_maps") && !exists("no_pod_maps")
53-
nnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR>
54-
vnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR>
55-
nnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR>
56-
vnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR>
57-
nnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR>
58-
vnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR>
59-
nnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR>
60-
vnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR>
61-
let b:undo_ftplugin .=
62-
\ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" .
63-
\ " | silent! exe 'nunmap <buffer> ][' | silent! exe 'vunmap <buffer> ]['" .
64-
\ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" .
65-
\ " | silent! exe 'nunmap <buffer> []' | silent! exe 'vunmap <buffer> []'"
54+
for s:mode in ["n", "o", "x"]
55+
for s:lhs in ["]]", "]["]
56+
execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('forward')<CR>"
57+
let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'"
58+
endfor
59+
for s:lhs in ["[[", "[]"]
60+
execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('backward')<CR>"
61+
let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'"
62+
endfor
63+
endfor
64+
unlet s:mode s:lhs
6665
endif
6766

6867
let &cpo = s:save_cpo

runtime/indent/perl.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
" Homepage: https://github.com/vim-perl/vim-perl
55
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues
66
" License: Vim License (see :help license)
7-
" Last Change: 2021 Sep 24
7+
" Last Change: 2022 Jun 14
88

99
" Suggestions and improvements by :
1010
" Aaron J. Sherman (use syntax for hints)
@@ -133,6 +133,7 @@ function! GetPerlIndent()
133133
\ || synid == "perlHereDoc"
134134
\ || synid == "perlBraces"
135135
\ || synid == "perlStatementIndirObj"
136+
\ || synid == "perlSubDeclaration"
136137
\ || synid =~ "^perlFiledescStatement"
137138
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
138139
let brace = strpart(line, bracepos, 1)

0 commit comments

Comments
 (0)