I use vim for all the code I write. My biggest issue is that I cannot find a good Python code folding plugin. I've found two-three popular ones that use indentation but they tend to either fold too little or too much. Ideally, this is what I'd like for it to fold:
- Fold all top level classes.
- Fold all top level functions.
- Fold all class methods
And nothing more. The plugin I am using currently is not bad, but it tends to fold functions within methods. It also gets confused about blocks of code within a class method that have different indentation levels (e.g.: a for loop followed by more code would result in folding of the code after the for loop).
Does anyone know of a plugin that satisfies these requirements or should I just figure out how to write my own?
These are the things I've tried in the past:
- Efficient python folding : Fold python code nicely and toggle with one keystroke - does not fold class methods
- python_fold : Folding expression for python - folds random code blocks