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 - 33609 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: 22
  • Position: #254 / 7415
  • Number of attempts: 4
V to the i - 4799 entries

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

  • Best score: 7
  • Best player score: 7
  • Position: #6 / 1892
  • Number of attempts: 2
Wrap the text of an email message to 79 characters - 754 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #206 / 407
  • Number of attempts: 1
Extract argument from function - 2355 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #64 / 752
  • Number of attempts: 4
Search and Replace 0 - 4978 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #336 / 1621
  • Number of attempts: 3
That hyphen - 2595 entries

"vim vi improved"

  • Best score: 9
  • Best player score: 11
  • Position: #285 / 701
  • Number of attempts: 2
Just the middle - 11446 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 7
  • Position: #89 / 4194
  • Number of attempts: 3
Python Hello World! Reformatting - 989 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: #172 / 379
  • Number of attempts: 1
Acute accents - 33 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
  • Position: #3 / 25
  • Number of attempts: 2
Basic renumbering - 5648 entries

Renumbering Basic.

  • Best score: 11
  • Best player score: 15
  • Position: #505 / 1264
  • Number of attempts: 2
Change your calendar - 392 entries

Happy New Year!

  • Best score: 18
  • Best player score: 35
  • Position: #55 / 87
  • Number of attempts: 1
VimGolfNight - 560 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Position: #183 / 347
  • Number of attempts: 1
Condensed Cases - 804 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
  • Position: #109 / 247
  • Number of attempts: 1
Square numbers - 123 entries

Boring math puzzle.

  • Best score: 16
  • Best player score: 25
  • Position: #13 / 42
  • Number of attempts: 1
Happy TvvO - 426 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #46 / 205
  • Number of attempts: 1
I forgot quotes - 15977 entries

Oops.

  • Best score: 10
  • Best player score: 10
  • Position: #12 / 4177
  • Number of attempts: 3
Shift down - 209 entries

Number words are back.

  • Best score: 19
  • Best player score: 19
  • Position: #10 / 69
  • Number of attempts: 4
learn vim in short time - 240 entries

so happy to learn vim.because vim is awesome

  • Best score: 8
  • Best player score: 8
  • Position: #16 / 161
  • Number of attempts: 1
vim1001 - 307 entries

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

  • Best score: 17
  • Best player score: 21
  • Position: #18 / 110
  • Number of attempts: 2
Subtraction - 180 entries

Solve the equations.

  • Best score: 18
  • Best player score: 18
  • Position: #7 / 62
  • Number of attempts: 3
Roman numerals - 81 entries

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

  • Best score: 17
  • Best player score: 19
  • Position: #12 / 29
  • Number of attempts: 2
-a-b-c- - 3213 entries

Put hyphens everywhere.

  • Best score: 13
  • Best player score: 13
  • Position: #16 / 1137
  • Number of attempts: 2
Count both ways - 1022 entries

Right AND down.

  • Best score: 13
  • Best player score: 13
  • Position: #4 / 354
  • Number of attempts: 2
Suffix sort - 270 entries

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

  • Best score: 19
  • Best player score: 25
  • Position: #38 / 67
  • Number of attempts: 2
NBCU Weekly Challenge - Test - 253 entries

Just testing.

  • Best score: 18
  • Best player score: 18
  • Position: #3 / 116
  • Number of attempts: 2
Change name of a variable - 179 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
  • Position: #8 / 137
  • Number of attempts: 1
Lisp Condense - 460 entries

Reduce 4 cons selection operations down to one function call.

  • Best score: 13
  • Best player score: 13
  • Position: #2 / 158
  • Number of attempts: 3
120 Degrees - 493 entries

Rotate that triangle.

  • Best score: 14
  • Best player score: 18
  • Position: #54 / 145
  • Number of attempts: 3
Gray area - 747 entries

It's a golf metaphor or something.

  • Best score: 11
  • Best player score: 12
  • Position: #33 / 271
  • Number of attempts: 2
