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 - 33724 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: 27
  • Position: #3978 / 7442
  • Number of attempts: 3
Add semicolons - 10881 entries

Simply add a semicolon at the end of each line

  • Best score: 10
  • Best player score: 13
  • Position: #2015 / 3072
  • Number of attempts: 2
Word Blender - 148 entries

The insides of long words seem to have been run through the blender. Can you fix this famous tale, brave knight?

  • Best score: 28
  • Best player score: 36
  • Position: #28 / 57
  • Number of attempts: 2
Box it - 7916 entries

Create a box around a line.

  • Best score: 21
  • Best player score: 26
  • Position: #1049 / 1881
  • Number of attempts: 2
Search and Replace 0 - 5004 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #763 / 1630
  • Number of attempts: 1
Interweave two blocks of text - 661 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: 19
  • Position: #152 / 215
  • Number of attempts: 1
Python Hello World! Reformatting - 1000 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: 47
  • Position: #318 / 382
  • Number of attempts: 3
Swap assigned value - 655 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 14
  • Position: #233 / 256
  • Number of attempts: 1
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 36
  • Position: #89 / 174
  • Number of attempts: 4
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: 78
  • Position: #20 / 50
  • Number of attempts: 3
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: 25
  • Position: #14 / 54
  • Number of attempts: 4
Prefixes and suffixes - 635 entries

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

  • Best score: 17
  • Best player score: 29
  • Position: #132 / 201
  • Number of attempts: 1
Refactor arguments into object argument - 166 entries

A relatively common Javascript refactoring.

  • Best score: 48
  • Best player score: 54
  • Position: #13 / 68
  • Number of attempts: 5
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: 40
  • Position: #28 / 38
  • Number of attempts: 1
Changing URL path in CSS - 138 entries

What's the quickest way to swap out all the URLs in a CSS file? Is it wasted keystrokes using look-behinds and look-aheads? (I'm sorry for the delete/report--I made a mistake with the last one requiring an ugly search for graphic to replace with images. I just intended this to be a simple search and replace that might possibly generate some macros or normals solutions that are quicker)

  • Best score: 40
  • Best player score: 45
  • Position: #33 / 62
  • Number of attempts: 1
The name of the game - 671 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 12
  • Position: #288 / 362
  • Number of attempts: 2
Cleanining up 80 column concatenated text - 206 entries

1. Put the whole query on one line, remove the concatenation operators 2. Remove the double spaces that appear a few times in the query 3. Use string-interpolated variable statementPid rather than the ugly concatenation

  • Best score: 31
  • Best player score: 42
  • Position: #40 / 80
  • Number of attempts: 5
Vertical Limit - 2552 entries

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

  • Best score: 21
  • Best player score: 28
  • Position: #563 / 757
  • Number of attempts: 1
Aligning function arguments to match a specific coding style - 259 entries

Most projects have specific coding style guidelines. In this case, the argument list must be broken into a new line for each argument, with the argument names right aligned, taking into account pointers.

  • Best score: 16
  • Best player score: 21
  • Position: #43 / 72
  • Number of attempts: 2
Exchanging Quotes - 858 entries

Sometimes you need to exchange a choice of quotes in some code.

  • Best score: 30
  • Best player score: 35
  • Position: #93 / 230
  • Number of attempts: 4
replacing each line of a block selection - 3001 entries

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

  • Best score: 18
  • Best player score: 20
  • Position: #241 / 778
  • Number of attempts: 3
Switch function arguments - 2142 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 13
  • Position: #348 / 665
  • Number of attempts: 2
Reverse and double space - 500 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 17
  • Position: #125 / 199
  • Number of attempts: 4
constructor - 182 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 100
  • Position: #35 / 60
  • Number of attempts: 1
switch variable - 5079 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #681 / 1749
  • Number of attempts: 3
The meaning - 575 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Position: #97 / 363
  • Number of attempts: 1
Ugly spreadsheet copy/paste to CSV - 1009 entries

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

  • Best score: 19
  • Best player score: 36
  • Position: #112 / 193
  • Number of attempts: 2
Sort the cardinal numbers - 315 entries

