tags:

views:

83

answers:

1

I have a .py file with lots of classes:

class First(Second):
    #code

class Third(Fourth):
    #code

Is it possible to sort the definitions by class name in vim?

+2  A: 

Suggestion for manual sorting.

With a reasonable amount of classes, manual sorting is not so tedious. I also propose it since I think it makes much more sense to group superclasses together and make sure superclasses are defined before subclasses -- otherwise your module won't even be importable.

Enable folding in Vim:

set foldmethod=indent

you can open a fold with zo, close with zc. Close all in the document with zM, open all in the document with zR.

Close all folds in the document. Now each class spans only two lines, and it's easy to delete and reinsert in its proper place.

kaizer.se