Sunday, June 11, 2017

set foldlevel

Hi,

I have a big file with more than 100000 lines to fold.



Out of using common foldexpr method that takes too long time, I have tried to readfile in binary mode and by comparison with each begin of lines, I have feed own dictionnary scannedfoldlinenos like that :

scannedfoldlinenos = { 'lineno' : 'foldlevel' }

1 : '>1'
152 : '<1'
153 : '>1'
600 : '<1'


Then with this dict, I use common foldexpr method like that :


setlocal foldmethod=expr
setlocal foldexpr=GetFold(v:lnum)
function! GetFold(lnum)
if has_key(scannedfoldlinenos, a:lnum)
return scannedfoldlinenos[lnum]
else
return '='
endif
endfunction



It does not fold my file so I would like to know if I can set fold starting from my dict infos.

Thank you!

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment