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

Prime Numbers - 374 entries

List the first 100 prime numbers.

  • Best score: 34
  • Best player score: 53
  • Position: #63 / 105
  • Number of attempts: 4
Wrap the text of an email message to 79 characters - 766 entries

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

  • Best score: 5
  • Best player score: 5
  • Position: #192 / 410
  • Number of attempts: 1
Search and Replace 0 - 4989 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #251 / 1624
  • Number of attempts: 2
Python Hello World! Reformatting - 994 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: #284 / 380
  • Number of attempts: 1
Swap assigned value - 647 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 14
  • Position: #232 / 254
  • Number of attempts: 1
Cartesian product - 255 entries

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

  • Best score: 24
  • Best player score: 61
  • Position: #89 / 95
  • Number of attempts: 1
VimGolfNight - 560 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 19
  • Position: #330 / 347
  • Number of attempts: 1
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: 20
  • Position: #497 / 518
  • Number of attempts: 1
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: 17
  • Position: #730 / 1078
  • Number of attempts: 1
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: 21
  • Position: #94 / 107
  • Number of attempts: 1
Words in parens - 12935 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 16
  • Position: #1974 / 3963
  • Number of attempts: 3
Delete unwanted lines - 411 entries

Delete all lines which does not end in "o.."

  • Best score: 9
  • Best player score: 9
  • Position: #86 / 229
  • 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: 16
  • Position: #83 / 93
  • Number of attempts: 1
The name of the game - 665 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #141 / 360
  • Number of attempts: 1
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: 9
  • Position: #192 / 446
  • Number of attempts: 2
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: 27
  • Position: #238 / 480
  • Number of attempts: 3
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Position: #212 / 445
  • 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: 27
  • Position: #525 / 754
  • Number of attempts: 2
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 23
  • Position: #457 / 777
  • Number of attempts: 3
Switch function arguments - 2139 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 15
  • Position: #546 / 663
  • Number of attempts: 2
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Position: #198 / 419
  • Number of attempts: 1
Remove noise from HTTP log - 717 entries

This piece of log (from the year 2000) contains some irrelevant data. We only want to see the HTTP method and resource.

  • Best score: 15
  • Best player score: 15
  • Position: #79 / 273
  • Number of attempts: 4
Remove semicolons after expressions - 654 entries

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

  • Best score: 6
  • Best player score: 8
  • Position: #208 / 263
  • Number of attempts: 2
switch variable - 5071 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 15
  • Position: #1486 / 1748
  • Number of attempts: 2
The meaning - 575 entries

Numbers are fun!

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

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 16
  • Position: #382 / 650
  • Number of attempts: 2
Generate Fibonacci Numbers - 280 entries

Use your super vim powers to generate Fibonacci Numbers.

  • Best score: 19
  • Best player score: 32
  • Position: #94 / 100
  • Number of attempts: 2
Generate English Alphabets - 487 entries

Start with a, get up to z.

  • Best score: 19
  • Best player score: 25
  • Position: #129 / 206
  • Number of attempts: 2
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 25
  • Position: #533 / 652
  • Number of attempts: 2
The holy-grail may help - 366 entries

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

  • Best score: 16
  • Best player score: 16
  • Position: #128 / 209
  • Number of attempts: 1
Shebangs for all - 1999 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: #314 / 516
  • Number of attempts: 1
A Simple One - 1050 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: #349 / 664
  • Number of attempts: 1
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: 137
  • Position: #96 / 146
  • Number of attempts: 1
Reverse Simple Deletion - 847 entries

You did the simple deletion, now reverse it.

  • Best score: 11
  • Best player score: 14
  • Position: #395 / 458
  • Number of attempts: 2
Hatsuyume - 532 entries

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

  • Best score: 15
  • Best player score: 27
  • Position: #108 / 186
  • Number of attempts: 1
Turn this csv list into queries - 252 entries

Transform each line of this csv file into a MySQL-ready INSERT query.

  • Best score: 98
  • Best player score: 123
  • Position: #54 / 101
  • Number of attempts: 1
Context Insensitive completion 1 - 498 entries

Finish writing this simple Python HTTP server.

  • Best score: 18
  • Best player score: 18
  • Position: #109 / 245
  • 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: #100 / 146
  • Number of attempts: 1
Make Fancy Header - 1052 entries

Make the header text stand out with surrounding asterisks

  • Best score: 15
  • Best player score: 19
  • Position: #248 / 344
  • Number of attempts: 1
Remember FizzBuzz? - 725 entries

Output FizzBuzz to 100. Start with nothing.

  • Best score: 39
  • Best player score: 97
  • Position: #175 / 190
  • Number of attempts: 2
Get rid of html tags - 398 entries

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

  • Best score: 12
  • Best player score: 17
  • Position: #96 / 230
  • Number of attempts: 2
Sort and add attributes - 1451 entries

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

  • Best score: 33
  • Best player score: 33
  • Position: #168 / 563
  • Number of attempts: 1
Braces or Brackets? - 1015 entries

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

  • Best score: 34
  • Best player score: 47
  • Position: #185 / 315
  • Number of attempts: 1
Whitespace, empty lines and tabs - 3665 entries

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

  • Best score: 16
  • Best player score: 31
  • Position: #557 / 787
  • Number of attempts: 2
Simple text editing with Vim - 12811 entries

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

  • Best score: 13
  • Best player score: 16
  • Position: #2191 / 3694
  • Number of attempts: 4
Reformat/Refactor a Golfer Class - 6982 entries

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

  • Best score: 28
  • Best player score: 40
  • Position: #807 / 1706
  • Number of attempts: 2
foo
Twitter:

entered into 46 challenges

contributed 0 challenges