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 - 235 entries

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

  • Best score: 107
  • Best player score: 120
  • Number of attempts: 1
Winding path - 91 entries

It's a maze, but the bad paths have been blocked off. Mark the correct path.

  • Best score: 27
  • Best player score: 46
  • Number of attempts: 1
Python Hello World! Reformatting - 812 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
  • Number of attempts: 1
Basic renumbering - 4076 entries

Renumbering Basic.

  • Best score: 2
  • Best player score: 15
  • Number of attempts: 2
Gray area - 602 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
quotes inside quotes - 2632 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
Shift down - 162 entries

Number words are back.

  • Best score: 19
  • Best player score: 19
  • Number of attempts: 4
Make it more readable - 1703 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 5
Simple text editing with Vim - 9868 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 2
-a-b-c- - 2325 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 2
NBCU Weekly Challenge - Test - 214 entries

Just testing.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
Happy TvvO - 339 entries

Don’t forget the past, learn from it. Happy New Year.

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 1
Enharmonic Equivalents - 52 entries

Transform # and b to digraphs

  • Best score: 18
  • Best player score: 22
  • Number of attempts: 2
Extract argument from function - 1791 entries

The aim is to see if you can do some refactoring very fast.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 4
Don't know what this is - 1571 entries

Replace contents of brackets with matching number of spaces. Don't ask what the format's supposed to be.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 3
VimGolfNight - 447 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 1
Prefixes and suffixes - 464 entries

Generate all prefixes of "vimchallenge", then all suffixes.

  • Best score: 17
  • Best player score: 23
  • Number of attempts: 4
Reverse Simple Deletion - 692 entries

You did the simple deletion, now reverse it.

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

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

  • Best score: 16
  • Best player score: 35
  • Number of attempts: 4
That hyphen - 1841 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Number of attempts: 2
A Simple One - 806 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
Almost encrypted - 164 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Condensed Cases - 656 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: 14
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 140 entries

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

  • Best score: 25
  • Best player score: 28
  • Number of attempts: 1
