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

Search and Replace 0 - 4989 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #152 / 1624
  • Number of attempts: 2
Sierpinski's Triangle - 86 entries

Build the famous fractal, Sierpinski's Triangle.

  • Best score: 25
  • Best player score: 36
  • Position: #19 / 27
  • Number of attempts: 1
Swap assigned value - 647 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Position: #127 / 254
  • Number of attempts: 2
REDRUM - 166 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 / 65
  • Number of attempts: 3
Groups magic - 158 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

  • Best score: 13
  • Best player score: 14
  • Position: #33 / 93
  • Number of attempts: 2
Sort by your own sum - 86 entries

Same numbers as last time, but you'll have to add them yourself.

  • Best score: 24
  • Best player score: 32
  • Position: #9 / 30
  • Number of attempts: 1
Sort by sum of numbers in a line(?) - 67 entries

The lines with the biggest sums need to be at the top. The sums are on the right, which makes life hard. Maybe you can find a feature that will do all the work for you...

  • Best score: 15
  • Best player score: 16
  • Position: #20 / 39
  • Number of attempts: 1
Readable Rubyhash - 267 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: 23
  • Best player score: 25
  • Position: #15 / 95
  • Number of attempts: 3
Dehamlizing - 185 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 45
  • Position: #55 / 72
  • Number of attempts: 1
Changing URL path in CSS - 138 entries

What's the quickest way to swap out all the URLs in a CSS file? Is it wasted keystrokes using look-behinds and look-aheads? (I'm sorry for the delete/report--I made a mistake with the last one requiring an ugly search for graphic to replace with images. I just intended this to be a simple search and replace that might possibly generate some macros or normals solutions that are quicker)

  • Best score: 40
  • Best player score: 45
  • Position: #34 / 62
  • Number of attempts: 1
Checkerboard case pattern - 164 entries

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

  • Best score: 15
  • Best player score: 17
  • Position: #22 / 61
  • Number of attempts: 3
NATO phonetic alphabet - 529 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 24
  • Position: #146 / 196
  • Number of attempts: 1
Shuffle and Sort - 229 entries

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

  • Best score: 17
  • Best player score: 27
  • Position: #47 / 67
  • Number of attempts: 1
Printable ASCII characters - 142 entries

From a blank input, print all 95 printing ASCII characters one per line, from space to tilde.

  • Best score: 22
  • Best player score: 36
  • Position: #23 / 44
  • Number of attempts: 1
A simple change - 461 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 14
  • Position: #64 / 191
  • Number of attempts: 1
Extract text from xml - 127 entries

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

  • Best score: 28
  • Best player score: 35
  • Position: #15 / 46
  • Number of attempts: 2
The Quick Brown Fox Jumps Over The Lazy Vim - 420 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: #31 / 192
  • Number of attempts: 2
The name of the game - 665 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #21 / 360
  • Number of attempts: 1
Chucking wood - 129 entries

