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

153 active golfers, 776 entries

Leaderboard (lowest score wins):
36
#91 - Driver / @zhouyijiaren

06/10/2022 at 10:08AM

36
#92 - Ariel Frischer / @ArielFrischer

06/27/2022 at 03:48AM

36
#93 - Patrick Motard / @PatrickMotard

08/25/2022 at 05:44AM

36
#94 - e1mnos / @e1mnos

10/24/2022 at 01:06PM

36
#95 - yann / @ylsarto

12/16/2022 at 05:13AM

37
#96 - Derek Schrock / @derekschrock

05/22/2022 at 10:42PM

37
#97 - Taeer Bar-Yam / @sjOrrit

05/26/2022 at 02:26PM

37
#98 - Stupid Five / @TwistedFilter

06/05/2022 at 12:01PM

37
#99 - evertrasjp / @evertrasjp

08/07/2022 at 10:57AM

37
#100 - Elwin Ransom / @jesseleite85

09/06/2022 at 03:13PM

37
#101 - Gs Abl / @gs_abl

11/27/2022 at 09:58AM

37
#102 - Stuart Spinner / @StuartSpinner

12/23/2022 at 01:13PM

39
#103 - Samuel McKean / @samuelmckean

06/18/2022 at 02:32PM

40
#104 - gjastrab / @gjastrab

07/08/2022 at 08:48PM

40
#105 - kangrabyg-vim-golf / @kangrabyg

07/29/2022 at 03:10PM

41
#106 - noseskdjs / @nosekxkfkd

06/24/2022 at 07:31AM

42
#107 - George Granberry / @JudgeJerj

07/10/2022 at 07:04PM

42
#108 - Austen Cameron / @austencam

09/05/2022 at 05:23AM

43
#109 - Ratkovszki István / @RatkovszkiIstvn

09/04/2022 at 01:42PM

43
#110 - Jonathan Gin / @jonathangin52

09/30/2022 at 04:15AM

44
#111 - Youngchan Lee / @edwardycl

12/15/2022 at 07:47AM

46
#112 - Kiran Rajpurohit / @KiranClose

08/08/2022 at 03:29PM

47
#113 - 深窓の令嬢@ドクター / @arbino1031

09/09/2022 at 02:15AM

50
#114 - 우정민 / @jeongmin2021

10/01/2022 at 09:28AM

52
#115 - CL / @CL58620058

06/02/2022 at 08:34AM

53
#116 - Zachary Peterson / @zpeterson16

07/24/2022 at 04:11AM

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

09/12/2022 at 08:03AM

57
#118 - Danylo Bodnarchuk / @zairtalk

06/15/2022 at 12:48PM

57
#119 - Aleksandre Khokhiashvili / @skkhokho

07/23/2022 at 10:42AM

57
#120 - Dank City / @ddankcity

12/02/2022 at 03:33PM