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

Remove noise from HTTP log - 624 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: 17
  • Number of attempts: 1
Reformat a C golf submission - 488 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

  • Best score: 22
  • Best player score: 33
  • Number of attempts: 1
Create Leading Zeros - 197 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 46
  • Number of attempts: 1
vim = 22 / 7 - 408 entries

pi square vim

  • Best score: 20
  • Best player score: 402
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 143 entries

Someone has vandalized our text (again). Please fix to read: The Quick Brown Fox Jumps Over The Lazy Dog.

  • Best score: 25
  • Best player score: 98
  • Number of attempts: 1
Remember FizzBuzz? - 548 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 132
  • Number of attempts: 1
Do you demand a shrubbery? - 1042 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 26
  • Number of attempts: 2
Change name of a variable - 148 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Suffix sort - 166 entries

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

  • Best score: 19
  • Best player score: 30
  • Number of attempts: 2
Prefixes and suffixes - 526 entries

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

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 10
The holy-grail may help - 302 entries

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

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 1
switch variable - 4665 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 3
Happy New Year! - 129 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 27
  • Number of attempts: 2
HTML to Haml - 757 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 50
  • Number of attempts: 1
Saving the hashes(#) - 1876 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: 32
  • Number of attempts: 2
The name of the game - 596 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Flip the chessboard - 66 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: 57
  • Number of attempts: 1
Aligning function arguments to match a specific coding style - 160 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

  • Best score: 16
  • Best player score: 89
  • Number of attempts: 1
Inconsistent real estate paste - 142 entries

Format a hand-typed real estate listing that uses inconsistent punctuation into four sections

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

Align as one import per line.

  • Best score: 17
  • Best player score: 30
  • Number of attempts: 5
Counting in binary - 405 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 21
Complete the circuit grid! - 72 entries

Continuing from the last challenge, add additional rows to the grid. Change each of the names from 'A1'...'A10' to 'B1'...'B10', 'C1'...'C10', etc, and for each new row add 0.7 to the X values in the (X Y) at the end of each line.

  • Best score: 49
  • Best player score: 71
  • Number of attempts: 4
The meaning - 509 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
abcd > a b c d - 248 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
Pairs of numbers - 340 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

  • Best score: 26
  • Best player score: 60
  • Number of attempts: 2
120 Degrees - 389 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 57
  • Number of attempts: 1
Make it more readable - 1812 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 12
Increment, increment, increment.... - 521 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 1
quotes inside quotes - 2946 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: 19
  • Number of attempts: 1
Make the circuit grid! - 72 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: 88
  • Number of attempts: 1
Switch function arguments - 1888 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
Context Insensitive completion 1 - 399 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 1
replacing each line of a block selection - 2694 entries

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

  • Best score: 18
  • Best player score: 37
  • Number of attempts: 1
Lisp Condense - 400 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 19
  • Number of attempts: 3
attr_aligner - 3245 entries

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

  • Best score: 19
  • Best player score: 33
  • Number of attempts: 1
Reconstruct the Sentence - 1038 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: 25
  • Number of attempts: 4
Enumerate words - 225 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 5694 entries

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

  • Best score: 32
  • Best player score: 46
  • Number of attempts: 2
Words in parens - 12094 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 22
  • Number of attempts: 3
Vertical Limit - 2243 entries

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

  • Best score: 21
  • Best player score: 61
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10151 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Shuffle puzzle - 302 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

  • Best score: 13
  • Best player score: 16
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 440 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: 45
  • Number of attempts: 1
V to the i - 4380 entries

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

  • Best score: 7
  • Best player score: 18
  • Number of attempts: 1
Where should I put the Newline? - 830 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
Append semicolon after expressions - 898 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 6
A Simple One - 854 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
Reverse Simple Deletion - 736 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 17
  • Number of attempts: 2
The Quick Brown Fox Jumps Over The Lazy Vim - 339 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: 11
  • Number of attempts: 3
Don't know what this is - 1872 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 17
  • Number of attempts: 2
fib.c cleanup - 58 entries

cleanup the file

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
NATO phonetic alphabet - 413 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 23
  • Number of attempts: 2
O Christmas Tree - 99 entries

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

  • Best score: 22
  • Best player score: 31
  • Number of attempts: 2
you're stuck on jQuery < 1.7 - 325 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 35
  • Number of attempts: 1
That hyphen - 2393 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 39
  • Number of attempts: 1
Sort and add attributes - 1113 entries

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

  • Best score: 33
  • Best player score: 40
  • Number of attempts: 1
Two become one - 692 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 37
  • Number of attempts: 1
Extract argument from function - 2134 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 26
  • Number of attempts: 1
NBCU Weekly Challenge - Test - 227 entries

Just testing.

  • Best score: 18
  • Best player score: 22
  • Number of attempts: 1
Python Hello World! Reformatting - 859 entries

A novice Python using prints Hello World! and a pro shows him different way. Using vim to get into pro style from novice, win the challenge.

  • Best score: 39
  • Best player score: 54
  • Number of attempts: 1
Reformat most common surnames - 538 entries

Reformat copy-pasted table into a list of the most common surnames

  • Best score: 23
  • Best player score: 55
  • Number of attempts: 1
Context insensitive completion 0 - 457 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: 9
  • Number of attempts: 2
Make Fancy Header - 929 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 31
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1381 entries

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

  • Best score: 8
  • Best player score: 9
  • Number of attempts: 7
Generate Fibonacci Numbers - 211 entries

Use your super vim powers to generate Fibonacci Numbers.

  • Best score: 19
  • Best player score: 25
  • Number of attempts: 1
Alphabetize the directory - 260 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 116
  • Number of attempts: 2
Search and Replace 0 - 4446 entries

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

  • Best score: 12
  • Best player score: 18
  • Number of attempts: 1
-a-b-c- - 2902 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 13
Simple text editing with Vim - 11067 entries

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

  • Best score: 13
  • Best player score: 27
  • Number of attempts: 1
Shebangs for all - 1669 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: 25
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 71 entries

A is for apple, b is for ball, etc... This familiar phonics poem has been rotated 13 characters. Make the letter match the word.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 1
Change the content of a string - 1267 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 30
  • Number of attempts: 1
Reformat some Python - 519 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 46
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 768 entries

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

  • Best score: 19
  • Best player score: 61
  • Number of attempts: 1
Get rid of html tags - 316 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 15
  • Best player score: 32
  • Number of attempts: 1
Word frequency alignment - 218 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 158
  • Number of attempts: 1
lamb had a little Mary - 535 entries

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

  • Best score: 16
  • Best player score: 44
  • Number of attempts: 1
Neither Fizz nor Buzz - 204 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 3
Add links to an existing HTML table - 59 entries

Add these links at that top to the respective table cell. First link, first cell, etc.

  • Best score: 42
  • Best player score: 57
  • Number of attempts: 8
Reverse and double space - 423 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 1
Count both ways - 918 entries

Right AND down.

  • Best score: 13
  • Best player score: 19
  • Number of attempts: 3
Justin Knag
Twitter:

Facebooker and Entrepreneur

entered into 81 challenges

contributed 0 challenges