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 5a390183530db00e38000001

Sort yaml structures alphabetically by root key names

sometimes we want to sort structures alphabetically in yaml files

Start file
c:
  required: false

h:
  optional: true
  choice:
    - true
    - false

f:
  required: true

e:
  optional: true
  choice:
    - b
    - a

g:
  optional: false

j:
  required: true

a:
  required: true

i:
  required: false

d:
  required: false

b:
  optional: true
  choice:
    - 1
    - 2
End file
a:
  required: true

b:
  optional: true
  choice:
    - 1
    - 2

c:
  required: false

d:
  required: false

e:
  optional: true
  choice:
    - b
    - a

f:
  required: true

g:
  optional: false

h:
  optional: true
  choice:
    - true
    - false

i:
  required: false

j:
  required: true

View Diff

diff --git a/old.yml b/new.yml
index a925691..a36642f 100644
--- a/old.yml
+++ b/new.yml
@@ -1,14 +1,17 @@
+a:
+  required: true
+
+b:
+  optional: true
+  choice:
+    - 1
+    - 2
+
 c:
   required: false
 
-h:
-  optional: true
-  choice:
-    - true
-    - false
-
-f:
-  required: true
+d:
+  required: false
 
 e:
   optional: true
@@ -16,23 +19,20 @@ e:
     - b
     - a
 
+f:
+  required: true
+
 g:
   optional: false
 
-j:
-  required: true
-
-a:
-  required: true
+h:
+  optional: true
+  choice:
+    - true
+    - false
 
 i:
   required: false
 
-d:
-  required: false
-
-b:
-  optional: true
-  choice:
-    - 1
-    - 2
+j:
+  required: true

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 12 remaining solutions by signing in and submitting your own entry
#13 Ben Hill / @KaizenSoze70 - Score: 91 - 12/19/17 @ 13:03
34GdGggPjjjjo<Esc>37GdG10GP37GdG19GP37GdGggP37G3<Esc>dGudG25GP37G3<Esc>dG16GP34GdGudG16GP37GdG22GPGddZZ

0 comments


Created by: @fohte

13 active golfers, 25 entries

Leaderboard (lowest score wins):
31
#1 - tPenguinLTG / @tpenguinltg

12/20/2017 at 09:06AM

32
#2 - LungZeno / @LungZenoOpen

01/16/2018 at 09:29PM

33
#3 - DHM / @DHM29978992

05/20/2018 at 02:32AM

34
#4 - Jon Krause / @jkrause314

12/25/2017 at 04:05AM

36
#5 - Saki Gw / @Sakigw

12/19/2017 at 01:06PM

44
#6 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:19PM

44
#7 - Elliott Bignell / @ElliottCBi

12/19/2017 at 02:33PM

44
#8 - Klaus-Peter Schreiner / @KlaPeSch13

03/08/2018 at 07:55AM

45
#9 - mnx / @mnxx

01/04/2018 at 10:25AM

57
#10 - c0llision / @0xc0llision

01/27/2018 at 08:22PM

62
#11 - Sage san / @sagesancast

12/20/2017 at 02:19PM

76
#12 - Marc André Freiheit / @marc_freiheit

05/29/2018 at 11:05AM

91
#13 - Ben Hill / @KaizenSoze70

12/19/2017 at 01:03PM