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]

5006 active golfers, 32281 entries, 109 challenges

Open VimGolf challenges

Exchanging Quotes - 224 entries

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

Reverse and double space - 126 entries

Reverse the order of the given lines and double space everything

The meaning - 150 entries

Numbers are fun!

Hi nok! - 104 entries

Tuberda!

un-C-escape string - 28 entries

Convert escape sequences to characters

replacing each line of a block selection - 557 entries

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

Ugly spreadsheet copy/paste to CSV - 281 entries

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

constructor - 130 entries

coding a constructor for a simple class

switch variable - 943 entries

how fast can you switch two variable ?

Replacing some words - 274 entries

How fast could it be?

Make it more readable - 577 entries

Insert blank lines to make it more organized and readable

remove dupes from array - 460 entries

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

Sort entries based on date - 216 entries

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

PHP Array Syntax -> MailChimp Merge Syntax - 268 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!

Refactor to Helpers - 17 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.)

Alphabetize the directory - 169 entries

Put the contacts and their information in alphabetical order.

PHP <--> Java class conversion Part 2 - 74 entries

Same class but reverse!

PHP <--> Java class conversion Part 1 - 136 entries

Convert this tiny php class to adequate java one.

formatted text to markdown - 163 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.

Multiplication table. - 122 entries

Create a multiplication table.

Line Zipper - 249 entries

Zip/pair related lines.

Complete the hex array data (Part II) - 88 entries

