Question

Is it possible to specify which functions should be folded by vim automatically.

In Netbeans, there is something like

// <editor-fold defaultstate="collapsed" desc="user-description">
  ...any code...
// </editor-fold>

Do you know about something similar I can use in vim? When I close the vim I want folded functions to be folded again if I open the file again.

Was it helpful?

Solution

This is actually a little different than what you're asking, because it doesn't deal with semantic folding, which NetBeans and other IDEs do. However, storing a set of folds is normally done using the :mkview command, and you can automate this command and the :loadview command to make it transparent to you. The details are in this Vim wiki page. I use one of the simpler versions in my vimrc, rather than the plugin, but both should work for what you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top