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

Search and Replace 0 - 4434 entries

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

  • Best score: 12
  • Best player score: 15
  • Number of attempts: 2
remove dupes from array - 1257 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: 27
  • Number of attempts: 1
abcd > a b c d - 248 entries

transform the single spaces into 4 spaces repeat for each line

  • Best score: 15
  • Best player score: 15
  • Number of attempts: 1
Simple text editing with Vim - 11014 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: 4
Remove semicolons after expressions - 488 entries

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

  • Best score: 6
  • Best player score: 8
  • Number of attempts: 2
Make it more readable - 1797 entries

Insert blank lines to make it more organized and readable

  • Best score: 13
  • Best player score: 18
  • Number of attempts: 2
Shebangs for all - 1666 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: 15
  • Number of attempts: 4
I forgot quotes - 14294 entries

Oops.

  • Best score: 10
  • Best player score: 15
  • Number of attempts: 1
quotes inside quotes - 2942 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
  • Number of attempts: 1
Change the content of a string - 1265 entries

This docstring is a complete lie. Fix it.

  • Best score: 22
  • Best player score: 28
  • Number of attempts: 1
Greek Letters - 50 entries

Starting with a list of Greek letters, create a cross-reference table showing all of the Greek alpha-beta. You'll likely need to use digraphs (:help digraphs). Note that while most digraphs can be entered with either character first, lowercase sigma has two digraphs -- s* AND *s! Good luck!

  • Best score: 34
  • Best player score: 48
  • Number of attempts: 3
Switch function arguments - 1876 entries

How to switch two arguments of a function.

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 2
Remove noise from HTTP log - 622 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: 3
Wrap the text of an email message to 79 characters - 512 entries

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

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 1
Let's play some Ivmgolf - 968 entries

Oops, I spelled that wrong.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 3
Sort the VimGolf challenges by popularity - 306 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
  • Number of attempts: 2
attr_aligner - 3237 entries

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

  • Best score: 19
  • Best player score: 33
  • Number of attempts: 1
vim = 22 / 7 - 408 entries

pi square vim

  • Best score: 20
  • Best player score: 35
  • Number of attempts: 1
Words in parens - 11996 entries

We should all ace this, right?

  • Best score: 14
  • Best player score: 17
  • Number of attempts: 4
Exchanging Quotes - 776 entries

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

  • Best score: 30
  • Best player score: 40
  • Number of attempts: 1
Reverse and double space - 422 entries

Reverse the order of the given lines and double space everything

  • Best score: 14
  • Best player score: 16
  • Number of attempts: 1
Vertical Limit - 2230 entries

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

  • Best score: 21
  • Best player score: 28
  • Number of attempts: 3
A HAPPY NEW YEAR 2014 ! - 10083 entries

A HAPPY NEW YEAR 2014 !

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Append semicolon after expressions - 892 entries

Some lines need the semicolon, some don't.

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 1
paste indent correction - JS - 76 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: 21
  • Number of attempts: 1
A Simple One - 852 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
  • Number of attempts: 1
Letter case trickery - 1461 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: 12
  • Number of attempts: 3
Block Fun 1 - 158 entries

Manipulate the columns to produce desired result.

  • Best score: 14
  • Best player score: 22
  • Number of attempts: 2
Hole-in-one - 958 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: 24
  • Number of attempts: 1
Just the middle - 10337 entries

Delete the instructions at the top and bottom.

  • Best score: 7
  • Best player score: 9
  • Number of attempts: 1
switch variable - 4614 entries

how fast can you switch two variable ?

  • Best score: 11
  • Best player score: 12
  • Number of attempts: 2
Swap values - 4155 entries

Well, swap the values...

  • Best score: 11
  • Best player score: 13
  • Number of attempts: 2
Sort and add attributes - 1110 entries

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

  • Best score: 33
  • Best player score: 34
  • Number of attempts: 1
The meaning - 508 entries

Numbers are fun!

  • Best score: 5
  • Best player score: 5
  • Number of attempts: 3
The name of the game - 594 entries

End up with the name of the game.

  • Best score: 11
  • Best player score: 11
  • Number of attempts: 5
Numbering a List - 1760 entries

Pretty simple, number the list.

  • Best score: 13
  • Best player score: 21
  • Number of attempts: 5
Saving the hashes(#) - 1861 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: 30
  • Number of attempts: 4
Parsing with CSV: Unify lines and result. - 162 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: 23
  • Number of attempts: 3
Pairs of numbers - 336 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: 29
  • Number of attempts: 3
SFD-ROC: vimvimvim - 1337 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: 4
curist
Twitter:

entered into 40 challenges

contributed 0 challenges