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 13 remaining solutions by signing in and submitting your own entry
#14 foobarbazqux12345 / @foobarbazqux121 - Score: 26 - 01/04/21 @ 02:26
8dd7Gp26G5dd38Gp47G5ddGpZZ

0 comments


#15 Mrmclarrinson / @mrmclarrinson - Score: 26 - 12/13/22 @ 15:08
8dd7Gp26G5dd38Gp47G5ddGpZZ

0 comments


Created by: @_azulinho

15 active golfers, 28 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

20
#4 - Turkey Man / @lvturkeyman

01/10/2018 at 09:59AM

20
#5 - 👻 npm install hello-world 🎃 / @ralokt

01/23/2018 at 09:52AM

20
#6 - pikjes / @pikjes2

07/15/2021 at 07:02PM

20
#7 - Peppa Pig / @PeppaPigSg

07/01/2024 at 01:31AM

20
#8 - nickGPT / @nickandbro

08/27/2024 at 05:19AM

23
#9 - mevmev / @mevmev8

09/11/2021 at 04:14PM

23
#10 - Luoyb / @Luoyb

11/15/2023 at 01:30AM

24
#11 - BareTull / @BareTull3

12/07/2017 at 12:41AM

25
#12 - Per Forser / @perforcer

12/06/2017 at 10:14PM

25
#13 - Eric Söderström / @eksoderstrom

12/21/2017 at 05:01AM

26
#14 - foobarbazqux12345 / @foobarbazqux121

01/04/2021 at 02:26AM

26
#15 - Mrmclarrinson / @mrmclarrinson

12/13/2022 at 03:08PM