vim-patch:4e554d282c50

runtime(perl): Update ftplugin and indent files (vim/vim#13052)

4e554d282c

Co-authored-by: dkearns <dougkearns@gmail.com>
This commit is contained in:
Christian Clason
2023-09-08 23:34:43 +02:00
parent 82150ca51b
commit 0bee75818e
3 changed files with 22 additions and 20 deletions

View File

@@ -5,6 +5,8 @@
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
" License: Vim License (see :help license) " License: Vim License (see :help license)
" Last Change: 2021 Nov 10 " Last Change: 2021 Nov 10
" 2023 Sep 07 by Vim Project (safety check: don't execute perl
" from current directory)
if exists("b:did_ftplugin") | finish | endif if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1

View File

@@ -5,11 +5,12 @@
" Homepage: https://github.com/vim-perl/vim-perl " Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
" License: Vim License (see :help license) " License: Vim License (see :help license)
" Last Change: 2021 Oct 19 " Last Change: 2023 Jul 05
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
finish finish
endif endif
let b:did_ftplugin = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo-=C set cpo-=C
@@ -37,12 +38,12 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
let b:undo_ftplugin .= " | unlet! b:browsefilter" let b:undo_ftplugin .= " | unlet! b:browsefilter"
endif endif
function! s:jumpToSection(backwards) function s:jumpToSection(direction)
let flags = a:backwards ? 'bsWz' : 'sWz' let flags = a:direction == "backward" ? "bsWz" : "sWz"
if has('syntax_items') if has("syntax_items")
let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'" let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'"
else else
let skip = '' let skip = ""
endif endif
for i in range(v:count1) for i in range(v:count1)
call search('^=\a', flags, 0, 0, skip) call search('^=\a', flags, 0, 0, skip)
@@ -50,19 +51,17 @@ function! s:jumpToSection(backwards)
endfunction endfunction
if !exists("no_plugin_maps") && !exists("no_pod_maps") if !exists("no_plugin_maps") && !exists("no_pod_maps")
nnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR> for s:mode in ["n", "o", "x"]
vnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR> for s:lhs in ["]]", "]["]
nnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR> execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('forward')<CR>"
vnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR> let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'"
nnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR> endfor
vnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR> for s:lhs in ["[[", "[]"]
nnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR> execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('backward')<CR>"
vnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR> let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'"
let b:undo_ftplugin .= endfor
\ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" . endfor
\ " | silent! exe 'nunmap <buffer> ][' | silent! exe 'vunmap <buffer> ]['" . unlet s:mode s:lhs
\ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" .
\ " | silent! exe 'nunmap <buffer> []' | silent! exe 'vunmap <buffer> []'"
endif endif
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@@ -4,7 +4,7 @@
" Homepage: https://github.com/vim-perl/vim-perl " Homepage: https://github.com/vim-perl/vim-perl
" Bugs/requests: https://github.com/vim-perl/vim-perl/issues " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
" License: Vim License (see :help license) " License: Vim License (see :help license)
" Last Change: 2021 Sep 24 " Last Change: 2022 Jun 14
" Suggestions and improvements by : " Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints) " Aaron J. Sherman (use syntax for hints)
@@ -133,6 +133,7 @@ function! GetPerlIndent()
\ || synid == "perlHereDoc" \ || synid == "perlHereDoc"
\ || synid == "perlBraces" \ || synid == "perlBraces"
\ || synid == "perlStatementIndirObj" \ || synid == "perlStatementIndirObj"
\ || synid == "perlSubDeclaration"
\ || synid =~ "^perlFiledescStatement" \ || synid =~ "^perlFiledescStatement"
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let brace = strpart(line, bracepos, 1) let brace = strpart(line, bracepos, 1)