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

Wrap the text of an email message to 79 characters - 679 entries

You're replying to an email with silly long lines. Clean them up.

  • Best score: 5
  • Best player score: 5
  • Position: #183 / 386
  • Number of attempts: 1
Search and Replace 0 - 4790 entries

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

  • Best score: 12
  • Best player score: 16
  • Position: #1130 / 1585
  • Number of attempts: 2
Interweave two blocks of text - 631 entries

Suppose you've got data on a list of things from multiple sources. They're all in separate chunks, so how might you create a tabular output?

  • Best score: 15
  • Best player score: 17
  • Position: #121 / 211
  • Number of attempts: 3
Python Hello World! Reformatting - 938 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: 43
  • Position: #156 / 364
  • Number of attempts: 1
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 12
  • Position: #197 / 249
  • Number of attempts: 5
VimGolfNight - 536 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 13
  • Position: #298 / 343
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 10624 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #280 / 3666
  • Number of attempts: 3
Hanging Indent for Footnotes - 69 entries

Format this footnote (in kramdown syntax) so that it has hanging indent.

  • Best score: 17
  • Best player score: 21
  • Position: #11 / 28
  • Number of attempts: 2
Top X - 191 entries

The End File is the Top 10 Vimgolf Leaderboard at June 29, 2013. This is a second version, with a great contribution of @udioica. X is ten in Roman,a numeric system in ancient Rome

  • Best score: 18
  • Best player score: 24
  • Position: #20 / 69
  • Number of attempts: 1
Words in parens - 12854 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 23
  • Position: #3612 / 3945
  • Number of attempts: 2
Assign list - 169 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 31
  • Position: #5 / 59
  • Number of attempts: 5
paste indent correction - JS - 102 entries

You copy some javascript code from a website and paste it into vim, it does not look good!

  • Best score: 16
  • Best player score: 16
  • Position: #22 / 57
  • Number of attempts: 3
Delete unwanted lines - 396 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 11
  • Position: #203 / 225
  • Number of attempts: 1
Word frequency alignment - 273 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...

  • Best score: 5
  • Best player score: 5
  • Position: #67 / 156
  • Number of attempts: 2
XML to JSON - 44 entries

Convert this xml file into json.

  • Best score: 75
  • Best player score: 99
  • Position: #7 / 17
  • Number of attempts: 4
REDRUM - 150 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.

  • Best score: 14
  • Best player score: 18
  • Position: #40 / 62
  • Number of attempts: 3
Enumerate words - 250 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 27
  • Position: #60 / 89
  • Number of attempts: 2
Execute immediate SQL - 85 entries

Sql string tranformation ...

  • Best score: 60
  • Best player score: 70
  • Position: #11 / 30
  • Number of attempts: 2
Groups magic - 150 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: 14
  • Position: #40 / 90
  • Number of attempts: 1
Refactor arguments into object argument - 161 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 71
  • Position: #40 / 65
  • Number of attempts: 1
Readable Rubyhash - 244 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: 23
  • Best player score: 30
  • Position: #68 / 92
  • Number of attempts: 1
Dehamlizing - 180 entries

Change this piece of HAML code back into erb

  • Best score: 32
  • Best player score: 43
  • Position: #45 / 69
  • Number of attempts: 1
Checkerboard case pattern - 148 entries

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

  • Best score: 15
  • Best player score: 27
  • Position: #56 / 58
  • Number of attempts: 1
NATO phonetic alphabet - 501 entries

Transform the series of words into a list.

  • Best score: 19
  • Best player score: 24
  • Position: #151 / 191
  • Number of attempts: 3
The Quick Brown Fox Jumps Over The Lazy Vim - 401 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: 8
  • Best player score: 11
  • Position: #119 / 188
  • Number of attempts: 1
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #110 / 356
  • Number of attempts: 1
SFD-ROC: vimvimvim - 1581 entries

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

  • Best score: 8
  • Best player score: 15
  • Position: #395 / 439
  • Number of attempts: 2
Stairs Indenting - 448 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 15
  • Position: #143 / 193
  • Number of attempts: 3