NBCU Weekly Challenge - #0 - 139 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
  • Position: #6 / 58
  • Number of attempts: 3
Refactor static member invocation - 199 entries

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

  • Best score: 28
  • Best player score: 29
  • Position: #13 / 64
  • Number of attempts: 2
Winding path - 122 entries

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

  • Best score: 27
  • Best player score: 46
  • Position: #19 / 42
  • Number of attempts: 1
Comparing scores - 112 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
  • Position: #21 / 35
  • Number of attempts: 5
Neither Fizz nor Buzz - 253 entries

Not your regular increment macro! The gaps are tricky.

  • Best score: 13
  • Best player score: 20
  • Position: #33 / 103
  • Number of attempts: 1
Do you demand a shrubbery? - 1158 entries

Use :redir and crush the emacsgolfers.

  • Best score: 15
  • Best player score: 15
  • Position: #4 / 300
  • Number of attempts: 5
Don't know what this is - 2020 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
  • Position: #142 / 584
  • Number of attempts: 3
Two become one - 713 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
  • Position: #113 / 208
  • Number of attempts: 1
Where should I put the Newline? - 881 entries

Help me put the newline.

  • Best score: 7
  • Best player score: 7
  • Position: #56 / 437
  • Number of attempts: 2
Split the words - 363 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
  • Position: #29 / 110
  • Number of attempts: 4
A HAPPY NEW YEAR 2014 ! - 10658 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #381 / 3680
  • Number of attempts: 5
Letter case trickery - 1630 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
  • Position: #252 / 518
  • Number of attempts: 2
quotes inside quotes - 3159 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: 14
  • Position: #169 / 1078
  • Number of attempts: 5
Hanging Indent for Footnotes - 72 entries

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

  • Best score: 17
  • Best player score: 29
  • Position: #29 / 30
  • Number of attempts: 2
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: 16
  • Position: #54 / 107
  • Number of attempts: 2
Words in parens - 12929 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #399 / 3961
  • 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: 29
  • Position: #41 / 136
  • Number of attempts: 3
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: #30 / 59
  • Number of attempts: 1
Word frequency alignment - 290 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: #91 / 161
  • Number of attempts: 1
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 37
  • Position: #105 / 174
  • Number of attempts: 2
fib.c cleanup - 68 entries

cleanup the file

  • Best score: 15
  • Best player score: 16
  • Position: #38 / 55
  • Number of attempts: 1
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: #16 / 64
  • Number of attempts: 2
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: #54 / 93
  • Number of attempts: 2
Prefixes and suffixes - 629 entries

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

  • Best score: 17
  • Best player score: 23
  • Position: #60 / 196
  • Number of attempts: 4
Checkerboard case pattern - 164 entries

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

  • Best score: 15
  • Best player score: 21
  • Position: #40 / 61
  • 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: #23 / 191
  • Number of attempts: 3
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: #71 / 106
  • Number of attempts: 1
The Quick Brown Fox Jumps Over The Lazy Vim - 416 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: #138 / 191
  • Number of attempts: 1
lamb had a little Mary - 599 entries

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

  • Best score: 16
  • Best player score: 35
  • Position: #89 / 166
  • Number of attempts: 4
SFD-ROC: vimvimvim - 1606 entries

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

  • Best score: 8
  • Best player score: 8
  • Position: #56 / 446
  • Number of attempts: 4
