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 44 remaining solutions by signing in and submitting your own entry
#45 lionel young / lionelyoung - Score: 37 - 12/29/10 @ 06:00
:set tw=72<CR>2jgqjjgql4jgql>>..i <Esc>ZZ

0 comments

#46 Sebastian Heil / sebokopter - Score: 37 - 11/19/13 @ 15:31
:set tw=72<CR>2jV2jgqkJVgq4jVgqd017i <Esc>ZZ

0 comments

#47 squdle / squdle - Score: 37 - 06/17/17 @ 12:09
2j:set tw=72<CR>V3)gqV2<24Wi<BS><CR><Esc>d016i <Esc>ZZ

0 comments

#48 Simon Edwardsson / _SimEdw_ - Score: 39 - 12/29/10 @ 15:54
jjf9a<CR><Esc>f7i<BS><CR><Esc>jjf4a<CR><Esc>jjjjfNf,a<CR><Tab> <Esc>:wq<CR>

0 comments

#49 Jack Kordas / JackKordas - Score: 41 - 12/29/10 @ 17:07
/9<CR>a<CR>f<Esc>xf7bea<CR><Esc>/4<CR>a<CR><Esc>/)<CR>/)<CR>F,a<CR><Tab> <Esc>:wq<CR>

0 comments

#50 foo bar / whoever_foo - Score: 44 - 12/29/10 @ 10:51
:se tw=72<CR>2jgq2jgqk4j:se tw=789<C-?><C-?>9<CR>gqqi<Tab> <Esc>ZZ

0 comments

#51 okay zed / okayzed - Score: 45 - 12/29/10 @ 04:00
2j:set tw=72<CR>V2jgqV2<5jk$Bi<BS><CR><Esc>V4>i <Esc>:wq<CR>

0 comments

#52 Dave / zzdave13 - Score: 46 - 08/05/11 @ 21:52
:se ts=4 et|ret<NL>jjf9a<NL><Esc>t7i<NL><Esc>jjf4a<NL><Esc>4j6Ea<NL><Esc>3XZZ

0 comments

#53 Corbin Simpson / corbinsimpson - Score: 49 - 12/29/10 @ 07:22
:set textwidth=72<CR>jjgqqjjgqqjjjjgqq>>>>>>i <Esc>ZZ

0 comments

#54 Andrey A. Ugolnik / andreyugolnik - Score: 50 - 01/20/11 @ 02:14
/9<CR>a<CR><Esc>f7Xi<CR><Esc>/4<CR>a<CR><Esc>5/,<CR>a<CR><Esc>V<..i                 <Esc>ZZ

0 comments

#55 かしゅーなっつ@修行中 / kashew_nuts - Score: 51 - 08/02/14 @ 14:00
:set tw=72<CR>2j3gq$i    <Esc>5jkgq$i                 <Esc><Esc>ZZ

0 comments

#56 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

56 active golfers, 148 entries

Leaderboard (lowest score wins):
23
#1 - Urtica dioica / udioica

12/31/2012 at 04:57AM

23
#2 - Victor Ramirez / virako

01/25/2013 at 04:44PM

23
#3 - John Braxler / braxler

08/21/2014 at 09:14PM

24
#4 - Petro Тrouq / zulolosi

08/18/2013 at 04:57AM

25
#5 - Kerson Hsiao / KersonHsiao

08/08/2012 at 08:13AM

25
#6 - Charles Gordon / liberalbias

08/26/2012 at 12:07AM

25
#7 - Hubba / HubbaBubbaFett

12/13/2012 at 08:22PM

26
#8 - Balkoth / _Balkoth_

01/05/2011 at 06:19PM

26
#9 - derp derp / derp__

01/06/2011 at 08:16AM

26
#10 - Wei Dai / clvv42

01/06/2011 at 10:21AM

26
#11 - Ravil Bayramgalin / brainopia

