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 by @Ajnasz:

Unlock 5 remaining solutions by signing in and submitting your own entry
Created by: @fohte

14 active golfers, 26 entries

Solutions by @Ajnasz:
44
#7 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:19PM

45
#>9 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:18PM

46
#>10 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:16PM

47
#>10 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:16PM

48
#>10 - Lajos Koszti / @Ajnasz

12/19/2017 at 01:14PM