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 - 33483 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: #1138 / 7384
  • Number of attempts: 6
One number per line - 18673 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 19
  • Position: #1750 / 3852
  • Number of attempts: 2
vim = 22 / 7 - 451 entries

pi square vim

  • Best score: 20
  • Best player score: 22
  • Position: #53 / 133
  • Number of attempts: 2
Team names - 1812 entries

The team names are misspelled.

  • Best score: 16
  • Best player score: 18
  • Position: #332 / 585
  • Number of attempts: 1
Python Hello World! Reformatting - 955 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: 45
  • Position: #266 / 371
  • Number of attempts: 1
Swap assigned value - 628 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #23 / 252
  • Number of attempts: 4
Cartesian product - 222 entries

{1,2,3,4,5} X {1,2,3,4,5}

  • Best score: 24
  • Best player score: 36
  • Position: #62 / 93
  • Number of attempts: 2
Change your calendar - 363 entries

Happy New Year!

  • Best score: 18
  • Best player score: 26
  • Position: #33 / 86
  • Number of attempts: 2
Words in parens - 12868 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 15
  • Position: #1177 / 3950
  • Number of attempts: 1
Parsing with CSV: Unify lines and result. - 167 entries

col1;col2;col3;col4 A;1;4;5 A;3;4; A;1;4; # New output: col1;col2;col3;col4 A;1(2x);3;4(3x);5 any ideas?

  • Best score: 21
  • Best player score: 23
  • Position: #46 / 75
  • Number of attempts: 1
Minimalist Limerick - 519 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 32
  • Position: #35 / 173
  • Number of attempts: 8
Coordinates placeholder - 64 entries

Place coordinates instead of target search.

  • Best score: 22
  • Best player score: 56
  • Position: #37 / 37
  • Number of attempts: 1
Define to require - 119 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: 69
  • Position: #14 / 49
  • Number of attempts: 2
REDRUM - 151 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: 16
  • Position: #30 / 63
  • Number of attempts: 3
Execute immediate SQL - 87 entries

Sql string tranformation ...

  • Best score: 58
  • Best player score: 70
  • Position: #10 / 31
  • Number of attempts: 1
Harder than "abcd > a b c d" - 78 entries

Not as easy as the last challenge. This time, just one space between a and b, up to 25 spaces between y and z. (Removed some lines; diff was too long.)

  • Best score: 15
  • Best player score: 25
  • Position: #29 / 41
  • Number of attempts: 1
Chinese Multiplication Table - 78 entries

Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.

  • Best score: 39
  • Best player score: 69
  • Position: #12 / 25
  • Number of attempts: 2
Transposition - 83 entries

Transpose the original lines in separate columns, one for each line.

  • Best score: 31
  • Best player score: 56
  • Position: #26 / 31
  • Number of attempts: 1
Block Fun 1 - 190 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 22
  • Position: #40 / 74
  • Number of attempts: 2
Prefixes and suffixes - 599 entries

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

  • Best score: 17
  • Best player score: 28
  • Position: #115 / 195
  • Number of attempts: 2
Refactor arguments into object argument - 162 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 58
  • Position: #18 / 66
  • Number of attempts: 1
Printable ASCII characters - 136 entries

From a blank input, print all 95 printing ASCII characters one per line, from space to tilde.

  • Best score: 22
  • Best player score: 43
  • Position: #31 / 43
  • Number of attempts: 1
SFD-ROC: The Quick Brown Fox - 175 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: #64 / 104
  • Number of attempts: 1
lamb had a little Mary - 596 entries

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

  • Best score: 16
  • Best player score: 35
  • Position: #82 / 164
  • Number of attempts: 3
Stairs Indenting - 452 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 14
  • Position: #95 / 195
  • Number of attempts: 2
