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

constructor - 161 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 70
  • Number of attempts: 7
It's a factor - 75 entries

Flaunt your macro prowess by factoring some numbers. Too hard? It takes less than 30 strokes, I promise.

  • Best score: 25
  • Best player score: 63
  • Number of attempts: 3
Five Pillars - 43 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

  • Best score: 41
  • Best player score: 56
  • Number of attempts: 2
Sort and add attributes - 1059 entries

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

  • Best score: 18
  • Best player score: 33
  • Number of attempts: 2
Alphabetize the directory - 252 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 32
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 5389 entries

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

  • Best score: 32
  • Best player score: 32
  • Number of attempts: 7
Flodder-challenge - 804 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 30
  • Number of attempts: 5
Enumerate words - 219 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 3
PHP Array Syntax -> MailChimp Merge Syntax - 408 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!

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 2
Braces or Brackets? - 625 entries

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

  • Best score: 34
  • Best player score: 36
  • Number of attempts: 4
Suffix sort - 163 entries

Sort from the end of the line, as if the letters in each line were reversed.

  • Best score: 19
  • Best player score: 25
  • Number of attempts: 4
Saving the hashes(#) - 1688 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: 25
  • Number of attempts: 4
Vim tetris - 314 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Number of attempts: 4
O Christmas Tree - 99 entries

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

  • Best score: 22
  • Best player score: 23
  • Number of attempts: 4
Going underground.... - 277 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 29
  • Number of attempts: 3
Ugly spreadsheet copy/paste to CSV - 696 entries

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

  • Best score: 19
  • Best player score: 29
  • Number of attempts: 4
Subtraction - 147 entries

Solve the equations.

  • Best score: 18
  • Best player score: 24
  • Number of attempts: 2
Shuffle and Sort - 171 entries

The values where sorted incorrectly. Get them back to how they are supposed to be

  • Best score: 17
  • Best player score: 22
  • Number of attempts: 4
Simple text editing with Vim - 10126 entries

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

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 4
Vice versa - 5605 entries

Little role switching.

  • Best score: 2
  • Best player score: 13
  • Number of attempts: 4
Make it more readable - 1719 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 3
Circle of Fifths with Sharps - 61 entries

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

  • Best score: 24
  • Best player score: 24
  • Number of attempts: 4
remove dupes from array - 1179 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: 20
  • Number of attempts: 6
switch variable - 4189 entries

how fast can you switch two variable ?

  • Best score: 3
  • Best player score: 11
  • Number of attempts: 3
Shebangs for all - 1568 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: 13
  • Number of attempts: 3
Carriage return - 41 entries

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 2
Reconstruct the Sentence - 1010 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: 1
Hole-in-one - 935 entries

Lets take this golf thing literally.. Drive off the tee into the hole, and of course you don't strike the ball completely clean.

  • Best score: 15
  • Best player score: 17
  • Number of attempts: 6
Lookahead and Lookbehind - 62 entries

Look everywhere

  • Best score: 16
  • Best player score: 20
  • Number of attempts: 3
Letter case trickery - 1416 entries

This file is in a downright esoteric format, consisting of hexadecimal numbers, non-hexadecimal keywords, and "Z" indicating end-of-line. Make the hexadecimal numbers lowercase.

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 5
Search and Replace 0 - 3921 entries

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

  • Best score: 12
  • Best player score: 13
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 9275 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
A Simple One - 828 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: 1
Words in parens - 10618 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 7
quotes inside quotes - 2684 entries

taken from tip 85 of the very good book 'Practical Vim: Edit Text at the Speed of Thought' ! I'd be interested what people use :)

  • Best score: 2
  • Best player score: 14
  • Number of attempts: 5
Reverse Simple Deletion - 698 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Sort the VimGolf challenges by popularity - 250 entries

"Sort by popularity" is a good order to play the challenges. Not perfect, but you could do a lot worse. ;) Input is a sample copy-pasted from vimgolf.com. Some of the challenge names have digits that will get in your way, so read ":help :sort" for hints on sorting with a regex. When you're done, try your solution on the full list!

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 5
replacing each line of a block selection - 2440 entries

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

  • Best score: 17
  • Best player score: 18
  • Number of attempts: 5
Sort entries based on date - 296 entries

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

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Whitespace, empty lines and tabs - 2518 entries

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

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 7
Replacing some words - 402 entries

How fast could it be?

  • Best score: 2
  • Best player score: 19
  • Number of attempts: 3
attr_aligner - 2847 entries

Two attr keywords. Two separate indentations. Align the colons.

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 8
One number per line - 11369 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Number of attempts: 4

Contributed Challenges

Five Pillars - 43 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

oliver mueller
Twitter:

Programmer - mostly working with embedded systems in C++. Interested in Rust, Ruby and Haskell. Blog at http://t.co/QDcTy760Z

entered into 43 challenges

contributed 1 challenges