I'm trying to make a fold expression that increases the fold level
whenever a "{" appears at the end of a line, and decreases when a
"}" appears at the beginning. I'm having problems writing such
an expression because the "sN" construct doesn't affect the fold
level of the line for which it is returned. :-(
Example: Take the following fold expression:
fun! Fold_level()
if getline(v:lnum) == '2'
return "a1"
elseif getline(v:lnum) == '4'
return "s1"
else
return '='
endif
endfun
Apply this to the following text:
1
2
3
4
5
6
For this file, Fold_level() produces:
1 --> '='
2 --> 'a1'
3 --> '='
4 --> 's1'
5 --> '='
6 --> '='
Shouldn't this cause lines 2 and 3 to be folded (level 1), and
the rest of the lines unfolded (level 0)? What really happens
is that line 4 is also given fold level 1, even though the fold
expression for line 4 returns "s1", which means the previous
level minus one.
--
Haakon
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php