Words in parens - 10287 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 3
Saving the hashes(#) - 1666 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: 29
  • Number of attempts: 2
Reverse and double space - 401 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 16
  • Number of attempts: 3
SFD-ROC: ROT13 Phonics - 70 entries

A is for apple, b is for ball, etc... This familiar phonics poem has been rotated 13 characters. Make the letter match the word.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 1
Increment, increment, increment.... - 465 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Number of attempts: 1
Count both ways - 846 entries

Right AND down.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 2
Where should I put the Newline? - 781 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
Append semicolon after expressions - 821 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 3
switch variable - 4069 entries

how fast can you switch two variable ?

  • Best score: 3
  • Best player score: 11
  • Number of attempts: 4
Wrap the text of an email message to 79 characters - 472 entries

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

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Hanging Indent for Footnotes - 57 entries

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

  • Best score: 17
  • Best player score: 29
  • Number of attempts: 2
The Cake is a Lie - 1099 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 3
Hatsuyume - 360 entries

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

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 2
Switch function arguments - 1771 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Reverse characters in a line - 547 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: 18
  • Number of attempts: 4
Vertical Limit - 1995 entries

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

  • Best score: 21
  • Best player score: 23
  • Number of attempts: 5
A simple change - 350 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 3
Complete the hex array data - 174 entries

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

  • Best score: 23
  • Best player score: 27
  • Number of attempts: 1
Word frequency alignment - 195 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
  • Number of attempts: 1
Remove semicolons after expressions - 425 entries

A follow-up for http://vimgolf.com/challenges/4fc9d767d3a0d4000100000e.

  • Best score: 6
  • Best player score: 6
  • Number of attempts: 4
Let's play some Ivmgolf - 856 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 3
you're stuck on jQuery < 1.7 - 314 entries

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

  • Best score: 25
  • Best player score: 28
  • Number of attempts: 3
The meaning - 487 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Do you demand a shrubbery? - 963 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 5
Change name of a variable - 143 entries

Replace the name of the $variable with the fastest move possible. The challenge is having a command that allow you to easily change the variable name even if its indented.

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
REDRUM - 131 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
  • Number of attempts: 2
Groups magic - 134 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
  • Number of attempts: 2
Context insensitive completion 0 - 440 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: 7
  • Best player score: 8
  • Number of attempts: 1
Context Insensitive completion 1 - 387 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
learn vim in short time - 175 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Number of attempts: 1
V to the i - 3499 entries

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

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 2
Checkerboard case pattern - 106 entries

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

  • Best score: 15
  • Best player score: 21
  • Number of attempts: 2
Letter case trickery - 1403 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: 2
The Quick Brown Fox Jumps Over The Lazy Vim - 318 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: 11
  • Number of attempts: 1
A HAPPY NEW YEAR 2014 ! - 9017 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Just the middle - 8429 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Number of attempts: 3
Sort the VimGolf challenges by popularity - 241 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: 2
Ruby 1.9 hashes - 1024 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: 1
paste indent correction - JS - 75 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
  • Number of attempts: 1
Get rid of html tags - 303 entries

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

  • Best score: 15
  • Best player score: 17
  • Number of attempts: 1
Make Fancy Header - 874 entries

Make the header text stand out with surrounding asterisks

  • Best score: 16
  • Best player score: 17
  • Number of attempts: 2
Refactor static member invocation - 163 entries

Someone used a static method. Refactor the method into a static import while fixing the assertion.

  • Best score: 28
  • Best player score: 29
  • Number of attempts: 2
Numbering a List - 1684 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 18
  • Number of attempts: 3
Acute accents - 24 entries

Featuring all 17 lowercase letters with an acute accent digraph. Find a way to automate the digraphs.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 2
Simple, Practical, and Common - 20860 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: 5
  • Best player score: 22
  • Number of attempts: 4
Two become one - 631 entries

We have two c arrays and want to make one two dimensional out of it. Can we do that?

  • Best score: 25
  • Best player score: 32
  • Number of attempts: 1
I forgot quotes - 10039 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Number of attempts: 3
Roman numerals - 57 entries

Use the substitutions on top to convert unary to Roman numerals.

  • Best score: 17
  • Best player score: 19
  • Number of attempts: 2
Change the content of a string - 1195 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Number of attempts: 2
Neither Fizz nor Buzz - 187 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Number of attempts: 1
fib.c cleanup - 54 entries

cleanup the file

  • Best score: 15
  • Best player score: 16
  • Number of attempts: 1
Compile C - 275 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 21
  • Number of attempts: 4
It'ss tooo coold too typpe todaay - 194 entries

My hands are numb with cold. It's hard to type correctly.

  • Best score: 16
  • Best player score: 23
  • Number of attempts: 1
Subtraction - 147 entries

Solve the equations.

  • Best score: 18
  • Best player score: 18
  • Number of attempts: 3
Assignment Alignment - 650 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 23
  • Number of attempts: 6
Insert a Markdown link - 377 entries

Put a link in a markdown document, using the after-the-paragraph format.

  • Best score: 22
  • Best player score: 24
  • Number of attempts: 4
SFD-ROC: vimvimvim - 1235 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
Square numbers - 57 entries

Boring math puzzle.

  • Best score: 16
  • Best player score: 25
  • Number of attempts: 1
120 Degrees - 337 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 18
  • Number of attempts: 3
Minimalist Limerick - 441 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 37
  • Number of attempts: 2
The holy-grail may help - 292 entries

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

  • Best score: 16
  • Best player score: 16
  • Number of attempts: 2
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: 2
Generate English Alphabets - 387 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 25
  • Number of attempts: 1
Complete the hex array data (Part II) - 123 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: 2
Search and Replace 0 - 3819 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 3
Make the circuit grid! - 71 entries

Copy this command for a circuit layout program to create 10 total smd commands. Increment the number in quotes to name each pad, and add 0.7 to each of the (X Y) coordinates at the end of each line.

  • Best score: 26
  • Best player score: 26
  • Number of attempts: 3
Lisp Condense - 356 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 13
  • Number of attempts: 3
Split the words - 311 entries

Add the spaces manually if you must, but if you use Vim's spell checking feature wisely, I think you'll save a LARGE number of strokes.

  • Best score: 18
  • Best player score: 28
  • Number of attempts: 4
vim1001 - 221 entries

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

  • Best score: 17
  • Best player score: 21
  • Number of attempts: 2
Pairs of numbers - 316 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: 29
  • Number of attempts: 3
NBCU Weekly Challenge - #0 - 118 entries

One of our favorites lines here at NBCU! p.s. The first version of #0 was deleted due to me copy/pasting a HTML entity. Congrats to the one who figured that out, you are a true ninja warrior!

  • Best score: 30
  • Best player score: 30
  • Number of attempts: 3
Comparing scores - 68 entries

If Alice and Bob both did the challenge, put their entries together in the top paragraph, so we can compare their scores more easily.

  • Best score: 18
  • Best player score: 31
  • Number of attempts: 5
Sort and add attributes - 1043 entries

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

  • Best score: 18
  • Best player score: 33
  • Number of attempts: 2
Change your calendar - 189 entries

Happy New Year!

  • Best score: 18
  • Best player score: 35
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 5335 entries

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

  • Best score: 32
  • Best player score: 36
  • Number of attempts: 3

Contributed Challenges

Subtraction - 147 entries

Solve the equations.

Caek
Twitter:

Yes hello, Caek here.

entered into 99 challenges

contributed 1 challenges