@@ -77,9 +77,6 @@ if has('conceal')
77
77
endif
78
78
79
79
80
- let s: skip_search = ' synIDattr(synID(line("."), col("."), 0), "name") ' .
81
- \ ' =~? "comment"'
82
-
83
80
" Use 'shiftwidth()' instead of '&sw'.
84
81
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
85
82
if exists (' *shiftwidth' )
93
90
endif
94
91
95
92
" Find backwards the closest open parenthesis/bracket/brace.
96
- function ! s: find_opening_paren (... )
97
- " optional arguments: line and column (defaults to 1) to search around
98
- if a: 0 > 0
99
- let view = winsaveview ()
100
- call cursor (a: 1 , a: 0 > 1 ? a: 2 : 1 )
101
- let ret = s: find_opening_paren ()
102
- call winrestview (view )
103
- return ret
93
+ function ! s: find_opening_paren (lnum, col )
94
+ " Return if cursor is in a comment.
95
+ if synIDattr (synID (a: lnum , a: col , 0 ), ' name' ) = ~? ' comment'
96
+ return [0 , 0 ]
104
97
endif
105
98
106
- " Return if cursor is in a comment.
107
- exe ' if' s: skip_search ' | return [0, 0] | endif'
99
+ call cursor (a: lnum , a: col )
108
100
109
101
let nearest = [0 , 0 ]
110
102
for [p , maxoff] in items (s: paren_pairs )
@@ -125,7 +117,7 @@ function! s:find_start_of_multiline_statement(lnum)
125
117
if getline (lnum - 1 ) = ~# ' \\$'
126
118
let lnum = prevnonblank (lnum - 1 )
127
119
else
128
- let [paren_lnum, _] = s: find_opening_paren (lnum)
120
+ let [paren_lnum, _] = s: find_opening_paren (lnum, 1 )
129
121
if paren_lnum < 1
130
122
return lnum
131
123
else
@@ -182,7 +174,7 @@ endfunction
182
174
183
175
" Line up with open parenthesis/bracket/brace.
184
176
function ! s: indent_like_opening_paren (lnum)
185
- let [paren_lnum, paren_col] = s: find_opening_paren (a: lnum )
177
+ let [paren_lnum, paren_col] = s: find_opening_paren (a: lnum, 1 )
186
178
if paren_lnum <= 0
187
179
return -2
188
180
endif
@@ -212,7 +204,7 @@ function! s:indent_like_opening_paren(lnum)
212
204
" from the next logical line.
213
205
if text = ~# b: control_statement && res == base + s: sw ()
214
206
" But only if not inside parens itself (Flake's E127).
215
- let [paren_lnum, _] = s: find_opening_paren (paren_lnum)
207
+ let [paren_lnum, _] = s: find_opening_paren (paren_lnum, 1 )
216
208
if paren_lnum <= 0
217
209
return res + s: sw ()
218
210
endif
0 commit comments