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):
24
#91 - Felix Heilmeyer / @heilerich

03/30/2024 at 06:13PM

25
#92 - Dan / @dstein64

05/23/2022 at 02:50AM

25
#93 - Regan Tackett / @arrowtackett

05/24/2022 at 02:36AM

25
#94 - sapir malka / @sapir5522

05/24/2022 at 08:49AM

25
#95 - seenz / @lefton_sean

05/27/2022 at 02:22AM

25
#96 - Martin Bielik / @mabielik

05/30/2022 at 11:36AM

25
#97 - Keaton Brandt / @KeatonTech

06/05/2022 at 12:43AM

25
#98 - Mario / @MarioWolfe

06/15/2022 at 05:28AM

25
#99 - Will Long / @WillLon30283972

06/17/2022 at 03:22AM

25
#100 - -kento / @k_masu

08/30/2022 at 06:52AM

25
#101 - Nathan Iszlaub / @NIszlaub

10/21/2022 at 05:24PM

26
#102 - Bruce Woodward / @b00ffer

03/16/2023 at 04:26AM

27
#103 - Aioriya / @AioriyaDonk

08/10/2022 at 06:00PM

27
#104 - Vi Onpa / @OnpaVi

12/15/2022 at 03:05PM

27
#105 - usermod / @g_usermod

02/05/2023 at 11:57PM

28
#106 - Dan Lobser / @sporkl1ft

06/14/2022 at 04:03AM

28
#107 - g-guy / @guydunigo

11/27/2023 at 03:59PM

29
#108 - A White Dwarf / @AWhiteDwarf1

05/31/2022 at 06:32PM

29
#109 - salchint / @salchint

06/19/2022 at 10:05PM

29
#110 - samsepiol / @samsepi81094451

07/08/2022 at 12:51PM

29
#111 - Oli / @o_lalonde

07/10/2022 at 10:12PM

29
#112 - Mika Dede / @xerv0n

09/02/2022 at 04:36AM

29
#113 - Daniel Nägele / @debugloop

09/29/2022 at 06:32AM

29
#114 - bastien batardier / @supercamarche

11/07/2022 at 08:42PM

30
#115 - quemeraisc / @quemeraisc

05/23/2022 at 01:44PM

30
#116 - Enrique Santana / @esantanaya

05/25/2022 at 05:54AM

30
#117 - Leon Si / @leonzalion

06/04/2022 at 07:44PM

30
#118 - Branimir Mirčetić / @BranimirMireti1

07/05/2022 at 11:23AM

30
#119 - freebejan / @freebejan

08/09/2022 at 10:21PM

30
#120 - Steve Shi / @steveshi7

02/10/2024 at 07:31AM