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

Simple, Practical, and Common - 33586 entries

Simple things we do all the time should be able to be done with very few keystrokes, but sometimes I find something I need to do makes me go, "There MUST be a better way." This challenge is just a simple movement and entering text at a certain place.

  • Best score: 22
  • Best player score: 25
  • Position: #3301 / 7409
  • Number of attempts: 2
One number per line - 18711 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 14
  • Position: #434 / 3858
  • Number of attempts: 7
vim = 22 / 7 - 475 entries

pi square vim

  • Best score: 20
  • Best player score: 27
  • Position: #82 / 135
  • Number of attempts: 2
Wrap the text of an email message to 79 characters - 753 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #185 / 406
  • Number of attempts: 1
Create Leading Zeros - 239 entries

Create leading zeros only for id columns. Please use generic approach!

  • Best score: 23
  • Best player score: 23
  • Position: #3 / 81
  • Number of attempts: 3
attr_aligner - 3498 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #10 / 696
  • Number of attempts: 5
Counting in binary - 524 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

  • Best score: 16
  • Best player score: 20
  • Position: #29 / 116
  • Number of attempts: 4
Letter case trickery - 1624 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: 13
  • Position: #368 / 517
  • Number of attempts: 2
quotes inside quotes - 3157 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
  • Position: #515 / 1076
  • Number of attempts: 1
Hanging Indent for Footnotes - 72 entries

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

  • Best score: 17
  • Best player score: 18
  • Position: #4 / 30
  • Number of attempts: 2
Top X - 212 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: 20
  • Position: #8 / 71
  • Number of attempts: 4
Sort the VimGolf challenges by popularity - 348 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: 15
  • Position: #14 / 107
  • Number of attempts: 2
Words in parens - 12928 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1216 / 3960
  • Number of attempts: 3
Pairs of numbers - 363 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

  • Best score: 26
  • Best player score: 27
  • Position: #17 / 136
  • Number of attempts: 2
Assign list - 192 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 40
  • Position: #31 / 61
  • Number of attempts: 4
paste indent correction - JS - 112 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: #24 / 59
  • Number of attempts: 1
Hole-in-one - 1018 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: 16
  • Position: #16 / 304
  • Number of attempts: 4
It's a factor - 104 entries

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

  • Best score: 24
  • Best player score: 41
  • Position: #15 / 38
  • Number of attempts: 2
Delete unwanted lines - 408 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #26 / 228
  • Number of attempts: 1
XML to JSON - 47 entries

Convert this xml file into json.

  • Best score: 75
  • Best player score: 126
  • Position: #9 / 20
  • Number of attempts: 3
Define to require - 127 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.

  • Best score: 62
  • Best player score: 62
  • Position: #7 / 50
  • Number of attempts: 5
REDRUM - 164 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: 14
  • Position: #13 / 64
  • Number of attempts: 2
Circle in a square - 152 entries

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

  • Best score: 23
  • Best player score: 23
  • Position: #4 / 54
  • Number of attempts: 5
Groups magic - 158 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: #44 / 93
  • Number of attempts: 1
Circle of Fifths with Sharps - 114 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
  • Position: #5 / 38
  • Number of attempts: 2
A simple change - 461 entries

Just change the numbers in the most efficient way ...

  • Best score: 12
  • Best player score: 12
  • Position: #15 / 191
  • Number of attempts: 2
SFD-ROC: The Quick Brown Fox - 193 entries

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

  • Best score: 24
  • Best player score: 28
  • Position: #69 / 106
  • Number of attempts: 1
The name of the game - 665 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #102 / 360
  • Number of attempts: 1
Stairs Indenting - 473 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 12
  • Position: #4 / 197
  • Number of attempts: 4
Saving the hashes(#) - 2053 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
  • Position: #277 / 479
  • Number of attempts: 3
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #35 / 445
  • Number of attempts: 3
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #7 / 754
  • Number of attempts: 3
Switch function arguments - 2123 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #62 / 658
  • Number of attempts: 3
Remove noise from HTTP log - 717 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: 15
  • Position: #62 / 273
  • Number of attempts: 2
switch variable - 5068 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #169 / 1747
  • Number of attempts: 3
The meaning - 574 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #190 / 362
  • Number of attempts: 1
Calculate the table totals - 146 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #6 / 45
  • Number of attempts: 3
Multiplication table. - 232 entries

Create a multiplication table.

  • Best score: 31
  • Best player score: 70
  • Position: #30 / 68
  • Number of attempts: 1
Line Zipper - 472 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #178 / 214
  • Number of attempts: 1
Compile C - 405 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 24
  • Position: #104 / 138
  • Number of attempts: 1
Change the content of a string - 1561 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #113 / 583
  • Number of attempts: 4
Reconstruct the Sentence - 1484 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: #83 / 408
  • Number of attempts: 4
Whitespace, empty lines and tabs - 3591 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #90 / 776
  • Number of attempts: 7
Simple text editing with Vim - 12712 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #158 / 3671
  • Number of attempts: 3
Reformat/Refactor a Golfer Class - 6901 entries

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

  • Best score: 28
  • Best player score: 32
  • Position: #56 / 1690
  • Number of attempts: 5
Ingo
Twitter:

entered into 45 challenges

contributed 0 challenges