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 4d1aa1d9b8cb34093200039f

PEP8 Python Wrapping Comments and Code

According to PEP8, long flowy text and code should have different max line lengths. Code: 79 characters max Long flowy text: 72 characters max

Start file
class Rectangle(Blob):
    """
    According to PEP8: [P]lease limit all lines to a maximum of 79 characters. For flowing long blocks of text, limiting the length to 72 characters is recommended. 

    This comment should have a max line width of 72. Note: (68 + 4 spaces for indent = 72)
    """

    # Below code should have a max line width of 79
    def __init__(self, width, height, color='black', emphasis=None, highlight=0):
        Blob.__init__(self, width, height, color, emphasis, highlight)
End file
class Rectangle(Blob):
    """
    According to PEP8: [P]lease limit all lines to a maximum of 79
    characters. For flowing long blocks of text, limiting the length to
    72 characters is recommended. 

    This comment should have a max line width of 72. Note: (68 + 4
    spaces for indent = 72)
    """

    # Below code should have a max line width of 79
    def __init__(self, width, height, color='black', emphasis=None,
                 highlight=0):
        Blob.__init__(self, width, height, color, emphasis, highlight)

View Diff

3c3,5
<     According to PEP8: [P]lease limit all lines to a maximum of 79 characters. For flowing long blocks of text, limiting the length to 72 characters is recommended. 
---
>     According to PEP8: [P]lease limit all lines to a maximum of 79
>     characters. For flowing long blocks of text, limiting the length to
>     72 characters is recommended. 
5c7,8
<     This comment should have a max line width of 72. Note: (68 + 4 spaces for indent = 72)
---
>     This comment should have a max line width of 72. Note: (68 + 4
>     spaces for indent = 72)
9c12,13
<     def __init__(self, width, height, color='black', emphasis=None, highlight=0):
---
>     def __init__(self, width, height, color='black', emphasis=None,
>                  highlight=0):

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 56 remaining solutions by signing in and submitting your own entry
#57 drio / @drio - Score: 54 - 01/01/11 @ 01:26
:set et<CR><Esc>:set tw_<BS>=72<CR>3Ggqq7Ggqq12G$4bi<CR><Esc>hxxhx<Esc>k$x<Esc>:x<CR>

0 comments


Created by: @lionelyoung

57 active golfers, 155 entries

Leaderboard (lowest score wins):
28
#31 - Trevor Powell / @DoomedBunnies

11/29/2011 at 02:38AM

28
#32 - James / @Dronak

09/07/2013 at 03:30AM

29
#33 - Matthew Draper / @_matthewd

12/31/2010 at 05:24PM

29
#34 - Tyler / @tylerbindon

03/31/2013 at 05:00PM

30
#35 - David Lam / @lamdk

01/02/2011 at 07:25AM

30
#36 - William Dunand / @wdunand

12/05/2011 at 08:14AM

31
#37 - Mariano Guerra / @marianoguerra

12/29/2010 at 04:34PM

32
#38 - kana / @kana1

12/29/2010 at 12:34PM

32
#39 - mightyfoo / @mightyfoo

05/25/2011 at 04:08PM

32
#40 - Nicolas Friedli / @NicolasFriedli

10/29/2012 at 06:01PM

32
#41 - Alex Hammel / @AlexJHammel

12/23/2012 at 07:48PM

33
#42 - vansan / @VinceVansan

08/25/2012 at 09:00PM

34
#43 - a24f0600 / @a24f0600

12/20/2012 at 03:36PM

35
#44 - SirVer / @SirVerII

01/22/2011 at 03:11PM

36
#45 - dagbrown / @dagbrown

12/29/2010 at 03:00AM

37
#46 - lionel young / @lionelyoung

12/29/2010 at 06:00AM

37
#47 - Sebastian Heil / @sebokopter

11/19/2013 at 03:31PM

37
#48 - squdle / @squdle

06/17/2017 at 12:09PM

39
#49 - Simon Edwardsson / @_SimEdw_

12/29/2010 at 03:54PM

41
#50 - Jack Kordas / @JackKordas

12/29/2010 at 05:07PM

44
#51 - foo bar / @whoever_foo

12/29/2010 at 10:51AM

45
#52 - okay zed / @okayzed

12/29/2010 at 04:00AM

46
#53 - Dave / @zzdave13

08/05/2011 at 09:52PM

49
#54 - Corbin Simpson / @corbinsimpson

12/29/2010 at 07:22AM

50
#55 - Andrey A. Ugolnik / @andreyugolnik

01/20/2011 at 02:14AM

51
#56 - かしゅーなっつ@修行中 / @kashew_nuts

08/02/2014 at 02:00PM

54
#57 - drio / @drio

01/01/2011 at 01:26AM