File autoload/Preamble.vim changed (mode: 100644) (index 50afd57..d9d06e4) |
... |
... |
fun! s:Length() |
179 |
179 |
if !is_blankline |
if !is_blankline |
180 |
180 |
let synId = synID(line_pos, 1, 1) |
let synId = synID(line_pos, 1, 1) |
181 |
181 |
let realSynId = synIDtrans(synId) |
let realSynId = synIDtrans(synId) |
182 |
|
if (synIDattr( realSynId, 'name' ) != 'Comment') | break | endif |
|
|
182 |
|
let attrName = synIDattr( realSynId, 'name' ) |
|
183 |
|
if attrName != 'Comment' && !s:IsInString(line_pos) |
|
184 |
|
break |
|
185 |
|
endif |
183 |
186 |
endif |
endif |
184 |
187 |
|
|
185 |
188 |
let line_pos = line_pos + 1 |
let line_pos = line_pos + 1 |
186 |
189 |
endwhile |
endwhile |
187 |
190 |
|
|
188 |
191 |
return line_pos-1 |
return line_pos-1 |
189 |
|
endfunction |
|
|
192 |
|
endfunction |
|
193 |
|
|
|
194 |
|
|
|
195 |
|
" ======================================================== |
|
196 |
|
" IsInString: Checks whether line is part of a string |
|
197 |
|
" |
|
198 |
|
" This is important for example for python, which |
|
199 |
|
" doesn't have multiline comments and multiline string |
|
200 |
|
" literals are used instead. |
|
201 |
|
" ======================================================== |
190 |
202 |
|
|
|
203 |
|
fun! s:IsInString(line) |
|
204 |
|
for id in synstack(a:line, 1) |
|
205 |
|
let attrName = synIDattr(synIDtrans(id), 'name') |
|
206 |
|
if attrName == 'String' |
|
207 |
|
return 1 |
|
208 |
|
endif |
|
209 |
|
endfor |
|
210 |
|
return 0 |
|
211 |
|
endfunction |