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

141 active golfers, 744 entries

Leaderboard (lowest score wins):
21
#31 - Jon Krause / @jkrause314

05/25/2022 at 03:23AM

21
#32 - Anders Janmyr / @andersjanmyr

05/27/2022 at 09:49AM

21
#33 - Kwizer / @kwizer

05/28/2022 at 11:36AM

21
#34 - Duncan / @Duncan31503119

05/30/2022 at 10:13AM

21
#35 - Arthur Hess / @arthurhess

06/01/2022 at 11:53AM

21
#36 - ShookerAndBeta / @Shooker2012

06/03/2022 at 06:20PM

21
#37 - YE / @DeracanthaOnos

06/16/2022 at 03:37AM

21
#38 - Fabio Murru / @MurruFabio

06/17/2022 at 10:48PM

21
#39 - satetheus-vimgolf / @SVimgolf

07/08/2022 at 08:45PM

21
#40 - Lory / @Lory46845742

07/22/2022 at 06:05PM

21
#41 - Julien Durillon / @juuduu

09/29/2022 at 06:18PM

22
#42 - Smylers / @Smylers2

05/23/2022 at 09:25PM

22
#43 - redbigyesnoGoThenWhy / @redbigyesno

05/28/2022 at 06:40AM

22
#44 - Jan Havránek / @h4vry

05/31/2022 at 11:48PM

22
#45 - Ivo Blöchliger / @aigledesalpes

06/05/2022 at 07:32PM

22
#46 - kjghf3f9xf2 / @kjghf3f9xf2

06/13/2022 at 06:21PM

22
#47 - Brian Leung / @brian_leung

06/19/2022 at 04:39AM

22
#48 - Leroy Jenkins / @LeroyJe70429357

09/14/2022 at 01:12AM

22
#49 - steve / @steve35773420

11/12/2022 at 05:02PM

23
#50 - Ron / @ronnie9ball

05/23/2022 at 12:07AM

23
#51 - Lucas Suzuki Segawa / @lsegawa113

06/02/2022 at 02:29PM

23
#52 - T. Arch / @TArch76864215

06/09/2022 at 06:35PM

23
#53 - rg thomas / @rgt47

06/20/2022 at 08:24PM

24
#54 - キムラ・OPEL・ユウジ / @kimurayuuji79

09/29/2022 at 12:56AM

25
#55 - Dan / @dstein64

05/23/2022 at 02:50AM

25
#56 - Regan Tackett / @arrowtackett

05/24/2022 at 02:36AM

25
#57 - sapir malka / @sapir5522

05/24/2022 at 08:49AM

25
#58 - seenz / @lefton_sean

05/27/2022 at 02:22AM

25
#59 - Martin Bielik / @mabielik

05/30/2022 at 11:36AM

25
#60 - Keaton Brandt / @KeatonTech

06/05/2022 at 12:43AM