Saving the hashes(#) - 2008 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: 34
  • Position: #427 / 476
  • Number of attempts: 1
Let's play some Ivmgolf - 1096 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #170 / 442
  • Number of attempts: 1
Vertical Limit - 2487 entries

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

  • Best score: 21
  • Best player score: 25
  • Position: #320 / 748
  • Number of attempts: 1
replacing each line of a block selection - 2966 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #448 / 772
  • Number of attempts: 1
Append semicolon after expressions - 1023 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 13
  • Position: #300 / 410
  • Number of attempts: 1
Remove semicolons after expressions - 639 entries

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

  • Best score: 6
  • Best player score: 10
  • Position: #246 / 261
  • Number of attempts: 1
switch variable - 5045 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #733 / 1742
  • Number of attempts: 1
Calculate the table totals - 133 entries

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

  • Best score: 33
  • Best player score: 55
  • Position: #28 / 44
  • Number of attempts: 2
Ugly spreadsheet copy/paste to CSV - 978 entries

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

  • Best score: 19
  • Best player score: 56
  • Position: #169 / 188
  • Number of attempts: 1
Make it more readable - 1955 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #242 / 643
  • Number of attempts: 2
Line Zipper - 454 entries

Zip/pair related lines.

  • Best score: 12
  • Best player score: 16
  • Position: #172 / 212
  • Number of attempts: 1
remove dupes from array - 1345 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: #259 / 333
  • Number of attempts: 1
Happy New Year! - 144 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 31
  • Position: #47 / 58
  • Number of attempts: 1
imports alignment (python) - 663 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 23
  • Position: #111 / 196
  • Number of attempts: 2
Rotating Philosophers Problem - 392 entries

Can you help the philosophers find a good place to sit before they get five forks and spaghetti?

  • Best score: 29
  • Best player score: 33
  • Position: #120 / 165
  • Number of attempts: 1
Generate English Alphabets - 476 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 26
  • Position: #141 / 205
  • 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: 27
  • Position: #99 / 145
  • Number of attempts: 2
Numbering a List - 1869 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 21
  • Position: #345 / 646
  • Number of attempts: 1
Getters & Setters: Java - 206 entries

Boilerplate getters & setters - it's a tedious fact of life in Java, and probably the only thing that still pulls me back to an IDE. Perhaps someone knows a fast, pure vim way...

  • Best score: 89
  • Best player score: 121
  • Position: #33 / 57
  • Number of attempts: 1
Java Array2List - 227 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 92
  • Position: #33 / 85
  • Number of attempts: 1
The holy-grail may help - 352 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #54 / 207
  • Number of attempts: 1
Ruby 1.9 hashes - 1225 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: 12
  • Position: #46 / 402
  • Number of attempts: 3
CSV to JSON - 173 entries

A search for shortest vimissh way to convert CSV to JSON.

  • Best score: 56
  • Best player score: 106
  • Position: #35 / 66
  • Number of attempts: 1
Shebangs for all - 1917 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: #282 / 502
  • Number of attempts: 1
A Simple One - 1009 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: #62 / 648
  • Number of attempts: 1
82 bottles of beer on the wall - 307 entries

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

  • Best score: 106
  • Best player score: 134
  • Position: #87 / 143
  • Number of attempts: 1
Table Reshuffle - 372 entries

Fix the column order in this table... also append the new 'username' column.

  • Best score: 22
  • Best player score: 34
  • Position: #82 / 135
  • Number of attempts: 2
Reverse and count - 459 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: 25
  • Position: #81 / 174
  • Number of attempts: 2
Another Mixed-Up Haiku - 238 entries

VimGolf ... a perfect evening?

  • Best score: 21
  • Best player score: 28
  • Position: #61 / 86
  • Number of attempts: 3
Reverse Simple Deletion - 834 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #111 / 455
  • Number of attempts: 1
Increment, increment, increment.... - 668 entries

Vim likes macros

  • Best score: 10
  • Best player score: 12
  • Position: #246 / 404
  • Number of attempts: 2
Sorting paragraphs - 510 entries

Order the paragraphs correctly, per prefixed index

  • Best score: 18
  • Best player score: 24
  • Position: #34 / 159
  • Number of attempts: 2
Indentation - 499 entries

Indent each line according to the right number of spaces it needs.

  • Best score: 20
  • Best player score: 33
  • Position: #134 / 170
  • Number of attempts: 1
Hatsuyume - 467 entries

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

  • Best score: 15
  • Best player score: 24
  • Position: #59 / 179
  • Number of attempts: 1
The Cake is a Lie - 1301 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 9
  • Position: #4 / 517
  • Number of attempts: 2
Fix the Haiku - 276 entries

Change this slightly scrambled haiku to its unscrambled form and fix the capitalisation and punctuation along the way.

  • Best score: 28
  • Best player score: 47
  • Position: #86 / 110
  • Number of attempts: 2
Context insensitive completion 0 - 545 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
  • Position: #170 / 239
  • Number of attempts: 1
Compile C - 366 entries

You might have to get clever to do this one.

  • Best score: 19
  • Best player score: 23
  • Position: #94 / 133
  • Number of attempts: 3
Almost encrypted - 199 entries

Convert the first paragraph to be even less readable.

  • Best score: 5
  • Best player score: 5
  • Position: #23 / 145
  • Number of attempts: 1
Make Fancy Header - 1024 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 17
  • Position: #177 / 340
  • Number of attempts: 4
Reformat a C golf submission - 574 entries

Take this C golf submission (for the "tiny but standards-compliant Hello World program" category, naturally), and turn it into formatted C code.

  • Best score: 22
  • Best player score: 27
  • Position: #46 / 203
  • Number of attempts: 2
Reverse characters in a line - 732 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: 15
  • Position: #112 / 257
  • Number of attempts: 2
Reformat most common surnames - 671 entries

Reformat copy-pasted table into a list of the most common surnames

  • Best score: 23
  • Best player score: 29
  • Position: #104 / 202
  • Number of attempts: 1
Change the content of a string - 1502 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 22
  • Position: #20 / 567
  • Number of attempts: 2
Sort and add attributes - 1369 entries

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

  • Best score: 33
  • Best player score: 35
  • Position: #375 / 542
  • Number of attempts: 1
Simple text editing with Vim - 12491 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1001 / 3626
  • Number of attempts: 2
Asmund
Twitter:

entered into 71 challenges

contributed 0 challenges