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

Turn this csv list into queries - 181 entries

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

  • Best score: 98
  • Best player score: 113
  • Number of attempts: 2
Write Setters and Getters for PHP - 86 entries

Just simple automation of writing Setters and Getters like Doctrine might use.

  • Best score: 102
  • Best player score: 122
  • Number of attempts: 1
Number an outline - 199 entries

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

  • Best score: 25
  • Best player score: 65
  • Number of attempts: 2
SFD-ROC: vimvimvim - 1222 entries

Oh no, this line is longer than 80 chars... put each 'vim' on a new line.

  • Best score: 8
  • Best player score: 9
  • Number of attempts: 2
Remove noise from HTTP log - 579 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
  • Number of attempts: 1
paste indent correction - JS - 75 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: 18
  • Number of attempts: 1
Stairs Indenting - 355 entries

Indent each line with <line number> whitespaces.

  • Best score: 12
  • Best player score: 19
  • Number of attempts: 1
Search and Replace 0 - 3766 entries

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

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 2
abcd > a b c d - 232 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 1
Reformat/Refactor a Golfer Class - 5289 entries

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

  • Best score: 32
  • Best player score: 39
  • Number of attempts: 1
Words in parens - 10118 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 14
  • Number of attempts: 7
Assign list - 145 entries

Assign list elements to matrix

  • Best score: 30
  • Best player score: 48
  • Number of attempts: 1
VimGolfNight - 442 entries

Based on "The name of the game".

  • Best score: 12
  • Best player score: 12
  • Number of attempts: 1
Append semicolon after expressions - 820 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
The name of the game - 569 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Counting in binary - 322 entries

"a" represents 0; "A" represents 1. Start from zero and count to 15.

  • Best score: 16
  • Best player score: 43
  • Number of attempts: 4
switch variable - 4005 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Word frequency alignment - 195 entries

You've got to align the second column, but the spacing is inconvenient and there are nasty tabs in the way. If you're a "real Vim ninja," this could be very quick indeed...

  • Best score: 5
  • Best player score: 6
  • Number of attempts: 1
Letter case trickery - 1375 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
  • Number of attempts: 2
Shebangs for all - 1542 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: 12
  • Number of attempts: 3
you're stuck on jQuery < 1.7 - 314 entries

replace calls to jQuery 1.7+'s `on` with calls to pre 1.7 `bind`

  • Best score: 25
  • Best player score: 28
  • Number of attempts: 2
Remove semicolons after expressions - 423 entries

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

  • Best score: 6
  • Best player score: 8
  • Number of attempts: 2
The meaning - 481 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Change the content of a string - 1192 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 25
  • Number of attempts: 1
Top X - 177 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: 24
  • Number of attempts: 2
Simple text editing with Vim - 9723 entries

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

  • Best score: 13
  • Best player score: 14
  • Number of attempts: 2
A HAPPY NEW YEAR 2014 ! - 8842 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
The Cake is a Lie - 1097 entries

Correct the capitalization of each word

  • Best score: 9
  • Best player score: 10
  • Number of attempts: 1
Swap assigned value - 482 entries

Simple problem but looking for interesting solutions.

  • Best score: 10
  • Best player score: 11
  • Number of attempts: 1
Hole-in-one - 922 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: 18
  • Number of attempts: 3
Reconstruct the Sentence - 982 entries

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

  • Best score: 20
  • Best player score: 21
  • Number of attempts: 5
Exchanging Quotes - 724 entries

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

  • Best score: 30
  • Best player score: 35
  • Number of attempts: 1
Minimalist Limerick - 441 entries

Reproduce this lovely poem.

  • Best score: 31
  • Best player score: 38
  • Number of attempts: 2
quotes inside quotes - 2580 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: 2
  • Best player score: 14
  • Number of attempts: 3
vim = 22 / 7 - 391 entries

pi square vim

  • Best score: 20
  • Best player score: 23
  • Number of attempts: 2
Vim tetris - 301 entries

Vim can play tetris too!

  • Best score: 21
  • Best player score: 23
  • Number of attempts: 2
Switch function arguments - 1742 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
Vertical Limit - 1950 entries

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

  • Best score: 21
  • Best player score: 25
  • Number of attempts: 3
replacing each line of a block selection - 2304 entries

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

  • Best score: 17
  • Best player score: 20
  • Number of attempts: 4
Saving the hashes(#) - 1612 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
  • Number of attempts: 4
Enumerate words - 219 entries

Enumerate the unique words in order.

  • Best score: 23
  • Best player score: 26
  • Number of attempts: 2
Pairs of numbers - 316 entries

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

  • Best score: 26
  • Best player score: 27
  • Number of attempts: 3
attr_aligner - 2710 entries

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

  • Best score: 19
  • Best player score: 26
  • Number of attempts: 2
lamb had a little Mary - 447 entries

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

  • Best score: 16
  • Best player score: 32
  • Number of attempts: 3
Flodder-challenge - 784 entries

Replace the text the most efficient and win!

  • Best score: 27
  • Best player score: 33
  • Number of attempts: 1
Delete unwanted lines - 315 entries

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

  • Best score: 9
  • Best player score: 9
  • Number of attempts: 1
Going underground.... - 277 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: 33
  • Number of attempts: 2
Split the words - 311 entries

Add the spaces manually if you must, but if you use Vim's spell checking feature wisely, I think you'll save a LARGE number of strokes.

  • Best score: 18
  • Best player score: 42
  • Number of attempts: 1
Draw the Go board - 108 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: 65
  • Number of attempts: 4
Nathan
Twitter:

I was peer pressured into making this account.

entered into 49 challenges

contributed 0 challenges