Closed francescoboc closed 4 years ago
To reinitialize the plugin after changing the foldmethod manually, I would try :unlet b:loaded_SimpylFold
and then :edit
the file again, which should force the ftplugin
initialization script to rerun.
I'm not familiar with the syntax file you linked, so I can't comment on specific differences, but in general, SimpylFold doesn't rely on solely on syntax definitions (i.e. regular expressions), but attempts to parse the Python file's indentation in a manner that approximates how the Python interpreter does it, with some amount of context sensitivity. In some situations, this should result in a more accurate representation of where the folds should be placed.
This plugin also allows optional previewing of docstrings in the text of the fold line, which is unlikely to be feasible with a purely syntax based method. Refer to the README for this and other options.
For a definitive answer, you can always just try the syntax method and see for yourself how it differs.
Ok, thank you very much for your answer.
Ok, so maybe I'm dumb but I don't understand how to use this plugin. In the main page it says that "No configuration is necessary" and "Use Vim's built-in folding commands to expand and collapse folds". Ok... but, what do you mean? I see no folds, the code is all unfolded like before installing the plugin, and pressing "zc" on a function results in "E490: No fold found". Should I change the foldmethod? What should I do?
EDIT: Ok, it doesn't work because I changed the foldmethod on this particular file. If I open another "virgin" file where I haven't changed the foldmethod, then the plugin works. So now the question is: how do I reactivate the plugin in a file where I manually changed the foldmethod? (putting it back to "expr" doesn't work). Also a more naive question: how is this plugin different from using foldmethod=syntax and this syntax file? Thanks