29150
|
1 " Vim filetype plugin file
|
|
2 " Language: Perl POD format
|
|
3 " Maintainer: vim-perl <vim-perl@googlegroups.com>
|
|
4 " Author: Doug Kearns <dougkearns@gmail.com>
|
|
5 " Homepage: https://github.com/vim-perl/vim-perl
|
|
6 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
|
|
7 " License: Vim License (see :help license)
|
|
8 " Last Change: 2021 Oct 19
|
|
9
|
|
10 if exists("b:did_ftplugin")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 let s:save_cpo = &cpo
|
|
15 set cpo-=C
|
|
16
|
|
17 setlocal comments=fb:=for\ comment
|
|
18 setlocal commentstring==for\ comment\ %s
|
|
19
|
|
20 let b:undo_ftplugin = "setl com< cms<"
|
|
21
|
|
22 if exists("loaded_matchit") && !exists("b:match_words")
|
|
23 let b:match_words =
|
|
24 \ '^=pod\>:^=cut\>,' .
|
|
25 \ '^=begin\s\+\(\S\+\):^=end\s\+\1,' .
|
|
26 \ '^=over\>:^=item\>:^=back\>,' .
|
|
27 \ '[IBCLEFSXZ]<<\%(\s\+\|$\)\@=:\%(\s\+\|^\)\@<=>>,' .
|
|
28 \ '[IBCLEFSXZ]<:>'
|
|
29 let b:undo_ftplugin .= " | unlet! b:match_words"
|
|
30 endif
|
|
31
|
|
32 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
|
33 let b:browsefilter = "POD Source Files (*.pod)\t*.pod\n" .
|
|
34 \ "Perl Source Files (*.pl)\t*.pl\n" .
|
|
35 \ "Perl Modules (*.pm)\t*.pm\n" .
|
|
36 \ "All Files (*.*)\t*.*\n"
|
|
37 let b:undo_ftplugin .= " | unlet! b:browsefilter"
|
|
38 endif
|
|
39
|
|
40 function! s:jumpToSection(backwards)
|
|
41 let flags = a:backwards ? 'bsWz' : 'sWz'
|
|
42 if has('syntax_items')
|
|
43 let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'"
|
|
44 else
|
|
45 let skip = ''
|
|
46 endif
|
|
47 for i in range(v:count1)
|
|
48 call search('^=\a', flags, 0, 0, skip)
|
|
49 endfor
|
|
50 endfunction
|
|
51
|
|
52 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> []'"
|
|
66 endif
|
|
67
|
|
68 let &cpo = s:save_cpo
|
|
69 unlet s:save_cpo
|
|
70
|
|
71 " vim: set expandtab:
|