On Fri, 09 Jan 2009 23:15:31 +0800, Benjamin Fritz <[email protected]> wrote:
> Is there a way to determine the foldlevel of the first closed fold on a > line? For example, with the following situation: > > -- abc > || def > || ghi > || jkl > | mno > pqr > stu > vwx > yz > > If I close all folds, I want to be able to get '1' for the fold level of > the > first line. If I open that first fold, I want to be able to get '2'. For the first case, you can use foldclosed() to get it, for the second, foldlevel instead. > > :help foldlevel() says that it will always return the deepest fold (i.e. > 2) > regardless of whether folds are open or closed. > > The best I can think of is to save off the value of the foldtext option, > set > the foldtext option to the default, use foldtextresult() to get the > classic > fold text, count the number of dashes in the fold text, and then restore > the > foldtext option. There has to be a better way, doesn't there? > > > -- Regards, Van. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
