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 - 475 entries

pi square vim

  • Best score: 20
  • Best player score: 32
  • Position: #93 / 135
  • Number of attempts: 2
Search and Replace 0 - 4978 entries

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

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

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 10
  • Position: #46 / 254
  • Number of attempts: 5
Top X - 212 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: #51 / 71
  • Number of attempts: 1
Number an outline - 280 entries

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

  • Best score: 25
  • Best player score: 55
  • Position: #44 / 78
  • Number of attempts: 5
Words in parens - 12929 entries

We should all ace this, right?

  • Best score: 13
  • Best player score: 14
  • Position: #34 / 3961
  • Number of attempts: 3
Assign list - 192 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 37
  • Position: #27 / 61
  • Number of attempts: 5
Draw the Go board - 149 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: #13 / 51
  • Number of attempts: 7
paste indent correction - JS - 112 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 / 59
  • Number of attempts: 2
Hole-in-one - 1018 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: #188 / 304
  • Number of attempts: 4
Delete unwanted lines - 411 entries

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

  • Best score: 9
  • Best player score: 9
  • Position: #3 / 229
  • Number of attempts: 4
Parsing with CSV: Unify lines and result. - 179 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 / 77
  • Number of attempts: 2
Minimalist Limerick - 520 entries

Reproduce this lovely poem.

  • Best score: 30
  • Best player score: 34
  • Position: #64 / 174
  • Number of attempts: 6
Prefixes and suffixes - 629 entries

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

  • Best score: 17
  • Best player score: 23
  • Position: #58 / 196
  • Number of attempts: 3
The name of the game - 665 entries

End up with the name of the game.

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

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

  • Best score: 16
  • Best player score: 25
  • Position: #39 / 167
  • Number of attempts: 5
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: 8
  • Position: #22 / 446
  • Number of attempts: 3
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: 29
  • Position: #314 / 480
  • Number of attempts: 3
Let's play some Ivmgolf - 1118 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 7
  • Position: #34 / 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: 21
  • Position: #5 / 754
  • Number of attempts: 7
Aligning function arguments to match a specific coding style - 247 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: #54 / 71
  • 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: 40
  • Position: #186 / 230
  • Number of attempts: 3
replacing each line of a block selection - 2999 entries

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

  • Best score: 18
  • Best player score: 21
  • Position: #354 / 777
  • Number of attempts: 5
Append semicolon after expressions - 1056 entries

Some lines need the semicolon, some don't.

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

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Position: #741 / 1748
  • Number of attempts: 5
Make it more readable - 2005 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 15
  • Position: #250 / 650
  • Number of attempts: 2
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: 23
  • Position: #202 / 336
  • 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: 37
  • Position: #155 / 166
  • Number of attempts: 4
Numbering a List - 1931 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 19
  • Position: #241 / 652
  • Number of attempts: 4
Shebangs for all - 1998 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: #311 / 515
  • Number of attempts: 1
Indentation - 534 entries

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

  • Best score: 20
  • Best player score: 23
  • Position: #29 / 177
  • Number of attempts: 6
Simple text editing with Vim - 12760 entries

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

  • Best score: 13
  • Best player score: 14
  • Position: #1070 / 3684
  • Number of attempts: 6
Reformat/Refactor a Golfer Class - 6942 entries

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

  • Best score: 28
  • Best player score: 36
  • Position: #442 / 1699
  • Number of attempts: 4

Contributed Challenges

Delete unwanted lines - 411 entries

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

Pairs of numbers - 363 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