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]

21586 active golfers, 220883 entries, 385 challenges

Open VimGolf challenges

Aligning function arguments to match a specific coding style - 151 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.

constructor - 161 entries

coding a constructor for a simple class

Winding path - 91 entries

It's a maze, but the bad paths have been blocked off. Mark the correct path.

Cartesian product - 183 entries

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

sort python functions and methods alphabetically - 13 entries

* sort functions in the python file alphabetically * sort functions within a Class alphabetically * sort Classes alphabetically

Complete the hex array data - 174 entries

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

Groups magic - 133 entries

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

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

Turn this csv list into queries - 180 entries

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

Piphilology - 102 entries

Piphilology comprises the creation and use of mnemonic techniques to remember a span of digits of the mathematical constant π.

SFD-ROC: The Quick Brown Fox - 137 entries

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

Multiplication table. - 168 entries

Create a multiplication table.

Separating firstname & lastname - 80 entries

Seperate named with equal tabs.

REDRUM - 129 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.

Inconsistent real estate paste - 140 entries

Format a hand-typed real estate listing that uses inconsistent punctuation into four sections

Entries sort - 69 entries

It cames to my mind a weird idea : sorting parts of my .vimrc. Take few minutes to sort out this, it's easy !

Double and switch - 35 entries

Aaaanother case switcher

Circle in a square - 120 entries

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

Create a pandoc compatible table - 132 entries

In [this vimcast][1], a featured gist from Tim Pope shows how to quickly make a simple table structure. How fast can you convert it to pandoc's markdown style? [1]:

Almost encrypted - 162 entries

Convert the first paragraph to be even less readable.

Convert pandoc unordered list to a numbered list - 128 entries

I know it's possible to use #. in pandoc to auto-generate numbered lists, but then it's not easy to tell how many items there are when reading it in Markdown. How fast can you make the switch?

Unwrap the text of an email message - 119 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?

Fill visual area - 70 entries

Just have fun!

Draw the Go board - 108 entries

which is a 19×19 lines board. Here we use ascii characters only for simplicity. See diff file to get a sense. (See also

Solve the Sokoban - 158 entries

A wink for all Vimgolfers that play Nethack too.

Refactoring useless Method away - 74 entries

Real-life challenge, convert a bunch of ifs to a switch statement

Define to require - 113 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.

mp3 - Cutlist - 12 entries

An audio CD was accidentally ripped into one single mp3 file. A dummy cue-file now needs to be filled out with the correct values to get single mp3 files.

SFD-ROC: Tic-Tac-Toe - 116 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.

Write Setters and Getters for PHP - 86 entries

Just simple automation of writing Setters and Getters like Doctrine might use.

PEP8 Python Wrapping Comments and Code - 148 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

O Christmas Tree - 88 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

Rail fence transposition cipher - 63 entries

Solve a rail fence transposition cipher using vim. This ciphertext was created using two rails. Use vim to transpose the text and recover the original quote.

Checkerboard case pattern - 106 entries

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

CSV to JSON - 141 entries

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

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

Changing URL path in CSS - 111 entries

What's the quickest way to swap out all the URLs in a CSS file? Is it wasted keystrokes using look-behinds and look-aheads? (I'm sorry for the delete/report--I made a mistake with the last one requiring an ugly search for graphic to replace with images. I just intended this to be a simple search and replace that might possibly generate some macros or normals solutions that are quicker)

Land of the Lost - 60 entries

Enter the tabs below the lyrics

Extract text from xml - 101 entries

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

Sudoku table - 50 entries

Make this simple sudoku table look nice and legible.

Comparing scores - 68 entries

If Alice and Bob both did the challenge, put their entries together in the top paragraph, so we can compare their scores more easily.

TAR archive pretty print - 10 entries

Will you use isk ?

Lenny Spiral - 8 entries

Make one lenny into an infinite army of lennys.

Calculate the table totals - 105 entries

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

Happy New Year! - 129 entries

This is a simple new year's challenge.

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

Printable ASCII characters - 95 entries

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

Replace Parameter with Explicit Methods - 61 entries

Implementing the methods of a Java Interface

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

Ninjas Leaderboard - 79 entries

The two lines in "Start file" has an obfuscated email address. Second line give an index (from 1 to 30) to the chars list of the first line, for example, the first char of email (n) is in position 25, second char (i) is in position 19 and s.o.

VimGolf Chatter