01/08/2011 at 10:32PM

26
#12 - h_east (トロッコ6個) / h_east

01/15/2011 at 05:52PM

26
#13 - xhtmlforum / xhtmlforum

01/25/2011 at 08:42PM

26
#14 - Stephen Morrow / yawmark

01/30/2011 at 03:46PM

26
#15 - vg / vimgolfer

02/26/2011 at 12:35PM

26
#16 - Justin Love / wondible

06/12/2011 at 08:05PM

26
#17 - Hu Junfeng / junfeng

07/17/2011 at 09:54AM

26
#18 - Jason Then / racc69

08/09/2011 at 04:19AM

26
#19 - Andrey Ivanov / Bytamine

08/10/2011 at 09:06AM

26
#20 - Dario Cazzaro / darioqa

09/18/2011 at 10:17PM

26
#21 - You-Siang Lin / yslinnctu

11/29/2011 at 02:30PM

26
#22 - Renat Aksitov / Korvin79

02/15/2012 at 04:28PM

26
#23 - 無ん垢の叫び / john_ababa

02/23/2012 at 07:37AM

26
#24 - Rod Knowlton / codelahoma

05/27/2012 at 02:46AM

26
#25 - Joonas Pihlajamaa / jokkebk

03/14/2014 at 05:48PM

27
#26 - Tim Chase / gumnos

01/08/2011 at 12:22AM

27
#27 - Oleg Roshupkin / jjjahson

01/21/2011 at 04:48AM

27
#28 - z0k / z0k

12/20/2012 at 10:25AM

28
#29 - Pete Johns / johnsyweb

01/08/2011 at 03:46AM

28
#30 - Trevor Powell / DoomedBunnies

11/29/2011 at 02:38AM

28
#31 - James / Dronak

09/07/2013 at 03:30AM

29
#32 - Matthew Draper / _matthewd

12/31/2010 at 05:24PM

29
#33 - Tyler / tylerbindon

03/31/2013 at 05:00PM

30
#34 - David Lam / lamdk

01/02/2011 at 07:25AM

30
#35 - William Dunand / wdunand

12/05/2011 at 08:14AM

31
#36 - Mariano Guerra / marianoguerra

12/29/2010 at 04:34PM

32
#37 - kana / kana1

12/29/2010 at 12:34PM

32
#38 - mightyfoo / mightyfoo

05/25/2011 at 04:08PM

32
#39 - Nicolas Friedli / NicolasFriedli

10/29/2012 at 06:01PM

32
#40 - Alex Hammel / AlexJHammel

12/23/2012 at 07:48PM

33
#41 - vansan / VinceVansan

08/25/2012 at 09:00PM

34
#42 - a24f0600 / a24f0600

12/20/2012 at 03:36PM

35
#43 - SirVer / SirVerII

01/22/2011 at 03:11PM

36
#44 - dagbrown / dagbrown

12/29/2010 at 03:00AM

37
#45 - lionel young / lionelyoung

12/29/2010 at 06:00AM

37
#46 - Sebastian Heil / sebokopter

11/19/2013 at 03:31PM

37
#47 - squdle / squdle

06/17/2017 at 12:09PM

39
#48 - Simon Edwardsson / _SimEdw_

12/29/2010 at 03:54PM

41
#49 - Jack Kordas / JackKordas

12/29/2010 at 05:07PM

44
#50 - foo bar / whoever_foo

12/29/2010 at 10:51AM

45
#51 - okay zed / okayzed

12/29/2010 at 04:00AM

46
#52 - Dave / zzdave13

08/05/2011 at 09:52PM

49
#53 - Corbin Simpson / corbinsimpson

12/29/2010 at 07:22AM

50
#54 - Andrey A. Ugolnik / andreyugolnik

01/20/2011 at 02:14AM

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

08/02/2014 at 02:00PM

54
#56 - drio / drio

01/01/2011 at 01:26AM