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

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 4 remaining solutions by signing in and submitting your own entry
#5 Per Forser / perforcer - Score: 25 - 12/06/17 @ 22:14
8dd6jp26G5dd38Gp*k5ddGpZZ

0 comments

Created by: _azulinho

5 active golfers, 8 entries

Leaderboard (lowest score wins):
20
#1 - John Braxler / braxler

12/06/2017 at 05:25PM

20
#2 - Jon Krause / jkrause314

12/08/2017 at 04:15AM

20
#3 - Henrique Malheiro / rike09

12/09/2017 at 01:06AM

24
#4 - BareTull / BareTull3

12/07/2017 at 12:41AM

25
#5 - Per Forser / perforcer

12/06/2017 at 10:14PM