Well, you can configure code folding, for example. indent, and close these functions / fold, then do it with d d , then p , but this is not an ideal solution with a large file.
This is not an easy task. You can configure some line connections, for example:
put some specific comment / id in front of every first def level, e.g.
# DEFINITION
def zzz
...
end
# END DEF
then attach these lines to one with some multi-line magic of regular expressions (and / or column editing) using some kind of placeholder that is not usually found in your code.
then sort it by standard unix sort (e.g., select the concatenated lines visually, then
:'<,'>!sort
then split into an inserted template ...
Even less ideal, but it can be done ...
See this answer too .
source share