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

Word frequency alignment - 198 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
Alphabetize the directory - 252 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 116
  • Number of attempts: 2
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
SFD-ROC: The Quick Brown Fox - 140 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
Make the circuit grid! - 71 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
Pairs of numbers - 325 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
HTML to Haml - 722 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 50
  • Number of attempts: 1
Reformat some Python - 511 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 46
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 5524 entries

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

  • Best score: 32
  • Best player score: 46
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 421 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
Sort and add attributes - 1090 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 - 676 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
you're stuck on jQuery < 1.7 - 317 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
attr_aligner - 3040 entries

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

  • Best score: 19
  • Best player score: 33
  • Number of attempts: 1
Get rid of html tags - 315 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
Make Fancy Header - 919 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 31
  • 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
lamb had a little Mary - 491 entries

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

  • Best score: 16
  • Best player score: 44
  • Number of attempts: 1
Reverse Simple Deletion - 714 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 17
  • Number of attempts: 2
Append semicolon after expressions - 869 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 6
Remember FizzBuzz? - 537 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 132
  • 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
Prefixes and suffixes - 506 entries

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

  • Best score: 17
  • Best player score: 17
  • Number of attempts: 10
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
Count both ways - 878 entries

Right AND down.

  • Best score: 13
  • Best player score: 19
  • Number of attempts: 3
Generate Fibonacci Numbers - 200 entries

Use your super vim powers to generate Fibonacci Numbers.

  • Best score: 19
  • Best player score: 25
  • Number of attempts: 1
Vertical Limit - 2126 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
Switch function arguments - 1841 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 9599 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Search and Replace 0 - 4166 entries

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

  • Best score: 12
  • Best player score: 18
  • Number of attempts: 1
Reformat a C golf submission - 476 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: 23
  • Best player score: 33
  • Number of attempts: 1
fib.c cleanup - 56 entries

cleanup the file

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
switch variable - 4342 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 3
That hyphen - 2204 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 39
  • Number of attempts: 1
abcd > a b c d - 241 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
A Simple One - 845 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 and double space - 408 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 1
Words in parens - 11169 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 22
  • Number of attempts: 3
Reformat most common surnames - 520 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 - 445 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
Context Insensitive completion 1 - 395 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 1
Make it more readable - 1761 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 12
SFD-ROC: vimvimvim - 1294 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
Shuffle puzzle - 289 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
Remove noise from HTTP log - 611 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
Change name of a variable - 146 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
Lisp Condense - 387 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 19
  • Number of attempts: 3
Do you demand a shrubbery? - 1016 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 26
  • Number of attempts: 2
The Quick Brown Fox Jumps Over The Lazy Vim - 330 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
Counting in binary - 393 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
The name of the game - 582 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
SFD-ROC: ROT13 Phonics - 70 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
Increment, increment, increment.... - 491 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 1
Neither Fizz nor Buzz - 191 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 3
replacing each line of a block selection - 2542 entries

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

  • Best score: 18
  • Best player score: 37
  • Number of attempts: 1
Saving the hashes(#) - 1770 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
Don't know what this is - 1769 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
Create Leading Zeros - 192 entries

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

  • Best score: 23
  • Best player score: 46
  • Number of attempts: 1
-a-b-c- - 2635 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 13
NBCU Weekly Challenge - Test - 215 entries

Just testing.

  • Best score: 18
  • Best player score: 22
  • Number of attempts: 1
Enumerate words - 223 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 3
Extract argument from function - 2019 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
Aligning function arguments to match a specific coding style - 159 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
V to the i - 3973 entries

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

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

pi square vim

  • Best score: 20
  • Best player score: 402
  • Number of attempts: 1
120 Degrees - 366 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 57
  • Number of attempts: 1
quotes inside quotes - 2804 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
NATO phonetic alphabet - 407 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 23
  • Number of attempts: 2
Reconstruct the Sentence - 1028 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
Shebangs for all - 1595 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
Where should I put the Newline? - 798 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
The holy-grail may help - 301 entries

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

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 1
Python Hello World! Reformatting - 837 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
The meaning - 502 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Happy New Year! - 129 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 27
  • Number of attempts: 2
Simple text editing with Vim - 10535 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
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
Ugly spreadsheet copy/paste to CSV - 731 entries

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

  • Best score: 19
  • Best player score: 61
  • Number of attempts: 1
Change the content of a string - 1238 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 30
  • Number of attempts: 1
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
imports alignment (python) - 577 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 30
  • Number of attempts: 5
Justin Knag
Twitter:

Facebooker and Entrepreneur

entered into 81 challenges

contributed 0 challenges