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 64 remaining solutions by signing in and submitting your own entry
#65 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

65 active golfers, 190 entries

Leaderboard (lowest score wins):
27
#31 - Tim Chase / @gumnos

01/08/2011 at 12:22AM

27
#32 - Oleg Roshupkin / @jjjahson

01/21/2011 at 04:48AM

27
#33 - z0k / @z0k

12/20/2012 at 10:25AM

28
#34 - Pete Johns / @johnsyweb

01/08/2011 at 03:46AM

28
#35 - Trevor Powell / @DoomedBunnies

11/29/2011 at 02:38AM

28
#36 - James / @Dronak

09/07/2013 at 03:30AM

29
#37 - Matthew Draper / @_matthewd

12/31/2010 at 05:24PM

29
#38 - Tyler / @tylerbindon

03/31/2013 at 05:00PM

30
#39 - David Lam / @lamdk

01/02/2011 at 07:25AM

30
#40 - William Dunand / @wdunand

12/05/2011 at 08:14AM

31
#41 - Mariano Guerra / @marianoguerra

12/29/2010 at 04:34PM

31
#42 - shahanavaz m / @shahanavazm

01/26/2024 at 05:35PM

32
#43 - kana / @kana1

12/29/2010 at 12:34PM

32
#44 - mightyfoo / @mightyfoo

05/25/2011 at 04:08PM

32
#45 - Nicolas Friedli / @NicolasFriedli

10/29/2012 at 06:01PM

32
#46 - ajh / @AlexJHammel

12/23/2012 at 07:48PM

33
#47 - vansan / @VinceVansan

08/25/2012 at 09:00PM

34
#48 - a24f0600 / @a24f0600

12/20/2012 at 03:36PM

35
#49 - SirVer / @SirVerII

01/22/2011 at 03:11PM

35
#50 - RockerZZY / @rocker_zzy

09/12/2020 at 02:53AM

35
#51 - quemeraisc / @quemeraisc

05/24/2022 at 01:51PM

36
#52 - dagbrown / @dagbrown

12/29/2010 at 03:00AM

37
#53 - lionel young / @lionelyoung

12/29/2010 at 06:00AM

37
#54 - Sebastian Heil / @sebokopter

11/19/2013 at 03:31PM

37
#55 - squdle / @squdle

06/17/2017 at 12:09PM

39
#56 - Simon Edwardsson / @_SimEdw_

12/29/2010 at 03:54PM

41
#57 - Jack Kordas / @JackKordas

12/29/2010 at 05:07PM

41
#58 - Arya Kumar / @SusSquirrel

06/17/2021 at 06:25PM

44
#59 - foo bar / @whoever_foo

12/29/2010 at 10:51AM

45
#60 - okay zed / @okayzed

12/29/2010 at 04:00AM