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

Java Array2List - 210 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 94
  • Number of attempts: 3
Draw the Go board - 108 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
  • Number of attempts: 4
Number an outline - 199 entries

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

  • Best score: 25
  • Best player score: 48
  • Number of attempts: 3
Python to Ruby - 188 entries

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

  • Best score: 24
  • Best player score: 42
  • Number of attempts: 2
Extract text from xml - 101 entries

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

  • Best score: 28
  • Best player score: 36
  • Number of attempts: 4
Sort and add attributes - 1043 entries

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

  • Best score: 18
  • Best player score: 33
  • Number of attempts: 3
Sort the cardinal numbers - 206 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 3
Search and Replace 0 - 3819 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 3
Ruby 1.9 hashes - 1024 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
  • Number of attempts: 3
Append semicolon after expressions - 821 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 7
Prefixes and suffixes - 464 entries

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

  • Best score: 17
  • Best player score: 26
  • Number of attempts: 5
lamb had a little Mary - 449 entries

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

  • Best score: 16
  • Best player score: 32
  • Number of attempts: 2
Reverse Simple Deletion - 692 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Sort the VimGolf challenges by popularity - 241 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
  • Number of attempts: 7
A HAPPY NEW YEAR 2014 ! - 9012 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
The Cake is a Lie - 1099 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 12
  • Number of attempts: 1
Swap assigned value - 482 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
Make it more readable - 1703 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 4
SFD-ROC: vimvimvim - 1235 entries

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

  • Best score: 8
  • Best player score: 11
  • Number of attempts: 1
Remove noise from HTTP log - 581 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
  • Number of attempts: 1
REDRUM - 131 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
  • Number of attempts: 9
Exchanging Quotes - 725 entries

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

  • Best score: 30
  • Best player score: 38
  • Number of attempts: 1
Context insensitive completion 0 - 440 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: 7
  • Best player score: 7
  • Number of attempts: 1
Context Insensitive completion 1 - 387 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
Let's play some Ivmgolf - 856 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 3
Remove semicolons after expressions - 425 entries

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

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 4
Words in parens - 10279 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 3
Delete unwanted lines - 315 entries

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

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Top X - 177 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
  • Number of attempts: 6
The Quick Brown Fox Jumps Over The Lazy Vim - 318 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: 10
  • Best player score: 10
  • Number of attempts: 2
The meaning - 487 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Line Zipper - 388 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Number of attempts: 1
V to the i - 3495 entries

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

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
switch variable - 4069 entries

how fast can you switch two variable ?

  • Best score: 3
  • Best player score: 11
  • Number of attempts: 2
Increment, increment, increment.... - 465 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 1
The name of the game - 571 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 2
Lookahead and Lookbehind - 62 entries

Look everywhere

  • Best score: 16
  • Best player score: 23
  • Number of attempts: 8
A Simple One - 806 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
  • Number of attempts: 1
abcd > a b c d - 237 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 1
The holy-grail may help - 292 entries

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

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 1
vim = 22 / 7 - 391 entries

pi square vim

  • Best score: 20
  • Best player score: 21
  • Number of attempts: 7
quotes inside quotes - 2632 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: 2
  • Best player score: 17
  • Number of attempts: 2
Numbering a List - 1684 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 2
Checkerboard case pattern - 106 entries

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

  • Best score: 15
  • Best player score: 24
  • Number of attempts: 1
imports alignment (python) - 570 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 23
  • Number of attempts: 2
Hole-in-one - 929 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
  • Number of attempts: 3
Switch function arguments - 1771 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Vertical Limit - 1995 entries

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

  • Best score: 21
  • Best player score: 25
  • Number of attempts: 5
Saving the hashes(#) - 1660 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
  • Number of attempts: 6
Recursively Palindrome - 204 entries

Note that there are 2^6-1 characters.

  • Best score: 6
  • Best player score: 28
  • Number of attempts: 7
Mess in revision history - 919 entries

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 26
  • Number of attempts: 2
NBCU Weekly Challenge - Test - 214 entries

Just testing.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 4
-a-b-c- - 2325 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 1
Enumerate words - 219 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 27
  • Number of attempts: 5
Justin
Twitter:

entered into 54 challenges

contributed 0 challenges