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 [challenge ID]

Played Challenges

One number per line - 18616 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Position: #2094 / 3842
  • Number of attempts: 4
Search and Replace 0 - 4792 entries

Replace every instance of 'aaa' with 'xaaax'.

  • Best score: 12
  • Best player score: 13
  • Position: #745 / 1585
  • Number of attempts: 3
Vice versa - 7805 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #624 / 2101
  • Number of attempts: 4
O Christmas Tree - 108 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

  • Best score: 22
  • Best player score: 23
  • Position: #6 / 42
  • Number of attempts: 4
Subtraction - 178 entries

Solve the equations.

  • Best score: 18
  • Best player score: 24
  • Position: #32 / 61
  • Number of attempts: 2
Suffix sort - 254 entries

Sort from the end of the line, as if the letters in each line were reversed.

  • Best score: 19
  • Best player score: 25
  • Position: #40 / 65
  • Number of attempts: 4
Vim tetris - 352 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Position: #42 / 101
  • Number of attempts: 4
Five Pillars - 62 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

  • Best score: 41
  • Best player score: 56
  • Position: #6 / 23
  • Number of attempts: 2
Carriage return - 42 entries

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

  • Best score: 22
  • Best player score: 22
  • Position: #9 / 20
  • Number of attempts: 2
Going underground.... - 339 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 29
  • Position: #54 / 125
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10628 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #18 / 3667
  • Number of attempts: 5
attr_aligner - 3444 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 19
  • Position: #38 / 692
  • Number of attempts: 8
Letter case trickery - 1594 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 11
  • Position: #218 / 511
  • Number of attempts: 5
quotes inside quotes - 3125 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 14
  • Best player score: 14
  • Position: #87 / 1072
  • Number of attempts: 5
Sort the VimGolf challenges by popularity - 345 entries

"Sort by popularity" is a good order to play the challenges. Not perfect, but you could do a lot worse. ;) Input is a sample copy-pasted from vimgolf.com. Some of the challenge names have digits that will get in your way, so read ":help :sort" for hints on sorting with a regex. When you're done, try your solution on the full list!

  • Best score: 15
  • Best player score: 16
  • Position: #50 / 105
  • Number of attempts: 5
Words in parens - 12858 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #220 / 3946
  • Number of attempts: 7
Hole-in-one - 1012 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 17
  • Position: #102 / 302
  • Number of attempts: 6
It's a factor - 91 entries

Flaunt your macro prowess by factoring some numbers. Too hard? It takes less than 30 strokes, I promise.

  • Best score: 24
  • Best player score: 63
  • Position: #19 / 36
  • Number of attempts: 3
Lookahead and Lookbehind - 67 entries

Look everywhere

  • Best score: 16
  • Best player score: 20
  • Position: #9 / 29
  • Number of attempts: 3
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Position: #40 / 89
  • Number of attempts: 3
Circle of Fifths with Sharps - 96 entries

Display a list of the Circle of Fifths with corresponding solfege syllables with sharps. Handling spaces may be tricky.

  • Best score: 24
  • Best player score: 24
  • Position: #7 / 36
  • Number of attempts: 4
Shuffle and Sort - 209 entries

The values where sorted incorrectly. Get them back to how they are supposed to be

  • Best score: 17
  • Best player score: 22
  • Position: #25 / 65
  • Number of attempts: 4
Saving the hashes(#) - 1992 entries

The following file is copied from vimcasts.org(Its only for learning purpose,hope the site owner doesn't mind it), its probably the easiest of challenges.Our goal is to delete every line which doesn't contain a hash signs. The remaining hash signs with numbers are then sorted to get the final output.

  • Best score: 20
  • Best player score: 25
  • Position: #172 / 473
  • Number of attempts: 4
replacing each line of a block selection - 2947 entries

replace each line's ../assets/js with /javascripts

  • Best score: 18
  • Best player score: 18
  • Position: #8 / 768
  • Number of attempts: 5
constructor - 180 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 70
  • Position: #14 / 58
  • Number of attempts: 7
switch variable - 5036 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #232 / 1736
  • Number of attempts: 3
Ugly spreadsheet copy/paste to CSV - 973 entries

convert an ugly spreadsheet copy/paste into a CSV format.

  • Best score: 19
  • Best player score: 29
  • Position: #78 / 185
  • Number of attempts: 4
Replacing some words - 419 entries

How fast could it be?

  • Best score: 17
  • Best player score: 19
  • Position: #37 / 148
  • Number of attempts: 3
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #212 / 640
  • Number of attempts: 3
remove dupes from array - 1336 entries

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

  • Best score: 17
  • Best player score: 20
  • Position: #120 / 331
  • Number of attempts: 6
Alphabetize the directory - 283 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 32
  • Position: #34 / 99
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 507 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 26
  • Position: #56 / 148
  • Number of attempts: 2
Sort entries based on date - 363 entries

Sort some entries in a Ledger-file based on date.

  • Best score: 11
  • Best player score: 12
  • Position: #55 / 114
  • Number of attempts: 2
Shebangs for all - 1912 entries

We've all seen or used a shebang once or twice. Ditch the specific paths and leave just a dynamic Ruby and Python bath behind.

  • Best score: 11
  • Best player score: 13
  • Position: #185 / 500
  • Number of attempts: 3
A Simple One - 1001 entries

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

  • Best score: 9
  • Best player score: 9
  • Position: #251 / 643
  • Number of attempts: 1
Reverse Simple Deletion - 832 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #284 / 454
  • Number of attempts: 1
Sort and add attributes - 1327 entries

Sort the states and add the attribute country to each record.

  • Best score: 33
  • Best player score: 33
  • Position: #92 / 529
  • Number of attempts: 2
Reconstruct the Sentence - 1369 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 20
  • Best player score: 21
  • Position: #175 / 384
  • Number of attempts: 1
Braces or Brackets? - 884 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

  • Best score: 34
  • Best player score: 36
  • Position: #44 / 288
  • Number of attempts: 4
Whitespace, empty lines and tabs - 3340 entries

Convert tabs to spaces, strip empty lines and trailing whitespace.

  • Best score: 16
  • Best player score: 17
  • Position: #40 / 737
  • Number of attempts: 7
Flodder-challenge - 1118 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 30
  • Position: #76 / 311
  • Number of attempts: 5
Simple text editing with Vim - 12290 entries

Make the pairs of lines match up by making each second line same as first

  • Best score: 13
  • Best player score: 13
  • Position: #226 / 3581
  • Number of attempts: 4
Reformat/Refactor a Golfer Class - 6560 entries

A simple case of removing unneeded code and fixing broken indentation.

  • Best score: 32
  • Best player score: 32
  • Position: #81 / 1616
  • Number of attempts: 7

Contributed Challenges

Five Pillars - 62 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

oliver mueller
Twitter:

Programmer - mostly working with embedded systems in C++. Interested in Rust, Ruby and Haskell. Blog at http://t.co/QDcTy760Z

entered into 43 challenges

contributed 1 challenges