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

203 active golfers, 1172 entries

Leaderboard (lowest score wins):
47
#151 - 深窓の令嬢@ドクター / @arbino1031

09/09/2022 at 02:15AM

47
#152 - tangjm / @tangjm12

09/05/2023 at 08:09AM

50
#153 - 우정민 / @jeongmin2021

10/01/2022 at 09:28AM

51
#154 - D G G / @DGJourneyman

02/20/2023 at 09:16AM

52
#155 - CL / @CL58620058

06/02/2022 at 08:34AM

53
#156 - Zachary Peterson / @zpeterson16

07/24/2022 at 04:11AM

53
#157 - Dr. Peťko / @PetkoDr

09/12/2022 at 08:03AM

54
#158 - Matthew Edge / @edge_hew

02/21/2023 at 06:12AM

54
#159 - Jeff Davis / @_JefeDavis_

03/15/2023 at 06:03PM

56
#160 - Donovan M / @dmille56

04/16/2024 at 06:54AM

57
#161 - Danylo Bodnarchuk / @zairtalk

06/15/2022 at 12:48PM

57
#162 - Aleksandre Khokhiashvili / @skkhokho

07/23/2022 at 10:42AM

57
#163 - Dank City / @ddankcity

12/02/2022 at 03:33PM

58
#164 - Jingshan Yin / @Jingshan1989

07/13/2022 at 08:52PM

58
#165 - OrderObjectOrange / @rderbjectrange

09/06/2022 at 07:33PM

58
#166 - Jake Shomer / @ShomerJake

08/18/2023 at 03:54PM

60
#167 - Agustin Romero / @agus_piojo

09/23/2022 at 01:44AM

60
#168 - Spam Mail / @mrfdot

05/26/2023 at 01:22AM

61
#169 - yang jing / @yiliyajing

05/24/2022 at 04:22PM

62
#170 - clown / @clownjef

06/26/2022 at 08:59PM

64
#171 - Kaepa69 / @kaepa3

11/04/2023 at 04:47PM

65
#172 - Sam Liu / @samliu21

03/12/2024 at 03:55AM

66
#173 - sondre-teigen / @sondre-teigen

01/18/2024 at 11:51AM

68
#174 - Nicholas Healy / @nickrhealy

12/25/2022 at 02:06PM

70
#175 - Itxaso / @itsaso23a

02/05/2023 at 01:52PM

71
#176 - Adam / @Adam27804534

06/13/2022 at 01:18PM

71
#177 - 🤔 / @Sneigg_

10/04/2022 at 01:08PM

73
#178 - Michael Abrahamsen / @MikeAbrahamsen

09/06/2022 at 01:51PM

78
#179 - Patrick Hereford / @phereford

07/08/2022 at 08:41PM

78
#180 - Cata / @catacox17

04/28/2023 at 02:22PM