Do not use external tools(e.g. tac, seq) [My interpretation of Rule #7]

Interweave two blocks of text - 207 entries

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?

Complete the hex array data - 135 entries

Do not use external tools(e.g. tac, seq) [My interpretation of Rule #7]

Case preserving word replacement - 282 entries

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

Sort the cardinal numbers - 142 entries

Maybe a simple challenge.

Make a PHP Template from a static HTML file - 43 entries

You've got your HTML laid out -- now make it work.

Numbering a List - 832 entries

Pretty simple, number the list.

Recursively Palindrome - 150 entries

Note that there are 2^6-1 characters.

Java Array2List - 161 entries

Convert an java array initializer into a list.

CSS to SASS - 103 entries

Convert from css to sass.

Remove duplicate items - 293 entries

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

imports alignment (python) - 356 entries

Align as one import per line.

expand a list comprehension (python) - 188 entries

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

HTML to Haml - 432 entries

Help convert this HTML page to Haml.

categorize the shopping list - 53 entries

Going to the store with an unorganized shopping list is like programming with Notepad. Help the shopper efficiently navigate the aisles to avoid unnecessary footsteps.

Rotating Philosophers Problem - 271 entries

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

Overall Vimgolf Rank - 99 entries

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.

Promote that perl 'one-liner' ... - 103 entries

You've just sorted your data using perl -e, when suddenly you have to add a row and do it again. That's twice - you'll almost certainly do it again. Time to turn it into a real script. We'll start from having pasted it in ...

Assignment Alignment - 414 entries

line up the operators. Use spaces, not tabs.

Before there was Farmville... - 54 entries

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

The Universal Declaration of Human Rights, Article 1 - 110 entries

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.)

Vim manuals written by Bram. - 57 entries

Find Vim reference manuals written by Bram Moolenaar.

Reformat long lines - 229 entries

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

Generate English Alphabets - 254 entries

Start with a, get up to z.

Here, piggy, piggy... - 55 entries

Youay owknay atwhay otay oday...

Word Blender - 90 entries

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

Happy New Year! - 96 entries

This is a simple new year's challenge.

Insert a Markdown link - 309 entries

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

It'ss tooo coold too typpe todaay - 152 entries

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

Do you have a big gun? - 160 entries

Of course I have.

Getters & Setters: Java - 100 entries

Boilerplate getters & setters - it's a tedious fact of life in Java, and probably the only thing that still pulls me back to an IDE. Perhaps someone knows a fast, pure vim way...

Cartesian product - 142 entries

{1,2,3,4,5} X {1,2,3,4,5}

Return the cow - 68 entries

This cow is too verbose. Give it a lesson.

Align it, win it. - 141 entries

Align this simple listing.

Solve the Sokoban - 113 entries

A wink for all Vimgolfers that play Nethack too.

Reverse a single line - 491 entries

Reverse a single line vertically.

CSV to JSON - 113 entries

A search for shortest vimissh way to convert CSV to JSON.

Make Vim ASCII Art - 26 entries

Art is the triumph over chaos. ~John Cheever

Generate Fibonacci Numbers - 132 entries

Use your super vim powers to generate Fibonacci Numbers.

The holy-grail may help - 210 entries

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

fix typos, reformat and refactor an ActiveRecord model. - 64 entries

Simple case of refactoring ruby code, change camelize word to undescored (vice versa), proper indentation, removing trailing white spaces, etc.

Shebangs for all - 605 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.

Ruby 1.9 hashes - 541 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!

Reverse and count - 341 entries

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

Letters are numbers - 87 entries

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?

Almost encrypted - 124 entries

Convert the first paragraph to be even less readable.

Reverse Simple Deletion - 365 entries

You did the simple deletion, now reverse it.

Dumb to smart - 61 entries

Turn dumb quote to smart vim's way.

82 bottles of beer on the wall - 194 entries

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

Make Fancy Header - 517 entries

Make the header text stand out with surrounding asterisks

The Cake is a Lie - 570 entries

Correct the capitalization of each word

Increment, increment, increment.... - 270 entries

Vim likes macros

Remove Accent off the Letter - 75 entries

Remove all the accent from extremely accented statements.

Compile C - 336 entries

You might have to get clever to do this one.

Another Mixed-Up Haiku - 148 entries

VimGolf ... a perfect evening?

Prime Numbers - 115 entries

List the first 100 prime numbers.

A Simple One - 524 entries

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

Round Round - 139 entries

Round Round

Table Reshuffle - 213 entries

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

Fix the Haiku - 160 entries

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

Indentation - 290 entries

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

Linear congruential generator - 74 entries

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

Hatsuyume - 271 entries

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

Context Insensitive completion 1 - 267 entries

Finish writing this simple Python HTTP server.

Turn this csv list into queries - 135 entries

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

Context insensitive completion 0 - 306 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.

Ruby 1.9 compat - 382 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!

Sorting paragraphs - 274 entries

Order the paragraphs correctly, per prefixed index

Python Hello World! Reformatting - 443 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.

Reformat some Python - 323 entries

Fix some very bizarrely laid-out code.

Reformat a C golf submission - 303 entries

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

Reverse characters in a line - 450 entries

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

PEP8 Python Wrapping Comments and Code - 113 entries

According to PEP8, long flowy text and code should have different max line lengths. Code: 79 characters max Long flowy text: 72 characters max

Search and Replace 0 - 1256 entries

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

Deleting folded text - 160 entries

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.

Get rid of html tags - 194 entries

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

Reformat most common surnames - 275 entries

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

Remember FizzBuzz? - 247 entries

Output FizzBuzz to 100. Start with nothing.

Change the content of a string - 564 entries

This docstring is a complete lie. Fix it.

Add fold markers to a .c file - 235 entries

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

Wrap the text of an email message to 79 characters - 275 entries

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

Reconstruct the Sentence - 524 entries

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

Sort and add attributes - 595 entries

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

Braces or Brackets? - 354 entries

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

Flodder-challenge - 356 entries

Replace the text the most efficient and win!

Whitespace, empty lines and tabs - 971 entries

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

Simple text editing with Vim - 2549 entries

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

Reformat/Refactor a Golfer Class - 1924 entries

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

Top VimGolf Ninjas - view leaderboard

T_e_normal
#1 - Tim Chase
@gumnos
Fepic_normal
#2 - Federico Galassi
@federicogalassi
Me-small_normal
#3 - Wei Dai
@clvv42
P1000007_normal
#4 - h_east
@h_east
Jlove201003sq_normal
#5 - Justin Love
@wondible

VimGolf Chatter