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

V to the i - 4385 entries

Input is 99 V's. Output is 100 i's.

  • Best score: 7
  • Best player score: 8
  • Number of attempts: 2
Condensed Cases - 729 entries

Apple's new programming language, Swift, allows two style of case statements: 1) one Enum case on each line, or 2) multiple Enum cases on a single line. Convert the following from the first case (no pun intended) to the second type.

  • Best score: 12
  • Best player score: 15
  • Number of attempts: 2
Sort the VimGolf challenges by popularity - 309 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: 17
  • Number of attempts: 1
Remove noise from HTTP log - 624 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 17
  • Number of attempts: 2
Words in parens - 12094 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 2
Hatsuyume - 368 entries

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

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 2
Ruby 1.9 compat - 565 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: 16
  • Number of attempts: 3
lamb had a little Mary - 535 entries

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

  • Best score: 16
  • Best player score: 40
  • Number of attempts: 1
Shebangs for all - 1669 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: 18
  • Number of attempts: 2
I forgot quotes - 14515 entries

Oops.

  • Best score: 10
  • Best player score: 16
  • Number of attempts: 3
The Cake is a Lie - 1166 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Swap assigned value - 518 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 13
  • Number of attempts: 2
Gray area - 669 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 14
  • Number of attempts: 3
abcd > a b c d - 248 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 1
vim1001 - 244 entries

change number 1001 into a "vim1001 sequence". (My first challenge, hope it is not too bad... )

  • Best score: 17
  • Best player score: 23
  • Number of attempts: 2
Minimalist Limerick - 494 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 38
  • Number of attempts: 1
Search and Replace 0 - 4446 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 5
quotes inside quotes - 2946 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: 14
  • Best player score: 16
  • Number of attempts: 2
-a-b-c- - 2906 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 15
  • Number of attempts: 1
Pretty format for variable declarations - 129 entries

Project standards demand the equal signs must be aligned for better readability.

  • Best score: 14
  • Best player score: 15
  • Number of attempts: 3
Basic renumbering - 5167 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 19
  • Number of attempts: 2
Simple text editing with Vim - 11067 entries

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

  • Best score: 13
  • Best player score: 21
  • Number of attempts: 1
Context insensitive completion 0 - 457 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: 9
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1381 entries

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

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 4
NATO phonetic alphabet - 413 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 20
  • Number of attempts: 3
The holy-grail may help - 302 entries

Can you find it in less than 20 strokes, Arthur?

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 2
switch variable - 4666 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 2
Test everything! - 113 entries

... and build the desired input data structure. Transform a list of values into a non-trivial format.

  • Best score: 22
  • Best player score: 26
  • Number of attempts: 4
The name of the game - 596 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 2
Saving the hashes(#) - 1876 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: 31
  • Number of attempts: 1
Ruby 1.9 hashes - 1111 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: 14
  • Number of attempts: 4
Do you demand a shrubbery? - 1042 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 18
  • Number of attempts: 2
The Quick Brown Fox Jumps Over The Lazy Vim - 339 entries

Someone has vandalized this text file and replaced the beginning character of one word in each line with a Big "X." Please remove the big X's, and fix each line to read "The Quick Brown Fox Jumps Over The Lazy Dog."

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 2
Dehamlizing - 155 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 38
  • Number of attempts: 2
Let's play some Ivmgolf - 975 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
Line Zipper - 402 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 14
  • Number of attempts: 2
Vertical Limit - 2243 entries

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

  • Best score: 21
  • Best player score: 28
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 10151 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 9
Shuffle puzzle - 302 entries

Sort the lines in each indent group, and sort the groups. That's the pattern. Or just move lines around manually to get a better score.

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 3
PHP Array Syntax -> MailChimp Merge Syntax - 440 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: 27
  • Number of attempts: 3
Matt Robbins
Twitter:

Lover of unfashionable music and fashionable programming languages...former BBC Frameworker and a very happy Dad!

entered into 40 challenges

contributed 0 challenges