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

vim = 22 / 7 - 447 entries

pi square vim

  • Best score: 20
  • Best player score: 21
  • Position: #42 / 131
  • Number of attempts: 7
V to the i - 4751 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 9
  • Position: #1504 / 1879
  • Number of attempts: 1
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #204 / 1585
  • Number of attempts: 3
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #137 / 249
  • Number of attempts: 1
-a-b-c- - 3176 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #436 / 1129
  • Number of attempts: 1
NBCU Weekly Challenge - Test - 243 entries

Just testing.

  • Best score: 18
  • Best player score: 18
  • Position: #2 / 114
  • Number of attempts: 4
Mess in revision history - 1161 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 26
  • Position: #147 / 247
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1779 / 3666
  • Number of attempts: 1
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: 17
  • Position: #680 / 1072
  • Number of attempts: 2
Top X - 191 entries

The End File is the Top 10 Vimgolf Leaderboard at June 29, 2013. This is a second version, with a great contribution of @udioica. X is ten in Roman,a numeric system in ancient Rome

  • Best score: 18
  • Best player score: 27
  • Position: #33 / 69
  • Number of attempts: 6
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: 15
  • Position: #6 / 105
  • Number of attempts: 7
Number an outline - 249 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 48
  • Position: #34 / 75
  • Number of attempts: 3
Words in parens - 12858 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1176 / 3946
  • Number of attempts: 3
Draw the Go board - 140 entries

which is a 19×19 lines board. Here we use ascii characters only for simplicity. See diff file to get a sense. (See also http://en.wikipedia.org/wiki/Go_(game))

  • Best score: 50
  • Best player score: 68
  • Position: #23 / 48
  • Number of attempts: 4
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: 22
  • Position: #223 / 302
  • Number of attempts: 3
Delete unwanted lines - 396 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 9
  • Position: #2 / 225
  • Number of attempts: 1
Lookahead and Lookbehind - 67 entries

Look everywhere

  • Best score: 16
  • Best player score: 23
  • Position: #21 / 29
  • Number of attempts: 8
REDRUM - 150 entries

If you remember "The Shinning", the first time you saw the bloody word REDRUM you probably thinked "What the Hell is that?" Well, then you know that you need a little help from a looking-glass to make sense of it. Now it's time to use vim like a mirror to reveal the message.

  • Best score: 14
  • Best player score: 15
  • Position: #26 / 62
  • Number of attempts: 9
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 27
  • Position: #57 / 89
  • Number of attempts: 5
Prefixes and suffixes - 591 entries

Generate all prefixes of "vimchallenge", then all suffixes.

  • Best score: 17
  • Best player score: 26
  • Position: #80 / 192
  • Number of attempts: 5
abcd > a b c d - 280 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Position: #84 / 218
  • Number of attempts: 1
Checkerboard case pattern - 148 entries

All the squares are white. Make some of them black. But only the right ones.

  • Best score: 15
  • Best player score: 24
  • Position: #43 / 58
  • Number of attempts: 1
Extract text from xml - 109 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

  • Best score: 28
  • Best player score: 36
  • Position: #18 / 44
  • Number of attempts: 4
The Quick Brown Fox Jumps Over The Lazy Vim - 401 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 8
  • Best player score: 10
  • Position: #50 / 188
  • Number of attempts: 2
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #100 / 356
  • Number of attempts: 2
lamb had a little Mary - 586 entries

"Mary" and "lamb" are swapped. Unswap them. Fast as you can.

  • Best score: 16
  • Best player score: 32
  • Position: #59 / 163
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1581 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 11
  • Position: #267 / 439
  • Number of attempts: 1
Python to Ruby - 196 entries

Convert this Python code to Ruby. NOTE: This program likely won't run.

  • Best score: 24
  • Best player score: 42
  • Position: #46 / 59
  • Number of attempts: 2
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: 26
  • Position: #190 / 473
  • Number of attempts: 6
Let's play some Ivmgolf - 1091 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #24 / 441
  • Number of attempts: 3
Recursively Palindrome - 239 entries

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 28
  • Position: #47 / 73
  • Number of attempts: 7
Vertical Limit - 2440 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 25
  • Position: #317 / 737
  • Number of attempts: 5
Exchanging Quotes - 821 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 38
  • Position: #149 / 225
  • Number of attempts: 1
Switch function arguments - 2082 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #230 / 652
  • Number of attempts: 2
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #178 / 403
  • Number of attempts: 7
Remove noise from HTTP log - 695 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 18
  • Position: #234 / 270
  • Number of attempts: 1
Remove semicolons after expressions - 628 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 6
  • Position: #57 / 258
  • Number of attempts: 4
switch variable - 5036 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #144 / 1736
  • Number of attempts: 2
The meaning - 558 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #176 / 356
  • Number of attempts: 1
Sort the cardinal numbers - 293 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #115 / 146
  • 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: 14
  • Position: #147 / 640
  • Number of attempts: 4
Line Zipper - 450 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #173 / 210
  • Number of attempts: 1
imports alignment (python) - 661 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 23
  • Position: #111 / 194
  • Number of attempts: 2
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Position: #301 / 639
  • Number of attempts: 2
Java Array2List - 225 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 94
  • Position: #37 / 83
  • Number of attempts: 3
The holy-grail may help - 345 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 16
  • Position: #122 / 205
  • Number of attempts: 1
Ruby 1.9 hashes - 1221 entries

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

  • Best score: 12
  • Best player score: 15
  • Position: #264 / 401
  • 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: #315 / 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: #265 / 454
  • Number of attempts: 2
Increment, increment, increment.... - 662 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #248 / 401
  • Number of attempts: 1
The Cake is a Lie - 1286 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 12
  • Position: #468 / 512
  • Number of attempts: 1
Context insensitive completion 0 - 507 entries

Buried in the lines you're not supposed to add is the line "Add this line!" Add that line to the top of the file.

  • Best score: 6
  • Best player score: 7
  • Position: #78 / 232
  • Number of attempts: 1
Context Insensitive completion 1 - 460 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #101 / 233
  • Number of attempts: 2
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: #147 / 529
  • Number of attempts: 3
Justin
Twitter:

entered into 54 challenges

contributed 0 challenges