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 9v00628a9b2f000000000220

Poorly indented Python comments

Fix the alignment of some Python comments as quickly as possible.

Start file
      # Working with enumerations in Python #

from enum import Enum

class Shake(Enum):
    VANILLA = 7
    CHOCOLATE = 4
    COOKIES = 9
    MINT = 3

print(type(Shake.MINT))   #   <enum 'Shake'> 

print(Shake.CHOCOLATE.name)               #    CHOCOLATE
print(Shake.CHOCOLATE.value)                   #     4

print(repr(Shake['COOKIES']))              #  <Shake.COOKIES: 9>

Animal = Enum('Animal', 'ANT BEE CAT DOG')

A = list(Animal); print(A)
# [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]
End file
      # Working with enumerations in Python #

from enum import Enum

class Shake(Enum):
    VANILLA = 7
    CHOCOLATE = 4
    COOKIES = 9
    MINT = 3

print(type(Shake.MINT))         # <enum 'Shake'> 

print(Shake.CHOCOLATE.name)     # CHOCOLATE
print(Shake.CHOCOLATE.value)    # 4

print(repr(Shake['COOKIES']))   # <Shake.COOKIES: 9>

Animal = Enum('Animal', 'ANT BEE CAT DOG')

A = list(Animal); print(A)
# [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]

View Diff

11c11
< print(type(Shake.MINT))   #   <enum 'Shake'> 
---
> print(type(Shake.MINT))         # <enum 'Shake'> 
13,14c13,14
< print(Shake.CHOCOLATE.name)               #    CHOCOLATE
< print(Shake.CHOCOLATE.value)                   #     4
---
> print(Shake.CHOCOLATE.name)     # CHOCOLATE
> print(Shake.CHOCOLATE.value)    # 4
16c16
< print(repr(Shake['COOKIES']))              #  <Shake.COOKIES: 9>
---
> print(repr(Shake['COOKIES']))   # <Shake.COOKIES: 9>

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 142 remaining solutions by signing in and submitting your own entry
#143 damien / @GreatTestyTest - Score: 199 - 05/27/22 @ 13:24
:11<CR>f$$bbbbbblxxjjkkjjflllll<Esc>hhhh<Esc>vllllllllllllllxjkkjlxxxkjkkhh<Esc>i  <BS><Esc>jjkkl<Esc>ilh<BS><BS><Esc>li        <Esc>jjhhhhhhhi        <Esc>jjkxxxxxxxxxxxxjjxxxxxxxxllxkkxxxxkkkjjjjj:<Esc>kkkkkhhh<Esc>jk<C-V>jjjjjjkxhh<C-Z><C-Z><C-Z><C-Z><C-Z><C-Z><C-Z><Esc><Esc>..<Esc><Esc>jk:w<CR>:q<CR>

0 comments


Created by: @JeanGeo20504212

143 active golfers, 748 entries

Leaderboard (lowest score wins):
15
#1 - Jean George / @JeanGeo20504212

05/24/2022 at 01:15PM

15
#2 - Robberechts Arne / @ArneRobberechts

05/24/2022 at 04:11PM

15
#3 - Pablo Cárdenas / @pablo_cardenasb

05/25/2022 at 06:24AM

15
#4 - John Braxler / @braxler

05/27/2022 at 12:11PM

15
#5 - Ekalos / @_Ekalos

05/27/2022 at 01:50PM

15
#6 - Calum Smith / @cpmsmith

05/27/2022 at 10:22PM

15
#7 - mevmev / @mevmev8

05/29/2022 at 06:58PM

15
#8 - jcbglbmn / @JacobGelbman

06/01/2022 at 05:43AM

15
#9 - MortalityCure / @MortalityCure

06/07/2022 at 04:11PM

15
#10 - Brett Bender / @brttbndr

06/11/2022 at 05:28PM

15
#11 - math is what I hate / @mpnmbn

06/12/2022 at 01:22PM

15
#12 - Хью Джолли / @DzolliH

06/13/2022 at 07:33AM

15
#13 - Frankevislav / @frankevislav

06/14/2022 at 01:49AM

15
#14 - Irakli Chigvaria / @tchigvaria

06/15/2022 at 04:02PM

15
#15 - Jacob Puthipiroj / @puthipiroj

06/22/2022 at 04:28PM

15
#16 - hamb / @hamb88140219

06/25/2022 at 09:15PM

15
#17 - ATTIA Guillaume / @guillaume_attia

06/25/2022 at 09:15PM

15
#18 - fraktal / @FraktalRebirth

06/25/2022 at 09:17PM

15
#19 - Dmitry Antonyuk / @dantonuke

07/07/2022 at 05:36AM

15
#20 - Andrew Morris / @andrew_morris

07/14/2022 at 10:05AM

15
#21 - Mens Jender / @m3nder__

08/05/2022 at 11:32AM

15
#22 - Name can't be blank. / @orangutanganga

08/18/2022 at 01:27PM

15
#23 - John Xu / @xzzhiao

08/30/2022 at 05:51AM

15
#24 - sap / @sap38838304

09/16/2022 at 06:18PM

15
#25 - Janzen / @__Coos

10/07/2022 at 05:05AM

15
#26 - Bangash💉💉 / @DevotionGeo

10/10/2022 at 07:13PM

15
#27 - Topvimgolf Score / @topvimgolfscore

10/12/2022 at 09:52AM

15
#28 - kulabun / @kulabun

10/15/2022 at 04:28AM

15
#29 - ky05uk3 / @kyo89347563

11/22/2022 at 01:22AM

17
#30 - Luke Korn / @LukeKorn

10/06/2022 at 12:43PM