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]

Played Challenges

82 bottles of beer on the wall - 261 entries

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

  • Best score: 107
  • Best player score: 122
  • Number of attempts: 3
Overall Vimgolf Rank - 132 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.

  • Best score: 23
  • Best player score: 74
  • Number of attempts: 2
Fix the Haiku - 247 entries

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

  • Best score: 28
  • Best player score: 49
  • Number of attempts: 2
Assignment Alignment - 703 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 20
  • Number of attempts: 4
Context Insensitive completion 1 - 395 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 19
  • Number of attempts: 2
Context insensitive completion 0 - 445 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.

  • Best score: 6
  • Best player score: 7
  • Number of attempts: 3
Ruby 1.9 hashes - 1086 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!

  • Best score: 12
  • Best player score: 16
  • Number of attempts: 3
Numbering a List - 1752 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 4
imports alignment (python) - 577 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 30
  • Number of attempts: 1
Cartesian product - 201 entries

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

  • Best score: 24
  • Best player score: 47
  • Number of attempts: 1
Make Fancy Header - 921 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 3
Flodder-challenge - 814 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 37
  • Number of attempts: 3
Sorting paragraphs - 443 entries

Order the paragraphs correctly, per prefixed index

  • Best score: 18
  • Best player score: 38
  • Number of attempts: 2
Groups magic - 136 entries

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

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 1
Table Reshuffle - 325 entries

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

  • Best score: 22
  • Best player score: 46
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 5569 entries

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

  • Best score: 32
  • Best player score: 37
  • Number of attempts: 3
SFD-ROC: vimvimvim - 1305 entries

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

  • Best score: 8
  • Best player score: 9
  • Number of attempts: 4
abcd > a b c d - 241 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 1
A Simple One - 849 entries

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

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 2
Words in parens - 11368 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 5
Reverse and count - 379 entries

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

  • Best score: 18
  • Best player score: 43
  • Number of attempts: 2
Swap assigned value - 499 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 4
Increment, increment, increment.... - 493 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 1
Simple text editing with Vim - 10668 entries

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

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 8
Hatsuyume - 365 entries

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

  • Best score: 16
  • Best player score: 30
  • Number of attempts: 1
The Cake is a Lie - 1139 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 12
  • Number of attempts: 1
lamb had a little Mary - 499 entries

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

  • Best score: 16
  • Best player score: 66
  • Number of attempts: 1
Reverse Simple Deletion - 721 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
switch variable - 4443 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 4
Almost encrypted - 165 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 5
Reconstruct the Sentence - 1028 entries

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

  • Best score: 20
  • Best player score: 21
  • Number of attempts: 7
Deleting folded text - 274 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.

  • Best score: 17
  • Best player score: 21
  • Number of attempts: 3
Compile C - 279 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 21
  • Number of attempts: 3
Shebangs for all - 1632 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.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 11
Complete the hex array data (Part II) - 129 entries

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

  • Best score: 20
  • Best player score: 26
  • Number of attempts: 3
Line Zipper - 397 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Number of attempts: 1
Python Hello World! Reformatting - 837 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.

  • Best score: 39
  • Best player score: 44
  • Number of attempts: 2
Aligning function arguments to match a specific coding style - 159 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.

  • Best score: 16
  • Best player score: 28
  • Number of attempts: 5
Saving the hashes(#) - 1806 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.

  • Best score: 20
  • Best player score: 28
  • Number of attempts: 8
remove dupes from array - 1220 entries

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

  • Best score: 17
  • Best player score: 28
  • Number of attempts: 1
Switch function arguments - 1852 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Number of attempts: 3
Vertical Limit - 2167 entries

transform a succession of one word lines to a an array of strings

  • Best score: 21
  • Best player score: 29
  • Number of attempts: 3
Reformat some Python - 511 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 45
  • Number of attempts: 1
Sort and add attributes - 1099 entries

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

  • Best score: 33
  • Best player score: 33
  • Number of attempts: 4
Rotating Philosophers Problem - 358 entries

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

  • Best score: 29
  • Best player score: 33
  • Number of attempts: 1
Ruby 1.9 compat - 557 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!

  • Best score: 14
  • Best player score: 18
  • Number of attempts: 1
vim = 22 / 7 - 398 entries

pi square vim

  • Best score: 20
  • Best player score: 33
  • Number of attempts: 3
Case preserving word replacement - 392 entries

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

  • Best score: 19
  • Best player score: 35
  • Number of attempts: 1
HTML to Haml - 731 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 39
  • Number of attempts: 2
Change the content of a string - 1250 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 27
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 731 entries

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

  • Best score: 19
  • Best player score: 42
  • Number of attempts: 2
Toto l'haricot
Twitter:

entered into 51 challenges

contributed 0 challenges