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

One number per line - 18830 entries

Just give me the numbers.

  • Best score: 14
  • Best player score: 20
  • Position: #2113 / 3888
  • Number of attempts: 4
Search and Replace 0 - 5022 entries

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

  • Best score: 12
  • Best player score: 13
  • Position: #778 / 1636
  • Number of attempts: 3
Vice versa - 7974 entries

Little role switching.

  • Best score: 12
  • Best player score: 13
  • Position: #634 / 2146
  • Number of attempts: 4
O Christmas Tree - 109 entries

Design a macro that makes trees grow (or ASCII triangles, if that's too hard).

  • Best score: 22
  • Best player score: 23
  • Position: #7 / 43
  • Number of attempts: 4
Subtraction - 180 entries

Solve the equations.

  • Best score: 18
  • Best player score: 24
  • Position: #33 / 62
  • 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: #42 / 67
  • Number of attempts: 4
Vim tetris - 371 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 24
  • Position: #44 / 104
  • Number of attempts: 4
Five Pillars - 65 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

  • Best score: 41
  • Best player score: 56
  • Position: #7 / 25
  • Number of attempts: 2
Carriage return - 45 entries

I have some raw data from terminal output which uses carriege return for formatting. Carriage return sets the pointer to the first character on the line, and subsequent characters will overwrite what was there before. The challange is to simulate the terminal behaviour in vim. I'm kind of unsure if I should have skipped lines 9 and 15, since there might be some interesting solutions which are not that generic. Happy Golfing!

  • Best score: 22
  • Best player score: 22
  • Position: #9 / 22
  • Number of attempts: 2
Going underground.... - 357 entries

Simple reformatting: in this case changing from the format London underground supplies its customers with, to the format that Google Calendar likes...

  • Best score: 22
  • Best player score: 29
  • Position: #57 / 129
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10712 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 11
  • Position: #18 / 3699
  • Number of attempts: 5
attr_aligner - 3525 entries

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

  • Best score: 19
  • Best player score: 19
  • Position: #38 / 706
  • Number of attempts: 8
Letter case trickery - 1644 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: #222 / 520
  • Number of attempts: 5
quotes inside quotes - 3185 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: #87 / 1086
  • Number of attempts: 5
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: #51 / 107
  • Number of attempts: 5
Words in parens - 12991 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #231 / 3976
  • Number of attempts: 7
Hole-in-one - 1024 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: 17
  • Position: #104 / 305
  • Number of attempts: 6
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: 63
  • Position: #20 / 38
  • Number of attempts: 3
Lookahead and Lookbehind - 70 entries

Look everywhere

  • Best score: 16
  • Best player score: 20
  • Position: #10 / 31
  • Number of attempts: 3
Enumerate words - 257 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Position: #41 / 92
  • Number of attempts: 3
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: #7 / 38
  • Number of attempts: 4
Shuffle and Sort - 233 entries

The values where sorted incorrectly. Get them back to how they are supposed to be

  • Best score: 17
  • Best player score: 22
  • Position: #27 / 69
  • Number of attempts: 4
Saving the hashes(#) - 2067 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: 25
  • Position: #176 / 480
  • Number of attempts: 4
replacing each line of a block selection - 3007 entries

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

  • Best score: 18
  • Best player score: 18
  • Position: #8 / 780
  • Number of attempts: 5
constructor - 182 entries

coding a constructor for a simple class

  • Best score: 59
  • Best player score: 70
  • Position: #15 / 60
  • Number of attempts: 7
switch variable - 5093 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 11
  • Position: #232 / 1753
  • Number of attempts: 3
Ugly spreadsheet copy/paste to CSV - 1011 entries

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

  • Best score: 19
  • Best player score: 29
  • Position: #82 / 194
  • Number of attempts: 4
Replacing some words - 428 entries

How fast could it be?

  • Best score: 17
  • Best player score: 19
  • Position: #38 / 151
  • Number of attempts: 3
Make it more readable - 2009 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #217 / 652
  • Number of attempts: 3
remove dupes from array - 1360 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: 20
  • Position: #123 / 337
  • Number of attempts: 6
Alphabetize the directory - 298 entries

Put the contacts and their information in alphabetical order.

  • Best score: 30
  • Best player score: 32
  • Position: #36 / 101
  • Number of attempts: 2
PHP Array Syntax -> MailChimp Merge Syntax - 545 entries

I recently needed to send an e-mail to our marketing department listing allowed merge tags for our MailChimp campaigns. The allowed merge tags were determined from a PHP array in one of our PHP classes. I transformed the PHP class to MailChimp's syntax and sent the e-mail. It was, however, a long, laborious process. I'm still fairly new to Vim and would love to see how an expert Vim user would tackle one of my own, real-world problems. Thanks and have fun!

  • Best score: 23
  • Best player score: 26
  • Position: #58 / 150
  • Number of attempts: 2
Sort entries based on date - 405 entries

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

  • Best score: 11
  • Best player score: 12
  • Position: #58 / 118
  • Number of attempts: 2
Shebangs for all - 2049 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: #193 / 523
  • Number of attempts: 3
A Simple One - 1067 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: #251 / 671
  • Number of attempts: 1
Reverse Simple Deletion - 862 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 12
  • Position: #288 / 463
  • Number of attempts: 1
Sort and add attributes - 1530 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #92 / 592
  • Number of attempts: 2
Reconstruct the Sentence - 1670 entries

Get the sentence back in the proper order, remove duplicate lines, and then combine the separate lines into one.

  • Best score: 19
  • Best player score: 21
  • Position: #201 / 439
  • Number of attempts: 1
Braces or Brackets? - 1096 entries

Someone forgot whether to use braces or brackets and you have to clean up their code!

  • Best score: 34
  • Best player score: 36
  • Position: #54 / 339
  • Number of attempts: 4
Whitespace, empty lines and tabs - 3843 entries

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

  • Best score: 16
  • Best player score: 17
  • Position: #54 / 828
  • Number of attempts: 7
Flodder-challenge - 1401 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 30
  • Position: #92 / 358
  • Number of attempts: 5
Simple text editing with Vim - 13251 entries

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

  • Best score: 13
  • Best player score: 13
  • Position: #226 / 3806
  • Number of attempts: 4
Reformat/Refactor a Golfer Class - 7369 entries

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

  • Best score: 7
  • Best player score: 32
  • Position: #84 / 1821
  • Number of attempts: 7

Contributed Challenges

Five Pillars - 65 entries

Arrange all words in a table with 5 columns. The minimal space between words in columns is 2 spaces. Columns do have varying width.

oliver mueller
Twitter:

working with embedded systems in C++, react-native. I enjoy Rust, Ruby, Haskell, Typescript and Go. Blog at http://t.co/QDcTy760Z

entered into 43 challenges

contributed 1 challenges