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]

39587 active golfers, 470522 entries, 603 challenges

Open VimGolf challenges

Switch function arguments - 2136 entries

How to switch two arguments of a function.

Calculate the table totals - 146 entries

Go ahead... commit the treachery of using vim as a spreadsheet.

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.

Remove semicolons after expressions - 654 entries

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

Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

Format the output - 146 entries

Sometimes your standard out is a little hard to read. Take this multilevel hash and make it human readable.

Exchanging Quotes - 858 entries

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

Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

The meaning - 575 entries

Numbers are fun!

un-C-escape string - 58 entries

Convert escape sequences to characters

replacing each line of a block selection - 2999 entries

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

Ugly spreadsheet copy/paste to CSV - 1009 entries

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

constructor - 182 entries

coding a constructor for a simple class

switch variable - 5071 entries

how fast can you switch two variable ?

Replacing some words - 428 entries

How fast could it be?

Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

remove dupes from array - 1358 entries

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

Sort entries based on date - 392 entries

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

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!

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

Alphabetize the directory - 298 entries

Put the contacts and their information in alphabetical order.

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

Same class but reverse!

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

Convert this tiny php class to adequate java one.

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.

Multiplication table. - 232 entries

Create a multiplication table.

Line Zipper - 473 entries

Zip/pair related lines.

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

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

Interweave two blocks of text - 659 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 - 197 entries

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

Case preserving word replacement - 454 entries

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

Sort the cardinal numbers - 310 entries

Maybe a simple challenge.

Numbering a List - 1931 entries

Pretty simple, number the list.

Recursively Palindrome - 267 entries

Note that there are 2^6-1 characters.

Java Array2List - 233 entries

Convert an java array initializer into a list.

imports alignment (python) - 700 entries

Align as one import per line.

expand a list comprehension (python) - 333 entries

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

HTML to Haml - 878 entries

Help convert this HTML page to Haml.

Rotating Philosophers Problem - 410 entries

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

Overall Vimgolf Rank - 216 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.

Assignment Alignment - 883 entries

line up the operators. Use spaces, not tabs.

Before there was Farmville... - 101 entries

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

The Universal Declaration of Human Rights, Article 1 - 163 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.)

Reformat long lines - 358 entries

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

Generate English Alphabets - 487 entries

Start with a, get up to z.

Here, piggy, piggy... - 80 entries

Youay owknay atwhay otay oday...

Word Blender - 148 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! - 145 entries

This is a simple new year's challenge.

Insert a Markdown link - 434 entries

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

It'ss tooo coold too typpe todaay - 222 entries

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

Getters & Setters: Java - 207 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...

VimGolf Chatter