Saving the hashes(#) - 2063 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
  • Position: #334 / 480
  • Number of attempts: 2
SFD-ROC: ROT13 Phonics - 101 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
  • Position: #44 / 73
  • Number of attempts: 1
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #67 / 445
  • Number of attempts: 3
you're stuck on jQuery < 1.7 - 362 entries

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

  • Best score: 25
  • Best player score: 28
  • Position: #50 / 113
  • Number of attempts: 3
Enharmonic Equivalents - 59 entries

Transform # and b to digraphs

  • Best score: 18
  • Best player score: 22
  • Position: #32 / 37
  • Number of attempts: 2
Vertical Limit - 2538 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #229 / 754
  • Number of attempts: 5
Make the circuit grid! - 101 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
  • Position: #24 / 50
  • Number of attempts: 3
Switch function arguments - 2130 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 11
  • Position: #100 / 661
  • Number of attempts: 5
Append semicolon after expressions - 1054 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #76 / 418
  • Number of attempts: 3
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 16
  • Position: #103 / 199
  • Number of attempts: 3
Remove semicolons after expressions - 654 entries

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

  • Best score: 6
  • Best player score: 6
  • Position: #75 / 263
  • Number of attempts: 4
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #309 / 1748
  • Number of attempts: 4
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #231 / 363
  • Number of attempts: 1
Make it more readable - 1995 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 14
  • Position: #167 / 649
  • Number of attempts: 5
Complete the hex array data - 197 entries

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

  • Best score: 23
  • Best player score: 27
  • Position: #44 / 74
  • Number of attempts: 1
Complete the hex array data (Part II) - 166 entries

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

  • Best score: 20
  • Best player score: 26
  • Position: #49 / 69
  • Number of attempts: 2
It'ss tooo coold too typpe todaay - 222 entries

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

  • Best score: 16
  • Best player score: 23
  • Position: #63 / 97
  • Number of attempts: 1
Generate English Alphabets - 487 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 25
  • Position: #134 / 206
  • Number of attempts: 1
Insert a Markdown link - 434 entries

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

  • Best score: 22
  • Best player score: 24
  • Position: #63 / 145
  • Number of attempts: 4
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 18
  • Position: #136 / 652
  • Number of attempts: 3
The holy-grail may help - 362 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #134 / 208
  • Number of attempts: 2
Ruby 1.9 hashes - 1244 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
  • Position: #233 / 406
  • Number of attempts: 1
Assignment Alignment - 883 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 23
  • Position: #107 / 220
  • Number of attempts: 6
A Simple One - 1047 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
  • Position: #389 / 662
  • Number of attempts: 1
82 bottles of beer on the wall - 312 entries

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

  • Best score: 106
  • Best player score: 120
  • Position: #41 / 145
  • Number of attempts: 1
Reverse Simple Deletion - 847 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #296 / 458
  • Number of attempts: 1
Increment, increment, increment.... - 684 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #285 / 406
  • Number of attempts: 1
Hatsuyume - 513 entries

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

  • Best score: 15
  • Best player score: 25
  • Position: #83 / 184
  • Number of attempts: 2
The Cake is a Lie - 1339 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #186 / 525
  • Number of attempts: 3
Context insensitive completion 0 - 566 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: #143 / 244
  • Number of attempts: 1
Compile C - 420 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 21
  • Position: #72 / 140
  • Number of attempts: 4
Context Insensitive completion 1 - 494 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #118 / 243
  • Number of attempts: 2
Almost encrypted - 204 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Position: #109 / 146
  • Number of attempts: 1
Make Fancy Header - 1046 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #188 / 343
  • Number of attempts: 2
Reverse characters in a line - 757 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
  • Position: #192 / 263
  • Number of attempts: 4
Get rid of html tags - 394 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #103 / 228
  • Number of attempts: 1
Change the content of a string - 1567 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #139 / 585
  • Number of attempts: 2
Sort and add attributes - 1436 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #183 / 559
  • Number of attempts: 2
Simple text editing with Vim - 12744 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1306 / 3681
  • Number of attempts: 2
Reformat/Refactor a Golfer Class - 6937 entries

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

  • Best score: 28
  • Best player score: 36
  • Position: #455 / 1699
  • Number of attempts: 3

Contributed Challenges

Subtraction - 180 entries

Solve the equations.

Caek
Twitter:

Yes hello, Caek here.

entered into 99 challenges

contributed 1 challenges