Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Leaderboard, Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put [challenge ID]

Top Entries

Hi nok! - Rank: 1/104, Score: 2

Tuberda!

Letters are numbers - Rank: 1/87, Score: 20

Letters and numbers are interchangeable. A lot of programming languages give you simple ways to convert individual letters to hex, binary and decimal but does Vim?

replacing each line of a block selection - Rank: 1/557, Score: 18

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

Sort and add attributes - Rank: 1/595, Score: 33

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

Rotating Philosophers Problem - Rank: 1/271, Score: 29

Can you help the philosophers find a good place to sit before they get five forks and spaghetti?

Fix the Haiku - Rank: 1/160, Score: 29

Change this slightly scrambled haiku to its unscrambled form and fix the capitalisation and punctuation along the way.

Generate Fibonacci Numbers - Rank: 1/132, Score: 19

Use your super vim powers to generate Fibonacci Numbers.

HTML to Haml - Rank: 1/432, Score: 27

Help convert this HTML page to Haml.

Insert a Markdown link - Rank: 1/309, Score: 22

Put a link in a markdown document, using the after-the-paragraph format.

Line Zipper - Rank: 1/249, Score: 13

Zip/pair related lines.

82 bottles of beer on the wall - Rank: 2/194, Score: 108

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

Word Blender - Rank: 2/90, Score: 33

The insides of long words seem to have been run through the blender. Can you fix this famous tale, brave knight?

Table Reshuffle - Rank: 2/213, Score: 23

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

Remember FizzBuzz? - Rank: 2/247, Score: 49

Output FizzBuzz to 100. Start with nothing.

Solve the Sokoban - Rank: 2/113, Score: 25

A wink for all Vimgolfers that play Nethack too.

The Universal Declaration of Human Rights, Article 1 - Rank: 3/110, Score: 24

Somebody's got this slightly muddled up. See how quickly you can fix it. (I made this to experiment with buffers. I'm not actually sure whether this is faster with buffers or without.)

Prime Numbers - Rank: 3/115, Score: 34

List the first 100 prime numbers.

Braces or Brackets? - Rank: 4/354, Score: 34

Someone forgot whether to use braces or brackets and you have to clean up their code!

Exchanging Quotes - Rank: 4/224, Score: 31

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

Interweave two blocks of text - Rank: 4/207, Score: 16

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

Reverse and double space - Rank: 5/126, Score: 14

Reverse the order of the given lines and double space everything

Before there was Farmville... - Rank: 5/54, Score: 173

There was old MacDonald. For my toddler. The first Vim sing-a-long?

un-C-escape string - Rank: 5/28, Score: 12

Convert escape sequences to characters

Numbering a List - Rank: 5/832, Score: 15

Pretty simple, number the list.

PHP Array Syntax -> MailChimp Merge Syntax - Rank: 6/268, Score: 23

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!

Compile C - Rank: 7/336, Score: 11

You might have to get clever to do this one.

Sorting paragraphs - Rank: 7/274, Score: 23

Order the paragraphs correctly, per prefixed index

Happy New Year! - Rank: 8/96, Score: 24

This is a simple new year's challenge.

Hatsuyume - Rank: 8/271, Score: 15

http://en.wikipedia.org/wiki/Hatsuyume

imports alignment (python) - Rank: 8/356, Score: 17

Align as one import per line.

Reformat/Refactor a Golfer Class - Rank: 9/1924, Score: 32

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

Replacing some words - Rank: 9/274, Score: 17

How fast could it be?

Flodder-challenge - Rank: 9/356, Score: 28

Replace the text the most efficient and win!

Turn this csv list into queries - Rank: 9/135, Score: 106

Transform each line of this csv file into a MySQL-ready INSERT query.

Here, piggy, piggy... - Rank: 10/55, Score: 93

Youay owknay atwhay otay oday...

Ugly spreadsheet copy/paste to CSV - Rank: 10/281, Score: 21

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

expand a list comprehension (python) - Rank: 11/188, Score: 43

Please show your way to convert a list comprehension in python to an ordinary for-loop expression!

Make it more readable - Rank: 11/577, Score: 13

Insert blank lines to make it more organized and readable

Reverse and count - Rank: 11/341, Score: 21

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

Deleting folded text - Rank: 12/160, Score: 19

