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

67 active golfers, 210 entries

Leaderboard (lowest score wins):
21
#1 - Peppa Pig / @PeppaPigSg

06/01/2024 at 04:20PM

21
#2 - John Braxler / @braxler

06/07/2024 at 02:43PM

23
#3 - Urtica dioica / @udioica

12/31/2012 at 04:57AM

23
#4 - Victor Ramirez / @virako

01/25/2013 at 04:44PM

23
#5 - Zion Park / @zionpark93

01/07/2023 at 04:04AM

23
#6 - Simo Kivistö / @kivissimo

02/19/2024 at 08:49PM

23
#7 - Tsimon Dorakh / @Tsimon-Dorakh

10/10/2024 at 07:19PM

23
#8 - bounce114 / @bounce114

12/02/2024 at 08:37AM

24
#9 - Petro Тrouq / @zulolosi

08/18/2013 at 04:57AM

24
#10 - Александр Моисеев / @Aleksan43607471

01/21/2023 at 06:20PM

25
#11 - Kerson Hsiao / @KersonHsiao

08/08/2012 at 08:13AM

25
#12 - Charles Gordon / @liberalbias

08/26/2012 at 12:07AM

25
#13 - Hubba / @HubbaBubbaFett

12/13/2012 at 08:22PM

25
#14 - severij / @severij_

03/02/2019 at 11:17AM

26
#15 - Balkoth / @_Balkoth_

01/05/2011 at 06:19PM

26
#16 - derp derp / @derp__

01/06/2011 at 08:16AM

26
#17 - Wei Dai / @clvv42

01/06/2011 at 10:21AM

26
#18 - Ravil Bayramgalin / @brainopia

01/08/2011 at 10:32PM

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

01/15/2011 at 05:52PM

26
#20 - xhtmlforum / @xhtmlforum

01/25/2011 at 08:42PM

26
#21 - Steve Morrow / @yawmark

01/30/2011 at 03:46PM

26
#22 - vg / @vimgolfer

02/26/2011 at 12:35PM

26
#23 - Justin Love / @wondible

06/12/2011 at 08:05PM

26
#24 - Junfeng / @junfeng

07/17/2011 at 09:54AM

26
#25 - Jason Then / @racc69

08/09/2011 at 04:19AM

26
#26 - Andrey Ivanov / @Bytamine

08/10/2011 at 09:06AM

26
#27 - Dario Cazzaro / @darioqa

09/18/2011 at 10:17PM

26
#28 - You-Siang Lin / @yslinnctu

11/29/2011 at 02:30PM

26
#29 - Renat Aksitov / @Korvin79

02/15/2012 at 04:28PM

26
#30 - じょんあば / @john_ababa

02/23/2012 at 07:37AM