Saving the hashes(#) - 1992 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
  • Position: #145 / 473
  • Number of attempts: 6
you're stuck on jQuery < 1.7 - 337 entries

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

  • Best score: 25
  • Best player score: 29
  • Position: #55 / 111
  • Number of attempts: 4
Vertical Limit - 2437 entries

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

  • Best score: 21
  • Best player score: 28
  • Position: #558 / 736
  • Number of attempts: 1
replacing each line of a block selection - 2946 entries

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

  • Best score: 18
  • Best player score: 32
  • Position: #687 / 767
  • Number of attempts: 1
Switch function arguments - 2078 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Position: #233 / 651
  • Number of attempts: 4
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 13
  • Position: #302 / 403
  • Number of attempts: 1
Reverse and double space - 489 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 19
  • Position: #172 / 194
  • Number of attempts: 1
Remove noise from HTTP log - 695 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: 16
  • Position: #164 / 270
  • Number of attempts: 4
Ugly spreadsheet copy/paste to CSV - 973 entries

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

  • Best score: 19
  • Best player score: 24
  • Position: #72 / 185
  • Number of attempts: 6
Replacing some words - 419 entries

How fast could it be?

  • Best score: 17
  • Best player score: 20
  • Position: #62 / 148
  • Number of attempts: 2
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 19
  • Position: #552 / 640
  • Number of attempts: 1
Line Zipper - 450 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #175 / 210
  • Number of attempts: 1
remove dupes from array - 1336 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: 27
  • Position: #270 / 331
  • Number of attempts: 2
PHP <--> Java class conversion Part 2 - 96 entries

Same class but reverse!

  • Best score: 80
  • Best player score: 106
  • Position: #15 / 38
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 507 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
  • Position: #60 / 148
  • Number of attempts: 4
imports alignment (python) - 661 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 23
  • Position: #112 / 194
  • Number of attempts: 1
HTML to Haml - 842 entries

Help convert this HTML page to Haml.

  • Best score: 23
  • Best player score: 30
  • Position: #51 / 202
  • Number of attempts: 7
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 19
  • Position: #235 / 639
  • Number of attempts: 7
Ruby 1.9 hashes - 1221 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: 18
  • Position: #338 / 401
  • Number of attempts: 2
Assignment Alignment - 832 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 26
  • Position: #123 / 215
  • Number of attempts: 1
Shebangs for all - 1912 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: 16
  • Position: #302 / 500
  • Number of attempts: 2
Reverse and count - 456 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: 24
  • Position: #72 / 172
  • Number of attempts: 3
Ruby 1.9 compat - 610 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: 21
  • Position: #206 / 230
  • Number of attempts: 1
Reverse Simple Deletion - 832 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #270 / 454
  • Number of attempts: 3
Sorting paragraphs - 505 entries

Order the paragraphs correctly, per prefixed index

  • Best score: 18
  • Best player score: 38
  • Position: #113 / 156
  • Number of attempts: 1
Turn this csv list into queries - 204 entries

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

  • Best score: 98
  • Best player score: 105
  • Position: #17 / 95
  • Number of attempts: 2
Context insensitive completion 0 - 502 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: 8
  • Position: #129 / 231
  • Number of attempts: 3
Context Insensitive completion 1 - 459 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #105 / 232
  • Number of attempts: 1
Make Fancy Header - 1014 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 22
  • Position: #265 / 338
  • Number of attempts: 1
Reverse characters in a line - 709 entries

You have everything you need, just not in the right order. Mastermind would give you 26 white pegs.

  • Best score: 12
  • Best player score: 14
  • Position: #90 / 249
  • Number of attempts: 1
Get rid of html tags - 368 entries

Want to read more about Vim's background? Then get rid of those html tags...

  • Best score: 15
  • Best player score: 17
  • Position: #85 / 217
  • Number of attempts: 3
Change the content of a string - 1474 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 27
  • Position: #438 / 557
  • Number of attempts: 1
Sort and add attributes - 1327 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #157 / 529
  • Number of attempts: 5
Reconstruct the Sentence - 1363 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: 20
  • Position: #81 / 383
  • Number of attempts: 10
Whitespace, empty lines and tabs - 3332 entries

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

  • Best score: 16
  • Best player score: 30
  • Position: #498 / 736
  • Number of attempts: 1
Simple text editing with Vim - 12280 entries

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

  • Best score: 13
  • Best player score: 15
  • Position: #1970 / 3579
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6555 entries

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

  • Best score: 32
  • Best player score: 41
  • Position: #850 / 1613
  • Number of attempts: 1
Woojung Kim 김우중
Twitter:

entered into 65 challenges

contributed 0 challenges