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 - 424 entries

pi square vim

  • Best score: 20
  • Best player score: 21
  • Position: #41 / 130
  • Number of attempts: 7
V to the i - 4645 entries

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

  • Best score: 7
  • Best player score: 9
  • Position: #1485 / 1859
  • Number of attempts: 1
Search and Replace 0 - 4695 entries

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

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

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #129 / 236
  • Number of attempts: 1
-a-b-c- - 3125 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Position: #427 / 1114
  • Number of attempts: 1
NBCU Weekly Challenge - Test - 233 entries

Just testing.

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

Help Joe clean up what Steve has cobbled.

  • Best score: 17
  • Best player score: 26
  • Position: #145 / 243
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10555 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Position: #1763 / 3642
  • Number of attempts: 1
quotes inside quotes - 3051 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: #664 / 1050
  • Number of attempts: 2
Top X - 189 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 / 68
  • Number of attempts: 6
Sort the VimGolf challenges by popularity - 340 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 / 103
  • Number of attempts: 7
Number an outline - 246 entries

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

  • Best score: 25
  • Best player score: 48
  • Position: #33 / 74
  • Number of attempts: 3
Words in parens - 12769 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1165 / 3925
  • 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 - 982 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: #220 / 299
  • Number of attempts: 3
Delete unwanted lines - 387 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #2 / 220
  • 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 - 145 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: #25 / 59
  • Number of attempts: 9
Enumerate words - 235 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 27
  • Position: #55 / 85
  • Number of attempts: 5
Prefixes and suffixes - 567 entries

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

  • Best score: 17
  • Best player score: 26
  • Position: #77 / 185
  • Number of attempts: 5
abcd > a b c d - 267 entries

transform the single spaces into 4 spaces repeat for each line

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

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

  • Best score: 15
  • Best player score: 24
  • Position: #40 / 54
  • Number of attempts: 1
Extract text from xml - 102 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 / 42
  • Number of attempts: 4
The Quick Brown Fox Jumps Over The Lazy Vim - 392 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: #49 / 182
  • Number of attempts: 2
The name of the game - 636 entries

End up with the name of the game.

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

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

  • Best score: 16
  • Best player score: 32
  • Position: #57 / 158
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1522 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: #260 / 428
  • Number of attempts: 1
Python to Ruby - 190 entries

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

  • Best score: 24
  • Best player score: 42
  • Position: #44 / 56
  • Number of attempts: 2
Saving the hashes(#) - 1973 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 / 468
  • Number of attempts: 6
Let's play some Ivmgolf - 1022 entries

Oops, I spelled that wrong.

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

Note that there are 2^6-1 characters.

  • Best score: 21
  • Best player score: 28
  • Position: #46 / 72
  • Number of attempts: 7
Vertical Limit - 2383 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #311 / 721
  • Number of attempts: 5
Exchanging Quotes - 800 entries

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

  • Best score: 30
  • Best player score: 38
  • Position: #147 / 220
  • Number of attempts: 1
Switch function arguments - 1993 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #224 / 630
  • Number of attempts: 2
Append semicolon after expressions - 968 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #173 / 391
  • Number of attempts: 7
Remove noise from HTTP log - 666 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: #231 / 263
  • Number of attempts: 1
Remove semicolons after expressions - 576 entries

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

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

how fast can you switch two variable ?

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

Numbers are fun!

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

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #113 / 142
  • Number of attempts: 3
Make it more readable - 1915 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #145 / 628
  • Number of attempts: 4
Line Zipper - 448 entries

Zip/pair related lines.

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

Align as one import per line.

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

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Position: #293 / 629
  • Number of attempts: 2
Java Array2List - 218 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 94
  • Position: #36 / 82
  • Number of attempts: 3
The holy-grail may help - 324 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #122 / 197
  • Number of attempts: 1
Ruby 1.9 hashes - 1177 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: #258 / 387
  • Number of attempts: 3
A Simple One - 957 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 / 624
  • Number of attempts: 1
Reverse Simple Deletion - 787 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #262 / 437
  • Number of attempts: 2
Increment, increment, increment.... - 599 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #234 / 382
  • Number of attempts: 1
The Cake is a Lie - 1234 entries

Correct the capitalization of each word

  • Best score: 3
  • Best player score: 12
  • Position: #456 / 497
  • Number of attempts: 1
Context insensitive completion 0 - 476 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
  • Position: #76 / 224
  • Number of attempts: 1
Context Insensitive completion 1 - 437 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #101 / 224
  • Number of attempts: 2
Sort and add attributes - 1217 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #147 / 492
  • Number of attempts: 3
Justin
Twitter:

entered into 54 challenges

contributed 0 challenges