Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5a2808ee8e67cc0006000002

sort python functions and methods alphabetically

* sort functions in the python file alphabetically * sort functions within a Class alphabetically * sort Classes alphabetically

Start file
@decorator1
def bbbb(*args):
    pass

    # do nothing here
    return


def aaa(name=xxx, arg=yux):
    pass

    # do nothing here
    return


@decorator1
@decorator2
def cccc(xpto, llxs):
    pass


class MyAAABigClass(object):
    """ MyBigClass """

    @decorator1
    @decorator2
    def cccc(xpto, llxs):
        pass

    def aaa(name=xxx, arg=yux):
        pass

        # do nothing here
        return

    @decorator1
    def bbbb(*args):
        pass

        # do nothing here
        return


class MyBBBBigClass(object):
    """ MyBigClass """

    @decorator1
    @decorator2
    def cccc(xpto, llxs):
        pass

    def aaa(name=xxx, arg=yux):
        pass

        # do nothing here
        return

    @decorator1
    def bbbb(*args):
        pass

        # do nothing here
        return
End file
def aaa(name=xxx, arg=yux):
    pass

    # do nothing here
    return


@decorator1
def bbbb(*args):
    pass

    # do nothing here
    return


@decorator1
@decorator2
def cccc(xpto, llxs):
    pass


class MyAAABigClass(object):
    """ MyBigClass """

    def aaa(name=xxx, arg=yux):
        pass

        # do nothing here
        return

    @decorator1
    def bbbb(*args):
        pass

        # do nothing here
        return

    @decorator1
    @decorator2
    def cccc(xpto, llxs):
        pass


class MyBBBBigClass(object):
    """ MyBigClass """

    def aaa(name=xxx, arg=yux):
        pass

        # do nothing here
        return

    @decorator1
    def bbbb(*args):
        pass

        # do nothing here
        return

    @decorator1
    @decorator2
    def cccc(xpto, llxs):
        pass

View Diff

2,3c2
< @decorator1
< def bbbb(*args):
---
> def aaa(name=xxx, arg=yux):
10c9,10
< def aaa(name=xxx, arg=yux):
---
> @decorator1
> def bbbb(*args):
26,30d25
<     @decorator1
<     @decorator2
<     def cccc(xpto, llxs):
<         pass
< 
44,47d38
< 
< class MyBBBBigClass(object):
<     """ MyBigClass """
< 
52a44,47
> 
> class MyBBBBigClass(object):
>     """ MyBigClass """
> 
64a60,64
> 
>     @decorator1
>     @decorator2
>     def cccc(xpto, llxs):
>         pass

Solutions by @mevmev8:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @_azulinho

15 active golfers, 28 entries

Solutions by @mevmev8:
23
#9 - mevmev / @mevmev8

09/11/2021 at 04:14PM