Posts

Possible to set `foldexpr` using a function reference?

Image
1 Got this: let Func = function(folding_function) "folding_function is name of function setlocal foldexpr=call(Func(v:lnum)) This is so user can set a custom function for folding in their config file. I can't get it to work, though. Also tried: call(Func, v:lnum) and call(Func, 'v:lnum') Code in context " Set settings which are local to a window. In a new tab they would be reset to " Vim defaults. So we enforce our settings here when the cursor enters a " Vimwiki buffer. function! s:set_windowlocal_options() if !&diff " if Vim is currently in diff mode, don't interfere with its folding let foldmethod = vimwiki#vars#get_global('folding') if foldmethod =~? '^expr.*' setlocal foldmethod=expr let custom = vimw