The text below contains three folds. Delete them (and the text inside them). For example: 123 456 /*{{{*/ 789 /*}}}*/ 012 Should become: 123 012 Also, add `aoeuaoeu` to make sure small solutions don't get flagged as cheating.

Remove duplicate items - Rank: 13/293, Score: 12

Input is a list of numbers. Produce a set of unique numbers from input.

Whitespace, empty lines and tabs - Rank: 13/971, Score: 17

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

Reformat some Python - Rank: 13/323, Score: 34

Fix some very bizarrely laid-out code.

Reconstruct the Sentence - Rank: 14/524, Score: 20

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

Ruby 1.9 compat - Rank: 15/382, Score: 14

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!

It'ss tooo coold too typpe todaay - Rank: 15/152, Score: 17

My hands are numb with cold. It's hard to type correctly.

remove dupes from array - Rank: 15/460, Score: 17

given a random string that contains a ruby-esque array, make sure that there are no duplicate elements

Sort the cardinal numbers - Rank: 16/142, Score: 12

Maybe a simple challenge.

Reformat most common surnames - Rank: 16/275, Score: 26

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

Ruby 1.9 hashes - Rank: 16/541, Score: 12

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!

Add fold markers to a .c file - Rank: 18/235, Score: 30

Fold markers can make it easier to navigate source code. Add them to this .c file.

The meaning - Rank: 20/150, Score: 5

Numbers are fun!

Another Mixed-Up Haiku - Rank: 20/148, Score: 21

VimGolf ... a perfect evening?

Overall Vimgolf Rank - Rank: 21/99, Score: 28

Suppose you are trying to figure out what your overall rank is at Vimgolf(the sum of all the ranks you got), and as a Vim ninja you decided to use Vim to do the job. Your solution should work for every Vimgolf profile page(The actual input file for this challenge is my Vimgolf profile page). So, direct answer insertion is considered cheating.

Python Hello World! Reformatting - Rank: 22/443, Score: 41

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.

Increment, increment, increment.... - Rank: 23/270, Score: 11

Vim likes macros

Sort entries based on date - Rank: 23/216, Score: 11

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

Reformat a C golf submission - Rank: 24/303, Score: 26

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

Case preserving word replacement - Rank: 25/282, Score: 19

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

Reformat long lines - Rank: 25/229, Score: 17

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

Shebangs for all - Rank: 27/605, Score: 12

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.

Simple text editing with Vim - Rank: 28/2549, Score: 13

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

Wrap the text of an email message to 79 characters - Rank: 30/275, Score: 5

You're replying to an email with silly long lines. Clean them up.

Assignment Alignment - Rank: 31/414, Score: 20

line up the operators. Use spaces, not tabs.

Indentation - Rank: 31/290, Score: 24

Indent each line according to the right number of spaces it needs.

Make Fancy Header - Rank: 34/517, Score: 16

Make the header text stand out with surrounding asterisks

Generate English Alphabets - Rank: 35/254, Score: 24

Start with a, get up to z.

Reverse a single line - Rank: 38/491, Score: 9

Reverse a single line vertically.

Context insensitive completion 0 - Rank: 39/306, Score: 7

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.

Get rid of html tags - Rank: 44/194, Score: 17

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

Reverse characters in a line - Rank: 45/450, Score: 8

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

Almost encrypted - Rank: 50/124, Score: 5

Convert the first paragraph to be even less readable.

Context Insensitive completion 1 - Rank: 54/267, Score: 18

Finish writing this simple Python HTTP server.

Do you have a big gun? - Rank: 57/160, Score: 5

Of course I have.

Change the content of a string - Rank: 73/564, Score: 22

This docstring is a complete lie. Fix it.

switch variable - Rank: 74/943, Score: 11

how fast can you switch two variable ?

The Cake is a Lie - Rank: 82/570, Score: 9

Correct the capitalization of each word

Search and Replace 0 - Rank: 86/1256, Score: 12

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

The holy-grail may help - Rank: 93/210, Score: 16

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

Reverse Simple Deletion - Rank: 123/365, Score: 12

You did the simple deletion, now reverse it.

A Simple One - Rank: 164/524, Score: 9

Here is a very simple one - just to illustrate/introduce a vim feature that some people seem to miss...

Fepic_normal
Federico Galassi
Twitter:

software craftsman

entered into 81 challenges

contributed 0 challenges