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

222 active golfers, 1316 entries

Leaderboard (lowest score wins):
118
#211 - Jeff Cui / @jeffacce

06/21/2022 at 06:37PM

119
#212 - Justin York / @RealJustinYork

06/30/2022 at 02:45AM

124
#213 - Bad_Solution_Gen / @Bad_Sols

05/22/2022 at 08:36PM

127
#214 - Alessandro Farace / @faracea2000

05/29/2022 at 08:19PM

132
#215 - Jason Rojas / @jasonrojas

08/26/2024 at 06:36PM

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

06/19/2022 at 12:04AM

140
#217 - Davi Teodoro / @DaviTeodoro8

06/14/2022 at 03:13AM

154
#218 - Robin Glauser / @robinglauser

10/12/2022 at 12:51PM

155
#219 - 哈斯 Seth Harding / @Seth_Hasi

09/14/2022 at 10:33AM

178
#220 - Lin Yu-Chien / @lyctwee

12/06/2022 at 05:31AM

197
#221 - Ryan Cleary / @ry_guy41

06/11/2022 at 12:56AM

199
#222 - damien / @GreatTestyTest

05/27/2022 at 01:24PM