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

vim = 22 / 7 - 447 entries

pi square vim

  • Best score: 20
  • Best player score: 32
  • Position: #90 / 131
  • Number of attempts: 2
Search and Replace 0 - 4792 entries

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

  • Best score: 12
  • Best player score: 12
  • Position: #215 / 1585
  • Number of attempts: 2
Swap assigned value - 624 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #46 / 249
  • Number of attempts: 5
Top X - 191 entries

The End File is the Top 10 Vimgolf Leaderboard at June 29, 2013. This is a second version, with a great contribution of @udioica. X is ten in Roman,a numeric system in ancient Rome

  • Best score: 18
  • Best player score: 33
  • Position: #49 / 69
  • Number of attempts: 1
Number an outline - 249 entries

The indent and words are right, but the numbers are all wrong.

  • Best score: 25
  • Best player score: 55
  • Position: #42 / 75
  • Number of attempts: 5
Words in parens - 12858 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #30 / 3946
  • Number of attempts: 3
Assign list - 169 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 37
  • Position: #25 / 59
  • Number of attempts: 5
Draw the Go board - 140 entries

which is a 19×19 lines board. Here we use ascii characters only for simplicity. See diff file to get a sense. (See also http://en.wikipedia.org/wiki/Go_(game))

  • Best score: 50
  • Best player score: 59
  • Position: #12 / 48
  • Number of attempts: 7
paste indent correction - JS - 102 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: #20 / 57
  • Number of attempts: 2
Hole-in-one - 1012 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: 20
  • Position: #187 / 302
  • Number of attempts: 4
Delete unwanted lines - 396 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #3 / 225
  • Number of attempts: 4
Parsing with CSV: Unify lines and result. - 165 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: 21
  • Position: #16 / 73
  • Number of attempts: 2
Minimalist Limerick - 516 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 34
  • Position: #63 / 171
  • Number of attempts: 6
Prefixes and suffixes - 593 entries

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

  • Best score: 17
  • Best player score: 23
  • Position: #56 / 193
  • Number of attempts: 3
The name of the game - 650 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Position: #117 / 356
  • Number of attempts: 1
lamb had a little Mary - 586 entries

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

  • Best score: 16
  • Best player score: 25
  • Position: #38 / 163
  • Number of attempts: 5
SFD-ROC: vimvimvim - 1581 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: #22 / 439
  • Number of attempts: 3
Saving the hashes(#) - 1992 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: #309 / 473
  • Number of attempts: 3
Let's play some Ivmgolf - 1091 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #34 / 441
  • Number of attempts: 2
Vertical Limit - 2440 entries

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

  • Best score: 21
  • Best player score: 21
  • Position: #5 / 737
  • Number of attempts: 7
Aligning function arguments to match a specific coding style - 227 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: 23
  • Position: #52 / 68
  • Number of attempts: 2
Exchanging Quotes - 821 entries

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

  • Best score: 30
  • Best player score: 40
  • Position: #181 / 225
  • Number of attempts: 3
replacing each line of a block selection - 2947 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #348 / 768
  • Number of attempts: 5
Append semicolon after expressions - 1005 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 11
  • Position: #41 / 403
  • Number of attempts: 4
switch variable - 5036 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #737 / 1736
  • Number of attempts: 5
Make it more readable - 1952 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #246 / 640
  • Number of attempts: 2
remove dupes from array - 1336 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: 23
  • Position: #198 / 331
  • Number of attempts: 2
Rotating Philosophers Problem - 390 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: 37
  • Position: #153 / 163
  • Number of attempts: 4
Numbering a List - 1859 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 19
  • Position: #233 / 639
  • Number of attempts: 4
Shebangs for all - 1912 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: #303 / 500
  • Number of attempts: 1
Indentation - 497 entries

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

  • Best score: 21
  • Best player score: 23
  • Position: #27 / 168
  • Number of attempts: 6
Simple text editing with Vim - 12290 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1042 / 3581
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6560 entries

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

  • Best score: 32
  • Best player score: 36
  • Position: #430 / 1616
  • Number of attempts: 4

Contributed Challenges

Delete unwanted lines - 396 entries

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

Pairs of numbers - 360 entries

Line 1 represents x, line 2 y-data. Bring the corresponding pairs in the form "[x,y]\n"

powertomato
Twitter:

entered into 33 challenges

contributed 2 challenges