For folding java code (also nice for c, cpp, python etc.), I just installed the vim-anyfold plugin. In my ~/.vimrc, I've added

autocmd Filetype java,c,cpp AnyFoldActivate

to automatically activate the plugin for the provided filetypes. When I now use zM in order to close all folds, it folds everything it finds, so no maximum nestlevel. My .vimrc also has set foldnestmax=1 that I use for foldings in bash, but it has no effect on vim-anyfold.

How can I limit the foldings to a certain level of indentation for vim-anyfold?

Thanks in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.