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

202 active golfers, 1160 entries

Leaderboard (lowest score wins):
82
#181 - LandR / @ListenAndR

10/18/2023 at 01:32AM

83
#182 - Jerry Liu / @JoelJoshanX

06/02/2022 at 01:48AM

88
#183 - Akira Taguchi / @akiratviit

06/09/2022 at 10:50AM

93
#184 - john nduli / @JNduli

07/07/2022 at 01:54PM

96
#185 - Seung-ho Sheep / @hyshsheep

06/19/2022 at 06:33PM

96
#186 - Maurice Schmicking / @m_schmicking

11/10/2023 at 11:32PM

97
#187 - vin / @vin7654321

06/04/2022 at 08:31AM

97
#188 - michael ford / @NWToughGuy

06/22/2022 at 03:07PM

101
#189 - Himanshu Tank / @himanshutank75

10/14/2022 at 06:01PM

108
#190 - fang. / @dfangshuo

05/25/2022 at 02:57PM

114
#191 - sakura / @sakura79856991

06/01/2022 at 11:25AM

118
#192 - Jeff Cui / @jeffacce

06/21/2022 at 06:37PM

119
#193 - Justin York / @RealJustinYork

06/30/2022 at 02:45AM

124
#194 - Bad_Solution_Gen / @Bad_Sols

05/22/2022 at 08:36PM

127
#195 - Alessandro Farace / @faracea2000

05/29/2022 at 08:19PM

139
#196 - c.y.k.sagar / @x95ych

06/19/2022 at 12:04AM

140
#197 - Davi Teodoro / @DaviTeodoro8

06/14/2022 at 03:13AM

154
#198 - Robin Glauser / @robinglauser

10/12/2022 at 12:51PM

155
#199 - 哈斯 Seth Harding / @Seth_Hasi

09/14/2022 at 10:33AM

178
#200 - Lin Yu-Chien / @lyctwee

12/06/2022 at 05:31AM

197
#201 - Ryan Cleary / @ry_guy41

06/11/2022 at 12:56AM

199
#202 - damien / @GreatTestyTest

05/27/2022 at 01:24PM