Commit 7eac6cee0b0081ba2e145cb72188fb3a9923f43b
Fix creation of multiple foldes
How to reproduce:
* add "filetype = c" to modeline
* or just do `:set filetype=c` N times, there will be N folds on the
first line without this change
Author: xaizek
Author date (UTC): 2015-10-31 07:51
Committer name: xaizek
Committer date (UTC): 2015-10-31 07:51
Parent(s): c431aedbc40ea5374b51a2f3bedb27f87662624a
Signing key:
Tree: bdd6a336154de9667b5c03ffb68bbb8678b06bb7
File autoload/Preamble.vim changed (mode: 100644) (index 85227d0..92950b9) |
... |
... |
fun! Preamble#Fold() |
49 |
49 |
if pl < s:preamble_min_lines | return | endif |
if pl < s:preamble_min_lines | return | endif |
50 |
50 |
if pl > s:preamble_max_lines && !s:preamble_fold_partial | return | endif |
if pl > s:preamble_max_lines && !s:preamble_fold_partial | return | endif |
51 |
51 |
|
|
52 |
|
" if a fold aleady exists in line 1, just close it |
|
53 |
|
if foldlevel(1) && foldclosed(1) == -1 |
|
54 |
|
execute ':1,'.pl.'foldclose' |
|
|
52 |
|
" if a fold aleady exists in line 1 |
|
53 |
|
if foldlevel(1) |
|
54 |
|
" and it's open, close it |
|
55 |
|
if foldclosed(1) == -1 |
|
56 |
|
execute ':1,'.pl.'foldclose' |
|
57 |
|
endif |
|
58 |
|
" or do nothing |
55 |
59 |
return |
return |
56 |
60 |
endif |
endif |
57 |
61 |
|
|