annotate runtime/indent/perl.vim @ 35908:33e5b3e91301

runtime(zip): Fix for FreeBSD's unzip command Commit: https://github.com/vim/vim/commit/f0e9b72c8fdd47b9b410a11edf7479953cb2aed9 Author: Damien <141588647+xrandomname@users.noreply.github.com> Date: Mon Aug 5 20:21:18 2024 +0200 runtime(zip): Fix for FreeBSD's unzip command Problem: Cannot browse zipfiles with the unzip program found on FreeBSD. Solution: Adjust command arguments. Unzip found on FreeBSD complain about missing argument with the zipinfo modifier '-Z -1'. Joining arguments seems to work for both implementations. Also change `:sil!` to `:sil` so that error messages are properly reported (per review of Christian Brabandt). related: #15411 Signed-off-by: Damien <141588647+xrandomname@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 05 Aug 2024 20:30:02 +0200
parents d84610677553
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim indent file
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
2 " Language: Perl
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2531
diff changeset
3 " Maintainer: vim-perl <vim-perl@googlegroups.com>
20115
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12499
diff changeset
4 " Homepage: https://github.com/vim-perl/vim-perl
bd021eb62e73 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 12499
diff changeset
5 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
6 " License: Vim License (see :help license)
33213
d84610677553 runtime(perl): Update ftplugin and indent files (#13052)
Christian Brabandt <cb@256bit.org>
parents: 29193
diff changeset
7 " Last Change: 2022 Jun 14
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
9 " Suggestions and improvements by :
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
10 " Aaron J. Sherman (use syntax for hints)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
11 " Artem Chuprina (play nice with folding)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
13 " TODO things that are not or not properly indented (yet) :
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
14 " - Continued statements
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
15 " print "foo",
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
16 " "bar";
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
17 " print "foo"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
18 " if bar();
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
19 " - Multiline regular expressions (m//x)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
20 " (The following probably needs modifying the perl syntax file)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
21 " - qw() lists
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
22 " - Heredocs with terminators that don't match \I\i*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
24 " Only load this indent file when no other was loaded.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
25 if exists("b:did_indent")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
26 finish
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
27 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
28 let b:did_indent = 1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
30 " Is syntax highlighting active ?
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
31 let b:indent_use_syntax = has("syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
33 setlocal indentexpr=GetPerlIndent()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
34 setlocal indentkeys+=0=,0),0],0=or,0=and
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
35 if !b:indent_use_syntax
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
36 setlocal indentkeys+=0=EO
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
37 endif
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
38
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
39 let b:undo_indent = "setl inde< indk<"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
40
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
41 let s:cpo_save = &cpo
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
42 set cpo-=C
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
43
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
44 function! GetPerlIndent()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
45
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
46 " Get the line to be indented
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
47 let cline = getline(v:lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
48
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
49 " Indent POD markers to column 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
50 if cline =~ '^\s*=\L\@!'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
51 return 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
52 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
53
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
54 " Get current syntax item at the line's first char
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
55 let csynid = ''
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
56 if b:indent_use_syntax
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
57 let csynid = synIDattr(synID(v:lnum,1,0),"name")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
58 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
59
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
60 " Don't reindent POD and heredocs
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
61 if csynid == "perlPOD" || csynid == "perlHereDoc" || csynid =~ "^pod"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
62 return indent(v:lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
63 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
64
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
65 " Indent end-of-heredocs markers to column 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
66 if b:indent_use_syntax
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
67 " Assumes that an end-of-heredoc marker matches \I\i* to avoid
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
68 " confusion with other types of strings
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
69 if csynid == "perlStringStartEnd" && cline =~ '^\I\i*$'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
70 return 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
71 endif
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
72 else
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
73 " Without syntax hints, assume that end-of-heredocs markers begin with EO
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
74 if cline =~ '^\s*EO'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
75 return 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
76 endif
2531
c9022997af9e Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2423
diff changeset
77 endif
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
78
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
79 " Now get the indent of the previous perl line.
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
80
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
81 " Find a non-blank line above the current line.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
82 let lnum = prevnonblank(v:lnum - 1)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
83 " Hit the start of the file, use zero indent.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
84 if lnum == 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
85 return 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
86 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
87 let line = getline(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
88 let ind = indent(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
89 " Skip heredocs, POD, and comments on 1st column
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
90 if b:indent_use_syntax
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
91 let skippin = 2
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
92 while skippin
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
93 let synid = synIDattr(synID(lnum,1,0),"name")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
94 if (synid == "perlStringStartEnd" && line =~ '^\I\i*$')
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
95 \ || (skippin != 2 && synid == "perlPOD")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
96 \ || (skippin != 2 && synid == "perlHereDoc")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
97 \ || synid == "perlComment"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
98 \ || synid =~ "^pod"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
99 let lnum = prevnonblank(lnum - 1)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
100 if lnum == 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
101 return 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
102 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
103 let line = getline(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
104 let ind = indent(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
105 let skippin = 1
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
106 else
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
107 let skippin = 0
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
108 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
109 endwhile
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
110 else
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
111 if line =~ "^EO"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
112 let lnum = search("<<[\"']\\=EO", "bW")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
113 let line = getline(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
114 let ind = indent(lnum)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
115 endif
29150
d1fe80fb35e6 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20115
diff changeset
116 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
118 " Indent blocks enclosed by {}, (), or []
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
119 if b:indent_use_syntax
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
120 " Find a real opening brace
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
121 " NOTE: Unlike Perl character classes, we do NOT need to escape the
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
122 " closing brackets with a backslash. Doing so just puts a backslash
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
123 " in the character class and causes sorrow. Instead, put the closing
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
124 " bracket as the first character in the class.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
125 let braceclass = '[][(){}]'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
126 let bracepos = match(line, braceclass, matchend(line, '^\s*[])}]'))
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
127 while bracepos != -1
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
128 let synid = synIDattr(synID(lnum, bracepos + 1, 0), "name")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
129 " If the brace is highlighted in one of those groups, indent it.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
130 " 'perlHereDoc' is here only to handle the case '&foo(<<EOF)'.
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
131 if synid == ""
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
132 \ || synid == "perlMatchStartEnd"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
133 \ || synid == "perlHereDoc"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
134 \ || synid == "perlBraces"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
135 \ || synid == "perlStatementIndirObj"
33213
d84610677553 runtime(perl): Update ftplugin and indent files (#13052)
Christian Brabandt <cb@256bit.org>
parents: 29193
diff changeset
136 \ || synid == "perlSubDeclaration"
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
137 \ || synid =~ "^perlFiledescStatement"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
138 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
139 let brace = strpart(line, bracepos, 1)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
140 if brace == '(' || brace == '{' || brace == '['
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
141 let ind = ind + shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
142 else
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
143 let ind = ind - shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
144 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
145 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
146 let bracepos = match(line, braceclass, bracepos + 1)
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
147 endwhile
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
148 let bracepos = matchend(cline, '^\s*[])}]')
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
149 if bracepos != -1
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
150 let synid = synIDattr(synID(v:lnum, bracepos, 0), "name")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
151 if synid == ""
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
152 \ || synid == "perlMatchStartEnd"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
153 \ || synid == "perlBraces"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
154 \ || synid == "perlStatementIndirObj"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
155 \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
156 let ind = ind - shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
157 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
158 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
159 else
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
160 if line =~ '[{[(]\s*\(#[^])}]*\)\=$'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
161 let ind = ind + shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
162 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
163 if cline =~ '^\s*[])}]'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
164 let ind = ind - shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
165 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
166 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
168 " Indent lines that begin with 'or' or 'and'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
169 if cline =~ '^\s*\(or\|and\)\>'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
170 if line !~ '^\s*\(or\|and\)\>'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
171 let ind = ind + shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
172 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
173 elseif line =~ '^\s*\(or\|and\)\>'
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
174 let ind = ind - shiftwidth()
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
175 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
177 return ind
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
178
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
179 endfunction
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
180
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
181 let &cpo = s:cpo_save
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
182 unlet s:cpo_save
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
183
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29150
diff changeset
184 " vim:ts=8:sts=4:sw=4:expandtab:ft=vim