Maybe a simple challenge.

  • Best score: 12
  • Best player score: 14
  • Position: #89 / 149
  • Number of attempts: 1
Make it more readable - 2009 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #332 / 652
  • Number of attempts: 3
remove dupes from array - 1358 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: 18
  • Position: #93 / 336
  • Number of attempts: 5
Sort entries based on date - 392 entries

Sort some entries in a Ledger-file based on date.

  • Best score: 11
  • Best player score: 20
  • Position: #101 / 117
  • Number of attempts: 2
Here, piggy, piggy... - 80 entries

Youay owknay atwhay otay oday...

  • Best score: 68
  • Best player score: 99
  • Position: #18 / 23
  • Number of attempts: 1
Happy New Year! - 145 entries

This is a simple new year's challenge.

  • Best score: 22
  • Best player score: 30
  • Position: #44 / 59
  • Number of attempts: 4
imports alignment (python) - 700 entries

Align as one import per line.

  • Best score: 17
  • Best player score: 19
  • Position: #59 / 198
  • Number of attempts: 2
Rotating Philosophers Problem - 410 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: 31
  • Position: #93 / 166
  • Number of attempts: 5
expand a list comprehension (python) - 334 entries

Please show your way to convert a list comprehension in python to an ordinary for-loop expression!

  • Best score: 42
  • Best player score: 47
  • Position: #32 / 110
  • Number of attempts: 8
Insert a Markdown link - 450 entries

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

  • Best score: 22
  • Best player score: 24
  • Position: #57 / 149
  • Number of attempts: 4
Numbering a List - 1935 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 23
  • Position: #455 / 654
  • Number of attempts: 2
Getters & Setters: Java - 211 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: 113
  • Position: #26 / 59
  • Number of attempts: 3
Java Array2List - 233 entries

Convert an java array initializer into a list.

  • Best score: 67
  • Best player score: 100
  • Position: #42 / 87
  • Number of attempts: 3
Ruby 1.9 hashes - 1249 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: 13
  • Position: #146 / 407
  • Number of attempts: 4
CSV to JSON - 173 entries

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

  • Best score: 56
  • Best player score: 114
  • Position: #38 / 66
  • Number of attempts: 2
Assignment Alignment - 885 entries

line up the operators. Use spaces, not tabs.

  • Best score: 18
  • Best player score: 30
  • Position: #160 / 221
  • Number of attempts: 2
Shebangs for all - 2018 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: 13
  • Position: #183 / 519
  • Number of attempts: 4
82 bottles of beer on the wall - 313 entries

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

  • Best score: 106
  • Best player score: 124
  • Position: #53 / 146
  • Number of attempts: 5
Table Reshuffle - 439 entries

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

  • Best score: 22
  • Best player score: 29
  • Position: #60 / 142
  • Number of attempts: 5
Reverse and count - 480 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: 32
  • Position: #128 / 178
  • Number of attempts: 3
Reverse Simple Deletion - 854 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #197 / 460
  • Number of attempts: 3
Dumb to smart - 100 entries

Turn dumb quote to smart vim's way.

  • Best score: 28
  • Best player score: 34
  • Position: #35 / 57
  • Number of attempts: 3
Context insensitive completion 0 - 585 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: 7
  • Position: #53 / 248
  • Number of attempts: 3
Context Insensitive completion 1 - 506 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 36
  • Position: #227 / 247
  • Number of attempts: 1
Make Fancy Header - 1063 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 18
  • Position: #225 / 346
  • Number of attempts: 3
Reformat some Python - 622 entries

Fix some very bizarrely laid-out code.

  • Best score: 34
  • Best player score: 41
  • Position: #107 / 238
  • Number of attempts: 4
Reformat most common surnames - 743 entries

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

  • Best score: 23
  • Best player score: 32
  • Position: #133 / 215
  • Number of attempts: 2
Change the content of a string - 1593 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 23
  • Position: #259 / 594
  • Number of attempts: 2
Whitespace, empty lines and tabs - 3744 entries

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

  • Best score: 16
  • Best player score: 34
  • Position: #653 / 804
  • Number of attempts: 1
Øystein Walle
Twitter:

entered into 56 challenges

contributed 0 challenges