Reputation: 8119
I have a lot of functions in my menu.vim file.
Would it be possible to select them (by me) and sort them by function name?
p.e.
find lines from fun! or function!
to line endfun
find name of function and sort the whole block based on the name of function (from a-z)
Sometimes I have one line of comment above the function name.
Can it be taken with it?
Upvotes: 7
Views: 2018
Reputation: 79215
This could be a bit tricky but here is a tentative way to do it:
g/fun\%[ction]!\= /,/endf\%[unction]/ s/$\n/@@@
'<,'>sort /fun\%[ction]!\=/
%s/@@@/\r/g
Upvotes: 10