Search code examples
vimfolding

Is it possible to specify a minimum fold level?


In my javascript code I am wrapping everything into one anonymous function. When I use folding in vim everything is folded, which is quite useless. I want to fold for example only the second level, while keeping the first level expanded (preferably still with syntax folding). How can I achieve this in vim?

(function(gobj) {
    function fun1() {
        ...
    }
    function fun2() {
        ...
    }
})();

Solution

  • I had similar problems before, when using vim and javascript.

    This plugin solved most of my problems (auto-indentation, syntax folding, syntax highlighting, ...)

    vim-javascript https://vimawesome.com/plugin/vim-javascript