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]

44656 active golfers, 505575 entries, 619 challenges

Open VimGolf challenges

Chinese Multiplication Table - 86 entries

Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.

LaTeX to XML Math Delimiters - 63 entries

Vim is amazing when used to edit MediaWiki text, but typing "<math> . . . </math>" can be tiresome and frustrating if formulas are used often. LaTeX delimiters are so concise and even come in two flavors: "\( . . . \)" for inline math and "\[ . . . \]" for centered formulas. The goal is to perform the following conversions: "\( . . . \)" becomes "<math>. . .</math>" "\[ . . . \]" becomes "<center><math>. . .</math></center>"

Define to require - 139 entries

When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.

Minimalist Limerick - 532 entries

Reproduce this lovely poem.

Saving the hashes(#) - 2115 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.

Word frequency alignment - 307 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...

Circle in a square - 180 entries

Probably looks more like "Egg in a rectangle" in most fonts, but it's actually 23x23.

Execute immediate SQL - 107 entries

Sql string tranformation ...

Prefixes and suffixes - 664 entries

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

Coordinates placeholder - 87 entries

Place coordinates instead of target search.

XML to JSON - 49 entries

Convert this xml file into json.

Change your calendar - 421 entries

Happy New Year!

Greek Letters - 80 entries

Starting with a list of Greek letters, create a cross-reference table showing all of the Greek alpha-beta. You'll likely need to use digraphs (:help digraphs). Note that while most digraphs can be entered with either character first, lowercase sigma has two digraphs -- s* AND *s! Good luck!

Transposition - 109 entries

Transpose the original lines in separate columns, one for each line.

REDRUM - 190 entries

If you remember "The Shinning", the first time you saw the bloody word REDRUM you probably thinked "What the Hell is that?" Well, then you know that you need a little help from a looking-glass to make sense of it. Now it's time to use vim like a mirror to reveal the message.

Enumerate words - 272 entries

Enumerate the unique words in order.

Swap assigned value - 681 entries

Simple problem but looking for interesting solutions.

Groups magic - 168 entries

Regexp or macros for string converting: (a) -> ___ (abc) -> ____ (abcd) -> ______ All in the '(' replace to _ multiply by char count + ()

Block Fun 1 - 225 entries

Manipulate the columns to produce desired result.

fib.c cleanup - 79 entries

cleanup the file

Harder than "abcd > a b c d" - 111 entries

Not as easy as the last challenge. This time, just one space between a and b, up to 25 spaces between y and z. (Removed some lines; diff was too long.)

abcd > a b c d - 300 entries

transform the single spaces into 4 spaces repeat for each line

lamb had a little Mary - 655 entries

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

Python: Lots of function arguments - 128 entries

The function definition is too long for one line. The modeline helps you with some typical Python indent settings.

Checkerboard case pattern - 173 entries

All the squares are white. Make some of them black. But only the right ones.

Readable Rubyhash - 285 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!

Chucking wood - 149 entries

An exercise in compressing repetitive text. For this challenge, any entry that uses keys outside the main row (such as arrow keys, Home, End, Delete, etc.) will be removed. (Esc is OK, though you should be using C-[ anyway.)

Flip the chessboard - 115 entries

White's turn is over. Flip the board to black's perspective. I added coordinates to frustrate you.

Extract text from xml - 150 entries

Extract text from xml file (ignoring commented out elements) and create a one line regex.

Printable ASCII characters - 161 entries

From a blank input, print all 95 printing ASCII characters one per line, from space to tilde.

A simple change - 481 entries

Just change the numbers in the most efficient way ...

Let's play some Ivmgolf - 1153 entries

Oops, I spelled that wrong.

Unwrap the text of an email message - 202 entries

Reverse of "Wrap the text of an email message to 79 characters". gq and gw are great for wrapping paragraphs. But sometimes other programs choke on your wrapped lines. What's the best way to un-gq?

Sort by your own sum - 97 entries

Same numbers as last time, but you'll have to add them yourself.

Sort by sum of numbers in a line(?) - 71 entries

The lines with the biggest sums need to be at the top. The sums are on the right, which makes life hard. Maybe you can find a feature that will do all the work for you...

Presidential Sorting - 60 entries

Given a nice CSV formatted arrangement of the Presidents of the United States, we need to print out an alphabetical list in pretty columns. Prove that vim can conquer this basic Excel task!

Add links to an existing HTML table - 112 entries

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

Stairs Indenting - 483 entries

Indent each line with <line number> whitespaces.

Python to Ruby - 214 entries

Convert this Python code to Ruby. NOTE: This program likely won't run.

you're stuck on jQuery < 1.7 - 378 entries

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

SFD-ROC: ROT13 Phonics - 112 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.

SFD-ROC: vimvimvim - 1641 entries

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

SFD-ROC: ASCII Logo Border - 98 entries

Draw a border around this familiar logo ;)

SFD-ROC: Pipe Dreams - 123 entries

Move the pipes so they match the output.

SFD-ROC: Tic-Tac-Toe - 174 entries

Tic-Tac-Toe You are 'X', and it is your turn. Stop 'O' from winning, and complete the game. Draw a diagonal line through your winning row of three X's.

SFD-ROC: The Quick Brown Fox - 212 entries

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

Enharmonic Equivalents - 67 entries

Transform # and b to digraphs

Circle of Fifths with Sharps - 133 entries

Display a list of the Circle of Fifths with corresponding solfege syllables with sharps. Handling spaces may be tricky.

The name of the game - 682 entries

End up with the name of the game.

NATO phonetic alphabet - 547 entries

Transform the series of words into a list.

VimGolf Chatter