An exercise in compressing repetitive text. For this challenge, any entry that uses keys outside the main row (such as arrow keys, Home, End, Delete, etc.) will be removed. (Esc is OK, though you should be using C-[ anyway.)

  • Best score: 51
  • Best player score: 54
  • Position: #13 / 49
  • Number of attempts: 2
Stairs Indenting - 473 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 13
  • Position: #29 / 197
  • Number of attempts: 4
Unwrap the text of an email message - 192 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

  • Best score: 16
  • Best player score: 24
  • Position: #41 / 75
  • Number of attempts: 1
Flip the chessboard - 95 entries

White's turn is over. Flip the board to black's perspective. I added coordinates to frustrate you.

  • Best score: 18
  • Best player score: 21
  • Position: #12 / 32
  • Number of attempts: 2
Make the circuit grid! - 101 entries

Copy this command for a circuit layout program to create 10 total smd commands. Increment the number in quotes to name each pad, and add 0.7 to each of the (X Y) coordinates at the end of each line.

  • Best score: 26
  • Best player score: 29
  • Position: #37 / 50
  • Number of attempts: 1
Exchanging Quotes - 858 entries

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

  • Best score: 30
  • Best player score: 32
  • Position: #60 / 230
  • Number of attempts: 4
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #302 / 777
  • Number of attempts: 2
Switch function arguments - 2139 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #212 / 663
  • Number of attempts: 3
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #12 / 419
  • Number of attempts: 1
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 14
  • Position: #24 / 199
  • Number of attempts: 2
Remove noise from HTTP log - 717 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: 16
  • Position: #154 / 273
  • Number of attempts: 1
Remove semicolons after expressions - 654 entries

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

  • Best score: 6
  • Best player score: 8
  • Position: #175 / 263
  • Number of attempts: 1
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #13 / 1748
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 1009 entries

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

  • Best score: 19
  • Best player score: 35
  • Position: #106 / 193
  • Number of attempts: 2
Replacing some words - 428 entries

How fast could it be?

  • Best score: 17
  • Best player score: 21
  • Position: #68 / 151
  • Number of attempts: 1
Sort the cardinal numbers - 310 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 12
  • Position: #19 / 148
  • Number of attempts: 2
formatted text to markdown - 184 entries

You're converting some posts from an old blog to markdown. The formatted text is far closer to the finished product than the html markup, so it seems like a good place to start. Word wrapping seems to be the main area for optimization.

  • Best score: 70
  • Best player score: 79
  • Position: #40 / 67
  • Number of attempts: 2
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #326 / 650
  • Number of attempts: 2
Line Zipper - 473 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #154 / 215
  • Number of attempts: 1
remove dupes from array - 1358 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: 18
  • Position: #91 / 336
  • Number of attempts: 5
Alphabetize the directory - 298 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 32
  • Position: #35 / 101
  • Number of attempts: 3
PHP Array Syntax -> MailChimp Merge Syntax - 545 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: 24
  • Position: #33 / 150
  • Number of attempts: 2
Sort entries based on date - 392 entries

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

  • Best score: 11
  • Best player score: 12
  • Position: #53 / 117
  • Number of attempts: 1
Refactor to Helpers - 50 entries

This Rails partial is almost all template escapes. Put it into a helper, and refactor each case to methods so we can build out the controls for each. (I've converted to tabs - fighting with Vimgolf's default config shouldn't be part of the challenge.)

  • Best score: 147
  • Best player score: 286
  • Position: #12 / 25
  • Number of attempts: 1
imports alignment (python) - 700 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 20
  • Position: #85 / 198
  • Number of attempts: 4
HTML to Haml - 878 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 33
  • Position: #84 / 204
  • Number of attempts: 2
Reformat long lines - 358 entries

Rearrange this ruby method call to put each parameter on its own line. Could become a useful macro.

  • Best score: 15
  • Best player score: 17
  • Position: #65 / 134
  • Number of attempts: 4
Ruby 1.9 hashes - 1244 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: 14
  • Position: #214 / 406
  • Number of attempts: 4
Assignment Alignment - 883 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 18
  • Position: #23 / 220
  • Number of attempts: 5
Shebangs for all - 1999 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: 12
  • Position: #125 / 516
  • Number of attempts: 2
82 bottles of beer on the wall - 313 entries

Take them down. (sorry, only 82 bottles because the problem size is limited!)

  • Best score: 106
  • Best player score: 121
  • Position: #44 / 146
  • Number of attempts: 2
Table Reshuffle - 429 entries

Fix the column order in this table... also append the new 'username' column.

  • Best score: 22
  • Best player score: 29
  • Position: #62 / 139
  • Number of attempts: 3
Reverse and count - 473 entries

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

  • Best score: 18
  • Best player score: 22
  • Position: #38 / 176
  • Number of attempts: 5
Ruby 1.9 compat - 629 entries

Remember when Ruby supported `when <expr> :`? Well, it doesn't in 1.9, so let's make sure we use `then`, without ruining our lovely new hash syntax!

  • Best score: 14
  • Best player score: 14
  • Position: #27 / 234
  • Number of attempts: 2
Reverse Simple Deletion - 847 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #219 / 458
  • Number of attempts: 1
Increment, increment, increment.... - 688 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #220 / 408
  • Number of attempts: 1
The Cake is a Lie - 1346 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Position: #333 / 527
  • Number of attempts: 1
Context insensitive completion 0 - 577 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: #66 / 246
  • Number of attempts: 2
Sort and add attributes - 1451 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #99 / 563
  • Number of attempts: 1
Reconstruct the Sentence - 1507 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: #186 / 412
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3665 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #53 / 787
  • Number of attempts: 7
Simple text editing with Vim - 12811 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #923 / 3694
  • Number of attempts: 1
Vasil Sakarov
Twitter:

entered into 60 challenges

contributed 0 challenges